Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #100060 > unrolled thread
| Started by | DFS <nospam@dfs.com> |
|---|---|
| First post | 2016-12-22 22:47 -0500 |
| Last post | 2017-01-07 18:51 -0500 |
| Articles | 20 on this page of 161 — 27 participants |
Back to article view | Back to comp.lang.c
How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2016-12-22 22:47 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ike Naar <ike@iceland.freeshell.org> - 2016-12-23 06:56 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 11:08 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 11:26 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 12:09 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 12:34 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 12:56 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 20:58 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 21:09 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Jean-Marc Bourguet <jm@bourguet.org> - 2016-12-23 13:36 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 12:39 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-24 16:46 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 13:04 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-25 09:43 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 22:01 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-24 15:21 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? luser droog <luser.droog@gmail.com> - 2016-12-24 15:29 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-25 16:53 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-25 13:13 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 09:42 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Manfred <noname@invalid.add> - 2017-02-03 20:40 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-29 13:47 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-29 14:33 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 10:04 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-01 11:38 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 13:49 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:17 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-03 13:26 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-26 17:29 -0600
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 10:10 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 08:33 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2016-12-27 20:22 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 10:18 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-27 13:28 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-27 15:55 -0600
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 11:01 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2016-12-27 16:40 -0600
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-28 11:53 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-29 01:34 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-29 06:27 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:47 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2016-12-30 08:45 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 15:26 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? asetofsymbols@gmail.com - 2017-01-01 13:03 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 03:04 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 08:27 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-02 12:37 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 10:42 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-12 21:24 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-14 11:15 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-16 00:31 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-18 21:45 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 18:24 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-02-04 13:49 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-10 01:57 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2017-02-10 10:32 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-13 08:44 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-02 10:42 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-02 13:06 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-03 10:53 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 07:01 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 09:01 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 12:36 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 09:51 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 13:08 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 14:07 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 11:28 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-03 22:49 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 11:53 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Robert Wessel <robertwessel2@yahoo.com> - 2017-01-03 18:39 -0600
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 00:47 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-04 09:49 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-04 15:45 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? David Brown <david.brown@hesbynett.no> - 2017-01-04 20:05 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 15:55 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-04 13:09 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 00:12 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-04 09:50 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-04 07:25 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Melzzzzz <Melzzzzz@zzzzz.com> - 2017-01-04 15:29 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-04 10:29 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-03 16:34 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-07 18:59 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-07 15:59 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-08 03:27 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-07 21:56 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-03 16:22 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-01-04 07:05 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-13 15:09 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-13 15:40 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-13 15:56 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-13 15:58 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-14 09:29 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-31 08:14 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-31 10:57 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-03 08:07 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-02-03 08:43 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-09 08:43 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-18 21:46 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-18 09:01 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2016-12-27 14:37 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 12:33 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 17:21 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 13:08 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 22:33 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-23 14:55 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 15:12 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 01:08 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-24 04:12 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-24 15:12 +0000
Re: Inadvertent trolls Noob <root@127.0.0.1> - 2016-12-24 11:34 +0100
Re: Inadvertent trolls BartC <bc@freeuk.com> - 2016-12-24 12:47 +0000
Typo or freudian slip? (Was: Inadvertent trolls) gazelle@shell.xmission.com (Kenny McCormack) - 2016-12-24 13:13 +0000
Re: Typo or freudian slip? (Was: Inadvertent trolls) BartC <bc@freeuk.com> - 2016-12-24 14:02 +0000
Re: Inadvertent trolls Keith Thompson <kst-u@mib.org> - 2016-12-24 12:36 -0800
Re: Inadvertent trolls Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-24 13:59 -0800
Re: Inadvertent trolls Gareth Owen <gwowen@gmail.com> - 2016-12-26 18:38 +0000
Re: C interpreter Noob <root@127.0.0.1> - 2016-12-24 23:39 +0100
Re: C interpreter BartC <bc@freeuk.com> - 2016-12-25 00:32 +0000
Re: Inadvertent trolls jacobnavia <jacob@jacob.remcomp.fr> - 2017-01-01 11:10 +0100
Re: Inadvertent trolls BartC <bc@freeuk.com> - 2017-01-01 11:54 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Richard Heathfield <rjh@cpax.org.uk> - 2016-12-23 09:52 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-04 23:38 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ian Collins <ian-news@hotmail.com> - 2017-01-05 17:49 +1300
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? David Brown <david.brown@hesbynett.no> - 2017-01-05 09:57 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Noob <root@127.0.0.1> - 2017-01-05 09:50 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-23 11:16 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-23 04:36 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-23 13:24 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-29 01:35 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-01 10:06 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-28 18:33 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-02 02:13 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-02 02:53 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-12 23:09 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-13 08:51 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 10:28 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-13 10:00 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? supercat@casperkitty.com - 2017-01-13 10:34 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? raltbos@xs4all.nl (Richard Bos) - 2017-01-18 21:00 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-14 00:17 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2017-01-14 13:52 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-16 00:18 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Keith Thompson <kst-u@mib.org> - 2016-12-28 18:40 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-28 16:48 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-28 17:01 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2016-12-29 01:08 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-29 01:27 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-13 01:59 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-23 13:01 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-04 14:08 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-05 00:05 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2017-01-05 12:08 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-05 10:41 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2017-01-05 18:08 +0100
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-05 17:08 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? BartC <bc@freeuk.com> - 2017-01-05 12:02 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? James Kuyper <jameskuyper@verizon.net> - 2017-01-05 14:36 -0500
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? antispam@math.uni.wroc.pl - 2017-01-07 20:20 +0000
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-07 12:55 -0800
Re: How does gcc (any compiler) actually convert a function call, say atoi(), into assembly/machine code? DFS <nospam@dfs.com> - 2017-01-07 18:51 -0500
Page 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2017-01-14 00:17 -0800 |
| Message-ID | <kfnk29ynjh0.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #101585 |
raltbos@xs4all.nl (Richard Bos) writes: > Tim Rentsch <txr@alumni.caltech.edu> wrote: > >> Keith Thompson <kst-u@mib.org> writes: >> >>> atoi() returns an int result. There's no good way for it to distinguish >>> between a valid result and an error. >> >> How atoi() is specified now gives it complete freedom for >> what to do on an error. Surely one of those possibilities >> is a good way of distinguishing an error and a valid result. > > Well... > > - How, when all values it can return are already potentially valid > return values? There is no room for an error value. It returns an > int, and all ints could be validly parsed. There is no int left to > indicate "not validly parsed". For example, the same way such cases are indicated in the various strto*l() functions, ie, by returning either INT_MIN or INT_MAX and setting errno. By the way, I believe the only situations where this applies are those that have a valid integer input string but whose value cannot be represented in the function's output type. Any input that is "not validly parsed", eg, "ZZZZZZ", is defined to have 0 as the function's return value. > - Any single implementation of atoi() could fudge it, possibly by > forbidding the parsing of one specific int value (of dubious legality, > but a workable hack in some circumstances), and certainly by setting > errno; but no portable program can afford to rely on any of those > methods, because not all of them will chose the same method (or, in > the case of the first one, value). > >>> And if a particular implementation >>> adds error handling to atoi(), that doesn't help if you want to write >>> portable code. >> >> That is of course true, but it has nothing to do with whether the >> specification allows decent error handling. I think your >> complaint is that the specification doesn't /force/ an >> implementation to provide any specific error handling, not that >> it doesn't /allow/ an implementation to provide a good way to >> handle errors. The specification does allow good error handling; >> it just doesn't insist on any particular way of doing so. > > Yes, and the problem is that since it doesn't insist on any particular > way or even insist that any error handling is used at all, no > user-programmer can rely on it. [...] We are talking at cross-purposes. I'm not saying anything about if or when atoi() might or should be used in a program. My comments have nothing to do with writing portable code. What I am saying is only about what the specifications of atoi() allow an implementation to do when an error condition occurs. IMO it is important not to confuse these two topics. They aren't the same, and should not be treated as such.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2017-01-14 13:52 -0800 |
| Message-ID | <lnh951jomn.fsf@kst-u.example.com> |
| In reply to | #101722 |
Tim Rentsch <txr@alumni.caltech.edu> writes:
> raltbos@xs4all.nl (Richard Bos) writes:
>> Tim Rentsch <txr@alumni.caltech.edu> wrote:
>>> Keith Thompson <kst-u@mib.org> writes:
>>>> atoi() returns an int result. There's no good way for it to distinguish
>>>> between a valid result and an error.
>>>
>>> How atoi() is specified now gives it complete freedom for
>>> what to do on an error. Surely one of those possibilities
>>> is a good way of distinguishing an error and a valid result.
>>
>> Well...
>>
>> - How, when all values it can return are already potentially valid
>> return values? There is no room for an error value. It returns an
>> int, and all ints could be validly parsed. There is no int left to
>> indicate "not validly parsed".
>
> For example, the same way such cases are indicated in the various
> strto*l() functions, ie, by returning either INT_MIN or INT_MAX
> and setting errno.
OK, good point. Given its description, atoi() is clearly not
*intended* to work that way, but an implementation could do it as a
(not terribly useful) extension. I probably should have thought
of that approach, but I didn't.
> By the way, I believe the only situations where this applies are
> those that have a valid integer input string but whose value
> cannot be represented in the function's output type. Any input
> that is "not validly parsed", eg, "ZZZZZZ", is defined to have 0
> as the function's return value.
That's a plausible interpretation, but I think the standard is
vague on that point. It says "Except for the behavior on error".
One could argue that an "error" is any condition in which it
strtol() doesn't set errno. One could also reasonably argue, I
think, that strtol("ZZZZZZ") is an "error", indicated to the caller
by storing the value of nptr in the object pointed to by endptr
(if it's non-null). I don't think the standard has a definition
of the word "error".
[...]
> We are talking at cross-purposes. I'm not saying anything about
> if or when atoi() might or should be used in a program. My
> comments have nothing to do with writing portable code. What I
> am saying is only about what the specifications of atoi() allow
> an implementation to do when an error condition occurs. IMO it
> is important not to confuse these two topics. They aren't the
> same, and should not be treated as such.
Agreed.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2017-01-16 00:18 -0800 |
| Message-ID | <kfnpojnifju.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #101807 |
Keith Thompson <kst-u@mib.org> writes:
> Tim Rentsch <txr@alumni.caltech.edu> writes:
>> raltbos@xs4all.nl (Richard Bos) writes:
>>> Tim Rentsch <txr@alumni.caltech.edu> wrote:
>>>> Keith Thompson <kst-u@mib.org> writes:
>>>>> atoi() returns an int result. There's no good way for it to distinguish
>>>>> between a valid result and an error.
>>>>
>>>> How atoi() is specified now gives it complete freedom for
>>>> what to do on an error. Surely one of those possibilities
>>>> is a good way of distinguishing an error and a valid result.
>>>
>>> Well...
>>>
>>> - How, when all values it can return are already potentially valid
>>> return values? There is no room for an error value. It returns an
>>> int, and all ints could be validly parsed. There is no int left to
>>> indicate "not validly parsed".
>>
>> For example, the same way such cases are indicated in the various
>> strto*l() functions, ie, by returning either INT_MIN or INT_MAX
>> and setting errno.
>
> OK, good point. Given its description, atoi() is clearly not
> *intended* to work that way, but an implementation could do it as a
> (not terribly useful) extension. I probably should have thought
> of that approach, but I didn't.
>
>> By the way, I believe the only situations where this applies are
>> those that have a valid integer input string but whose value
>> cannot be represented in the function's output type. Any input
>> that is "not validly parsed", eg, "ZZZZZZ", is defined to have 0
>> as the function's return value.
>
> That's a plausible interpretation, but I think the standard is
> vague on that point. It says "Except for the behavior on error".
> One could argue that an "error" is any condition in which it
> strtol() doesn't set errno. One could also reasonably argue, I
> think, that strtol("ZZZZZZ") is an "error", indicated to the caller
> by storing the value of nptr in the object pointed to by endptr
> (if it's non-null). I don't think the standard has a definition
> of the word "error".
Two comments. First, just looking at the strto*l() functions, I
wouldn't describe what happens with "ZZZZZZ" as the input string
as an error. The actions are well defined, the circumstance can
be checked for so that the special value (ie, zero) is not seen
for something it isn't, and errno is not set. I suppose an
argument could be made that this case should be considered an
"error" but that looks to me like a pretty steep uphill battle.
Second, having said that, I agree that the Standard isn't
clear as to whether 'atoi( "ZZZZZZ" )' counts as an "error".
In fact, I don't see any way (at least not so far) of reading
the various relevant passages that gives an interpretation
that is consistent with all of them. So I must withdraw
my previous statement, and in its place offer -- basically
nothing at all! The description given looks hopelessly
muddled. In practice I still think atoi() is not all that
bad, but in terms of what the Standard clearly guarantees
it's a nightmare.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-28 18:40 -0800 |
| Message-ID | <lnvau31mqq.fsf@kst-u.example.com> |
| In reply to | #100094 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
>> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>>> I think you mean something different from what this says.
>>> An actual atoi() function may be perfectly fine. What I
>>> think you mean is that atoi() has a specification that is
>>> lacking. Your complaint is not with how atoi() itself is
>>> designed and/or implemented, which may be perfectly fine,
>>> but with the specification for atoi() which allows lesser
>>> quality implementations.
>>>
>>
>> int x = atoi("NaN");
>>
>> what should x be at this point and why?
>
> Zero. atoi must behave like (int)strtol(nptr, (char **)NULL, 10) except
> on error, and there is no reason to take advantage of that permission to
> return (or do) anything else in the this case (or, I'd argue, in any
> other case).
Whether there's any reason or not, the standard places no requirements
on the behavior of atoi() on error.
I'm reasonably sure that atoi() predates strtol(). There could
still be old implementations that just read digits and build up
the result, with no checks for numeric overflow.
Some implementations of atoi() do just call strtol() and ignore errors
-- but even then, if long int has a wider range than int, and strtol()
returns a value outside the range of int, the conversion to int has
undefined behavior. (Of course this doesn't apply to atoi("NaN").)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2016-12-28 16:48 -0800 |
| Message-ID | <kfn8tqzy2z9.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #100094 |
Keith Thompson <kst-u@mib.org> writes: > Malcolm McLean <malcolm.mclean5@btinternet.com> writes: > [...] >> It;s virtually impossible to reverse engineer a huge hunk of >> software like gcc like that. If you root around in the documentation >> for developers it will tell you where the code for compiling atoi >> is stored. It's probably inlined as a special function because >> it is standard and so simple. > > A quick experiment shows that gcc generates a call to strtol() when > optimization is enabled. I haven't taken the time to figure out how > it does that, whether it knows that atoi() is a standard function, > or whether it takes advantage of some annotation on the declaration. > > It should also be mentioned that atoi() is a poorly designed > function. [...] I think you mean something different from what this says. An actual atoi() function may be perfectly fine. What I think you mean is that atoi() has a specification that is lacking. Your complaint is not with how atoi() itself is designed and/or implemented, which may be perfectly fine, but with the specification for atoi() which allows lesser quality implementations.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2016-12-28 17:01 -0800 |
| Message-ID | <eea5e824-baab-4f76-b0b3-ad8c4740492c@googlegroups.com> |
| In reply to | #100611 |
On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>
> I think you mean something different from what this says.
> An actual atoi() function may be perfectly fine. What I
> think you mean is that atoi() has a specification that is
> lacking. Your complaint is not with how atoi() itself is
> designed and/or implemented, which may be perfectly fine,
> but with the specification for atoi() which allows lesser
> quality implementations.
>
int x = atoi("NaN");
what should x be at this point and why?
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2016-12-29 01:08 +0000 |
| Message-ID | <o41nir$fct$1@dont-email.me> |
| In reply to | #100616 |
On 29/12/2016 01:01, Malcolm McLean wrote:
> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>>
>> I think you mean something different from what this says.
>> An actual atoi() function may be perfectly fine. What I
>> think you mean is that atoi() has a specification that is
>> lacking. Your complaint is not with how atoi() itself is
>> designed and/or implemented, which may be perfectly fine,
>> but with the specification for atoi() which allows lesser
>> quality implementations.
>>
>
> int x = atoi("NaN");
>
> what should x be at this point and why?
>
From MSDN docs:
"The return value is 0 for atoi and _wtoi, if the input cannot be
converted to a value of that type."
...
"The function stops reading the input string at the first character that
it cannot recognize as part of a number."
Input format is:
[whitespace] [sign] [digits]
(which presumably can be followed by anything else).
That seems perfectly straightforward. So your example returns zero. If
it's important, verify the string before passing it to atoi.
--
Bartc
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-29 01:27 +0000 |
| Message-ID | <8760m3frtm.fsf@bsb.me.uk> |
| In reply to | #100616 |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>>
>> I think you mean something different from what this says.
>> An actual atoi() function may be perfectly fine. What I
>> think you mean is that atoi() has a specification that is
>> lacking. Your complaint is not with how atoi() itself is
>> designed and/or implemented, which may be perfectly fine,
>> but with the specification for atoi() which allows lesser
>> quality implementations.
>>
>
> int x = atoi("NaN");
>
> what should x be at this point and why?
Zero. atoi must behave like (int)strtol(nptr, (char **)NULL, 10) except
on error, and there is no reason to take advantage of that permission to
return (or do) anything else in the this case (or, I'd argue, in any
other case).
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2017-01-13 01:59 -0800 |
| Message-ID | <kfnk29zqo03.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #100616 |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Thursday, December 29, 2016 at 12:48:50 AM UTC, Tim Rentsch wrote:
>
>> I think you mean something different from what this says.
>> An actual atoi() function may be perfectly fine. What I
>> think you mean is that atoi() has a specification that is
>> lacking. Your complaint is not with how atoi() itself is
>> designed and/or implemented, which may be perfectly fine,
>> but with the specification for atoi() which allows lesser
>> quality implementations.
>
> int x = atoi("NaN");
>
> what should x be at this point and why?
I have no idea why you followed up with this question,
since it has no bearing on my comment.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-12-23 13:01 +0000 |
| Message-ID | <87lgv6bxzd.fsf@bsb.me.uk> |
| In reply to | #100060 |
DFS <nospam@dfs.com> writes:
> #include <stdio.h>
> int main(void) {
> printf("%d\n",atoi("20161222"));
> }
>
>
> The current version of gcc is here.
> http://mirrors.concertpass.com/gcc/releases/gcc-6.3.0/
>
> Which file(s) in the compiler are responsible for converting
> atoi("20161222") into the final executable form?
No one has answered the question you asked though it's possible you
meant the questions that was answered.
gcc will treat atoi("20161222") as a normal function call but you won't
be able to find the files that do that. The process involves many
stages so there is no one place where the expression atoi("20161222") is
converted. In fact, many program will be involved. The compiler's
output will be assembled into what is called an object file, and that
will be linked with a C library to generate the final executable form.
> Most gcc files are themselves .c and .h files.
>
> I looked thru a bunch of files and other than a couple in the Go
> language folder, couldn't find a mention of atoi.
This suggests that you are asking about the internals of atoi. It's
good to explore sources, but always remember that they are the result of
decades of development and are often far more complex than one might
expect.
Here is glibc's atoi:
http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/atoi.c
as you can see it is just a call to the main string to number conversion
function which is here. When you go looking for that you will find a
lot of internal gcc housekeeping code that eventually leads you to
http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/strtol_l.c
but there is a lot of noise in that file too. The implementation
includes extensions and various other complications that make it very
hard to see what's really going on.
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | "James R. Kuyper" <jameskuyper@verizon.net> |
|---|---|
| Date | 2017-01-04 14:08 -0500 |
| Message-ID | <87d022a5-dd12-2c06-46d3-2a1db911c905@verizon.net> |
| In reply to | #100060 |
On 12/22/2016 10:47 PM, DFS wrote:
> #include <stdio.h>
> int main(void) {
> printf("%d\n",atoi("20161222"));
> }
...
> Which file(s) in the compiler are responsible for converting
> atoi("20161222") into the final executable form?
...
The question you asked in the body of your message is quite different
from the question asked in the "Subject:" header: "How does gcc (any
compiler) actually convert a function call, say atoi(), into
assembly/machine code?". As far as I can tell, every one so far has
addressed the question in the body of your message. Are you actually
interested in the answer to your "Subject:" question? No one has even
attempted to answer it, probably because the answer can be quite
different for different targets. There is no good general answer, but
hopefully an example for a specific target will give you some
understanding of what's going on.
On the platform I'm currently using, using the code you provided with
the addition of "#include <stdlib.h>", the call to atoi() is
implemented using the following assembly language:
.LC0: .
.string "20161222"
...
movl $.LC0, %edi
call atoi
What gcc had to do to convert this function call was first, to parse
atoi("20161222") as the name of a function to be called, with an
argument which is a string literal. The string literal requires that an
array of char be allocated, initialized with "20161222", and that the
address of the first element of that array be passed as the first and
only argument to that function. Since the string has no user-provided
name, gcc chose LC0. It then issued the assembly code that specified
creation of such a string. Because it knows the assembly language for
the target platform, as well as the calling conventions of that target,
it knew that the address of that string needed to be loaded into %edi,
and that movl was the appropriate instruction to do that loading, and
that the operands of movl needed to be listed in the order source,
destination. It also knew that the call itself could be converted into a
"call" instruction.
Note: I do NOT know as much as gcc does about the assembly language in
question - I'm just presuming that it's correct; it seems reasonable,
based upon the other three assembly languages that I am more familiar with.
Does that answer your "Subject:" question? I'm really not sure, because
I don't quite understand the question. I feel as if I provided far more
explanation than required, without actually providing the desired
explanation.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-01-05 00:05 -0500 |
| Message-ID | <o4kk32$e2q$2@dont-email.me> |
| In reply to | #101121 |
On 1/4/2017 2:08 PM, James R. Kuyper wrote:
> On 12/22/2016 10:47 PM, DFS wrote:
>> #include <stdio.h>
>> int main(void) {
>> printf("%d\n",atoi("20161222"));
>> }
> ...
>> Which file(s) in the compiler are responsible for converting
>> atoi("20161222") into the final executable form?
> ...
>
> The question you asked in the body of your message is quite different
> from the question asked in the "Subject:" header: "How does gcc (any
> compiler) actually convert a function call, say atoi(), into
> assembly/machine code?". As far as I can tell, every one so far has
> addressed the question in the body of your message. Are you actually
> interested in the answer to your "Subject:" question? No one has even
> attempted to answer it, probably because the answer can be quite
> different for different targets. There is no good general answer, but
> hopefully an example for a specific target will give you some
> understanding of what's going on.
>
> On the platform I'm currently using, using the code you provided with
> the addition of "#include <stdlib.h>", the call to atoi() is
> implemented using the following assembly language:
>
> .LC0: .
> .string "20161222"
> ...
> movl $.LC0, %edi
> call atoi
>
> What gcc had to do to convert this function call was first, to parse
> atoi("20161222") as the name of a function to be called, with an
> argument which is a string literal. The string literal requires that an
> array of char be allocated, initialized with "20161222", and that the
> address of the first element of that array be passed as the first and
> only argument to that function. Since the string has no user-provided
> name, gcc chose LC0. It then issued the assembly code that specified
> creation of such a string. Because it knows the assembly language for
> the target platform, as well as the calling conventions of that target,
> it knew that the address of that string needed to be loaded into %edi,
> and that movl was the appropriate instruction to do that loading, and
> that the operands of movl needed to be listed in the order source,
> destination. It also knew that the call itself could be converted into a
> "call" instruction.
> Note: I do NOT know as much as gcc does about the assembly language in
> question - I'm just presuming that it's correct; it seems reasonable,
> based upon the other three assembly languages that I am more familiar with.
>
> Does that answer your "Subject:" question? I'm really not sure, because
> I don't quite understand the question. I feel as if I provided far more
> explanation than required, without actually providing the desired
> explanation.
Thanks for the answer. I guess I didn't phrase the question correctly.
What I want to know is what part of the gcc compiler (which actual
files/lines) translates C source code into executable assembly and/or
machine code.
I mentioned gcc because its source is available and I was hoping someone
could point me to it. I looked through it for a while, but it's a big
system.
Similarly, I can look at the source code for the reference Python
interpreter (which is written in C) and find out exactly where it
creates objects and executes various functions.
[toc] | [prev] | [next] | [standalone]
| From | Norbert_Paul <norbertpauls_spambin@yahoo.com> |
|---|---|
| Date | 2017-01-05 12:08 +0100 |
| Message-ID | <o4l9ci$95e$1@dont-email.me> |
| In reply to | #101156 |
DFS wrote:
> What I want to know is what part of the gcc compiler (which actual
> files/lines) translates C source code into executable assembly and/or
> machine code.
>
> I mentioned gcc because its source is available and I was hoping someone
> could point me to it. I looked through it for a while, but it's a big
> system.
>
> Similarly, I can look at the source code for the reference Python
> interpreter (which is written in C) and find out exactly where it
> creates objects and executes various functions.
You may be interested in some of Googles friendly answers to
"Can you please tell me how compilers are designed?"
Google's Answers on "compiler design" include
https://www.tutorialspoint.com/compiler_design/index.htm
https://en.wikipedia.org/wiki/Compiler
Have fun.
Besides:
My compiler turns
printf("%d\n",atoi("20161222"));
into
LUI V0, -25337 # store -25337 into Register V0
JAL atoi # call atoi-Function ... but first ...
ADDIU A0, V0, 29452 # .. store 29452-25337 into the 1st argument register A0
# A0 contains the adress of "20161222".
# A C-funtion on a MIPS take the first argument from register A0
LUI V1, -25337 # this is where atoi returns to with result in register V0
# store -25337 into register V1
ADDIU A0, V1, 29464 # store 29464-25337 into 1st argument register A0 (adreess of "%d\n")
JAL _printf_cdnopuxX # call library function printf ... but first ..
ADDU A1, V0, ZERO # .. move result from atoi (register V0) into 2nd arg register A1
# printf takes its arguments from A0 and A1
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2017-01-05 10:41 -0500 |
| Message-ID | <o4lpcn$u4$2@dont-email.me> |
| In reply to | #101166 |
On 1/5/2017 6:08 AM, Norbert_Paul wrote:
> DFS wrote:
>> What I want to know is what part of the gcc compiler (which actual
>> files/lines) translates C source code into executable assembly and/or
>> machine code.
>>
>> I mentioned gcc because its source is available and I was hoping someone
>> could point me to it. I looked through it for a while, but it's a big
>> system.
>>
>> Similarly, I can look at the source code for the reference Python
>> interpreter (which is written in C) and find out exactly where it
>> creates objects and executes various functions.
>
> You may be interested in some of Googles friendly answers to
> "Can you please tell me how compilers are designed?"
>
> Google's Answers on "compiler design" include
> https://www.tutorialspoint.com/compiler_design/index.htm
> https://en.wikipedia.org/wiki/Compiler
>
> Have fun.
No wink?
> Besides:
>
> My compiler turns
> printf("%d\n",atoi("20161222"));
> into
> LUI V0, -25337 # store -25337 into Register V0
> JAL atoi # call atoi-Function ... but first ...
> ADDIU A0, V0, 29452 # .. store 29452-25337 into the 1st argument
> register A0
> # A0 contains the adress of "20161222".
> # A C-funtion on a MIPS take the first argument
> from register A0
> LUI V1, -25337 # this is where atoi returns to with result in
> register V0
> # store -25337 into register V1
> ADDIU A0, V1, 29464 # store 29464-25337 into 1st argument register
> A0 (adreess of "%d\n")
> JAL _printf_cdnopuxX # call library function printf ... but first ..
> ADDU A1, V0, ZERO # .. move result from atoi (register V0) into
> 2nd arg register A1
> # printf takes its arguments from A0 and A1
Cool.
Which compiler?
Can you point to the files/lines in your compiler that generated that
assembly?
Some here seem to think you can't really find such files/lines in gcc -
that it's too 'complicated'. I'm surprised to hear that from C experts.
I suppose I should take them at their word, but it would seem to be easy
to find where the C call to atoi is turned into 'JAL atoi' (in your
example).
[toc] | [prev] | [next] | [standalone]
| From | Norbert_Paul <norbertpauls_spambin@yahoo.com> |
|---|---|
| Date | 2017-01-05 18:08 +0100 |
| Message-ID | <o4luep$ka2$1@dont-email.me> |
| In reply to | #101173 |
DFS wrote:
> On 1/5/2017 6:08 AM, Norbert_Paul wrote:
>> DFS wrote:
>>> What I want to know is what part of the gcc compiler (which actual
>>> files/lines) translates C source code into executable assembly and/or
>>> machine code.
>>>
>>> I mentioned gcc because its source is available and I was hoping someone
>>> could point me to it. I looked through it for a while, but it's a big
>>> system.
>>>
>>> Similarly, I can look at the source code for the reference Python
>>> interpreter (which is written in C) and find out exactly where it
>>> creates objects and executes various functions.
>>
>> You may be interested in some of Googles friendly answers to
>> "Can you please tell me how compilers are designed?"
>>
>> Google's Answers on "compiler design" include
>> https://www.tutorialspoint.com/compiler_design/index.htm
>> https://en.wikipedia.org/wiki/Compiler
>>
>> Have fun.
>
> No wink?
https://www.google.com/search?q=wink+emoticon&tbm=isch
> Cool.
>
> Which compiler?
xc32 from Microchip.
> Can you point to the files/lines in your compiler that generated that
> assembly?
No, but I know it is derived from gcc.
> Some here seem to think you can't really find such files/lines in gcc -
> that it's too 'complicated'. I'm surprised to hear that from C experts.
It is indeed a complicated process. Can you find the parts of your car
that makes it take you from place A to place B? Is it the wheels?
> I suppose I should take them at their word, but it would seem to be easy
> to find where the C call to atoi is turned into 'JAL atoi' (in your
> example).
I am not a specialist in compiler design, but the compiler should hold a
structure like, say
function_call(1, atoi, adress_of("20161222"))
in the abstract representation of the program the compiler generates.
Then this would be turned into abstract machine language instructions like, say
pass_arg(0, adress_of("20161222")) /* first Argument */
call_function(atoi) /* function call */
Depending on the target processor this is then turned into assembly instructions, say
pass_arg(0, adress_of("20161222")) becomes li A0, adress_of("20161222")
call_function(atoi) becomes jal atoi
for a MIPS, or
pass_arg(0, adress_of("20161222")) becomes MOV R3, #0xFF ;memory type of constants
and MOV R2, #HIGH adress_of("20161222")
and MOV R1, #LO adress_of("20161222")
call_function(atoi) becomes LCALL _atoi ; underscore means "has args"
for an 8051.
(Note that MIPS' "li" is not a machine instruction but a macro which the assembler expands into
instructions that make a register contain the given constant. The last of these instructions is
orderd after the "jal" by the assembler(so-called "branch delay slot"). This is why in the
disassembly the function is called before argument-passing seems to be finished.)
So you have to understand the architecture of the compiler in question and spot the part
which turns abstract machine code into target-specific assembly.
wink? Take one of the above.
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2017-01-05 17:08 +0000 |
| Message-ID | <o4lufl$l2l$1@dont-email.me> |
| In reply to | #101173 |
On 05/01/2017 15:41, DFS wrote: > Can you point to the files/lines in your compiler that generated that > assembly? > > Some here seem to think you can't really find such files/lines in gcc - > that it's too 'complicated'. I'm surprised to hear that from C experts. > > I suppose I should take them at their word, but it would seem to be easy > to find where the C call to atoi is turned into 'JAL atoi' (in your > example). Have a look at the source code for Tiny C, which is much simpler than gcc. (www.tinycc.org) I've looked through it searching for references to "call" (the call instruction for x86 target). I found these (not in the same place): ALT(DEF_ASM_OP1(call, 0xff, 2, OPC_MODRM, OPT_INDIR)) ALT(DEF_ASM_OP1(call, 0xe8, 0, OPC_JMP, OPT_ADDR)) DEF_ASM(call) OP(CALL, "call", 0x28) (I suspect the last isn't for x86.) Even here, they are buried inside macros. The exact code for 'call', including pass arguments and picking up the return value, depends on target processor and calling convention, as well as the type of the result. You're welcome to try and find where it's used! Other people's code is always going to have this problem, it's not peculiar to compilers. (In my non-C compiler, the call to atoi() is rather special as it calls to C are viewed as foreign functions and need different treatment. But the code involved is for /any/ C function not just atoi. There is nothing special about atoi() itself; it's just another function. Although being part of the standard library, it may be sometimes be handled differently.) -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2017-01-05 12:02 +0000 |
| Message-ID | <o4lchj$jhk$1@dont-email.me> |
| In reply to | #101156 |
On 05/01/2017 05:05, DFS wrote:
> What I want to know is what part of the gcc compiler (which actual
> files/lines) translates C source code into executable assembly and/or
> machine code.
>
> I mentioned gcc because its source is available and I was hoping someone
> could point me to it. I looked through it for a while, but it's a big
> system.
You're not going to find it, and not only because gcc is a huge system.
Even with a simpler compiler there are various stages in getting from
"a+b" to the generated code that implements that operation.
"a+b" is preprocessed (in case a or b are macros). It is converted into
some internal structure. The names "a" and "b" are resolved. It is
type-checked and type conversions may be added. Then it might be
converted into an intermediate form. It might be optimised. Eventually
machine code may be produced. Maybe /that/ is then optimised.
My compilers are particularly simple, but even there, after some of that
processing, and when both a and b are integers, and when b is of a
simple form, then the code-generation lines for "a+b" might look like this:
ax = loadexpr(a)
bx = evalexpr(b)
genmc(m_add, ax, bx)
a is the internal representation of "a" (it could be any expression) and
b is the rep for "b". ax and bx represent operands meaningful for the
chosen target (registers or memory or immediate operands). m_add is a
code for the target's 'add' instruction. The size of the operation is
encoded within ax and bx.
And that doesn't generate the native code, but an internal
representation of it. Another stage writes that out as asm source (this
compiler doesn't produce binary).
But this is one of a million ways of doing it. And with gcc, it might
not exist, if it decides the result of a+b is not needed.
> Similarly, I can look at the source code for the reference Python
> interpreter (which is written in C) and find out exactly where it
> creates objects and executes various functions.
That's not the same thing. Python includes a byte-code compiler where it
turns "a+b" into a byte-code sequence of instructions. It would be more
analogous to find where that happens, rather than looking at the
executable code (as that would be like looking at the machine code for
"a+b").
--
Bartc
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2017-01-05 14:36 -0500 |
| Message-ID | <o4m74h$m57$1@dont-email.me> |
| In reply to | #101156 |
On 01/05/2017 12:05 AM, DFS wrote: ... > What I want to know is what part of the gcc compiler (which actual > files/lines) translates C source code into executable assembly and/or > machine code. The fundamental problem with your question is that "translate C source code into executable assembly and/or machine code" is an accurate description of what the entire compiler does. Every line of the compiler performs some part of that process. This isn't quite true of gcc, because it is a compiler collection, so many parts of gcc have nothing to do with C, being responsible for compiling some other language entirely. gcc also targets many different platforms, so large portions of gcc are devoted to generating machine code for targets other than the one you're currently using it for. However, if you have a compiler for a single language targeting a single platform, then the only correct answer to your question is "basically, every single line of the entire compiler program". Nit-pick: you specified "executable" - a compiler as such does not generate executable code; it requires a linker to create an executable. Most of the compilers I've used over the last several decades automatically invoke the linker for you, so it appears as if the compiler is producing the executable. However, technically, the correct answer to your question requires not only looking at every line of the compiler source code, but also at every line of the linker source code. To get a smaller answer than that, you need to ask a question about a smaller sub-task of the entire task you're currently asking about. > I mentioned gcc because its source is available and I was hoping someone > could point me to it. I looked through it for a while, but it's a big > system. > > Similarly, I can look at the source code for the reference Python > interpreter (which is written in C) and find out exactly where it > creates objects and executes various functions. C is a compiled language, not an interpreted one. Therefore, a C compiler does not create the objects or execute the functions that are relevant to your source code. It generates code which will create those objects and execute those functions when that code gets executed.
[toc] | [prev] | [next] | [standalone]
| From | antispam@math.uni.wroc.pl |
|---|---|
| Date | 2017-01-07 20:20 +0000 |
| Message-ID | <o4riic$pnv$1@z-news.wcss.wroc.pl> |
| In reply to | #101156 |
DFS <nospam@dfs.com> wrote:
>
> Thanks for the answer. I guess I didn't phrase the question correctly.
>
> What I want to know is what part of the gcc compiler (which actual
> files/lines) translates C source code into executable assembly and/or
> machine code.
>
> I mentioned gcc because its source is available and I was hoping someone
> could point me to it. I looked through it for a while, but it's a big
> system.
Translation goes into several stages. First is preprocessing, lexing
and parser. Parser produces trees which are quite different
data structure than source text, but contain essentially the
same information. In gcc-4.7.3 parser is in file 'gcc/c-parser.c'.
This tree representation goes trough several transformations
which change it quite a lot. However, all allong it is C-like.
You can pass too gcc special options to see the intermediate
forms printes in C-like notation. If you give '-fdump-tree-all'
you will get all tree intermediate forms (there are specialized
options to only get form at selected stage). Atfter the tree
transformations code is converted from C-like to abstract
assembly, that is RTL. Translation to RTL is split into
several files. For example calls are handled in 'gcc/calls.c'.
Again RTL goes trough several transformations. You
can get printed representation of intermediate form
giving '-fdump-rtl-all' option to gcc. At the end RTL
is converted to actial assembly. Again this convertion
is split into few files. And several files, including
handling output of executable instructions are missing
from the source. Instead, gcc contains a generator programs
(in 'gcc/genoutput.c' for RTL to assembler) that during gcc
build read tables describing your target machine and
produces C source of translator routines. Generated
routines for RTL to assembler transformation are in
'gcc/insn-output.c' in the build tree -- so you need to
compile gcc to get this file.
If your goal is understanding I would suggest to look
at old versions of gcc (oldest you can find). Modern
version have similar structure, but added a lot of
intermediate transformation. More precisely, gcc-1.x
and gcc-2.x converted C to RTL at very early stage,
essentially directly from the parser and optimizations
worked on RTL. Starting from gcc-3 parser produces
tree from and most optimizations work on tree froms.
Or you may look at some toy compilers which may fit
better to your idea of compiling. There are several
such compilers on the net, but C is too big language
to handle in toy compiler so you will find at best
compiler handling some subset of C, or some made-up
languages which are easier to compile.
--
Waldek Hebisch
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2017-01-07 12:55 -0800 |
| Message-ID | <9c0703e7-4e77-4c39-8e89-45d180a2d3d9@googlegroups.com> |
| In reply to | #101244 |
On Saturday, January 7, 2017 at 8:20:35 PM UTC, anti...@math.uni.wroc.pl wrote: > > Or you may look at some toy compilers which may fit > better to your idea of compiling. There are several > such compilers on the net, but C is too big language > to handle in toy compiler so you will find at best > compiler handling some subset of C, or some made-up > languages which are easier to compile. > I've got a "toy" interpreter for C. Maybe a bit unfair to describe it as such, but it was written by one person ( Zik Saleeba ). It's called picoc.
[toc] | [prev] | [next] | [standalone]
Page 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9 Next page →
Back to top | Article view | comp.lang.c
csiph-web