* loop representation in gcc during parsing
@ 2008-06-23 1:37 Isil Dillig
0 siblings, 0 replies; only message in thread
From: Isil Dillig @ 2008-06-23 1:37 UTC (permalink / raw)
To: gcc-help
Hi,
I'm trying to use GCC 4.3.0 for a program analysis frontend, and I've
noticed that for, while, and do-while loops are all converted to a lower
level representation using goto statements during the parsing phase.
I've been trying to recover the source-code-like higher-level loop
representation; however, I'm confused about a few things.
Consider the following nested for loop:
int i, j;
for(i = 0; i<size; i++)
{
for(j=i, j>i, j--){
....
}
...
}
In the function c_parser_for_statement in the file c-parser.c, it seems
like the body of the outer for loop is an _empty statement list_. It
seems to me that this statement list is somehow being correctly patched
at a later point in time, but I don't quite understand how this works.
My idea was to maintain a mapping from the original loop representation
with the original loop body, init-expression, etc to the modified lower
level gcc representation, but since the body is an empty statement list
at this point, I can't recover the original structure of the loop.
I'd really appreciate any explanation about how specifically loops are
converted to a lower-level representation and why the body of the loop
looks like an empty statement list during parsing. Or if there is a
better way of recovering the higher-level loop representation, I would
also appreciate any tips about that.
Thanks a lot in advance,
Isil
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-23 1:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-23 1:37 loop representation in gcc during parsing Isil Dillig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).