This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C tree question
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Mathieu Lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 02 Dec 2003 20:06:57 -0800
- Subject: Re: C tree question
- References: <1070374891.29893.167.camel@chronos.inria.fr>
Mathieu Lacage wrote:
I have been trying lately to understand what kind of data is stored in
the tree output by the C frontend. Thanks to -fdump-translation-unit, I
This option is a debugging aid. It isn't meant to be complete. Its
output may change from time to time. In current sources, it only
appears to be dumping declarations, so it isn't dumping function bodies
for instance.
The exact question I'd like to answer is:
1) if (foo) bar;
2) if (foo) {bar;}
where bar; is a non-compound statement generates the exact same tree out
of the language frontend.
It would be unwise to make any assumptions here. This may depend on the
contents of bar, it may depend on the language front end being used, it
may depend on the target, it may depend on which gcc version you have, etc.
1) is the code fragment above relevant to my if (foo) {bar} sample ? I
suspect it might be related only to the enclosing {s of function bodies.
Yes.
2) If it is related to my sample, does the COMPOUND_STMT node still
exist at the end of the frontend run ?
No. It might be optimized away in the front end or the middle end,
depending on the circumstances.
Note that this whole area will change when the tree-ssa branch gets
accepted into the mainline, which could happen sometime after the
gcc-3.4 release branch is made. This will change how the front ends
work because it adds a new higher level IL.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com