public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* source code to object code tracetability
@ 2013-06-16 17:06 Barry Holm
  2013-06-16 22:57 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Holm @ 2013-06-16 17:06 UTC (permalink / raw)
  To: gcc

Hi,

I am trying to analyze source code to object code traceability while
using C source code and GCC 3.3.2 with optimization levels O0, O1, O2.
I create test cases that each test case (separate routine) contains
one C source code construct (if - else, do-while, for loop, switch and
etc.) and analyse the traceability to the object code. I would like to
ensure that all cases of constructs in the source code are covered by
this analysis.  I wonder if I need to extend the list of constructs
with additional cases as “if….else do….while”  in case the object code
created from separate  “if….else" and "do….while” statements is
different from the object code created  from two consecutive “if…else
do ... while” statements.  Is there a way to identify the full list of
these constructs to ensure that each object code is traceable back to
the source code using optimization level -O2? How different is this
list from optimization level -O1 or -O0?

Thanks,

Barry.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: source code to object code tracetability
  2013-06-16 17:06 source code to object code tracetability Barry Holm
@ 2013-06-16 22:57 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2013-06-16 22:57 UTC (permalink / raw)
  To: Barry Holm; +Cc: gcc

On Sun, Jun 16, 2013 at 10:06 AM, Barry Holm <barry.holm22@gmail.com> wrote:
>
> I am trying to analyze source code to object code traceability while
> using C source code and GCC 3.3.2 with optimization levels O0, O1, O2.
> I create test cases that each test case (separate routine) contains
> one C source code construct (if - else, do-while, for loop, switch and
> etc.) and analyse the traceability to the object code. I would like to
> ensure that all cases of constructs in the source code are covered by
> this analysis.  I wonder if I need to extend the list of constructs
> with additional cases as “if….else do….while”  in case the object code
> created from separate  “if….else" and "do….while” statements is
> different from the object code created  from two consecutive “if…else
> do ... while” statements.  Is there a way to identify the full list of
> these constructs to ensure that each object code is traceable back to
> the source code using optimization level -O2? How different is this
> list from optimization level -O1 or -O0?

You didn't really say what the goal was.

At -O2 some source code constructs can disappear from the object code
entirely, because the results they compute are unused.  Is that OK for
your purposes?

When optimizing, the compiler doesn't really see the input in source
code terms.  Conditions and loops are broken down into simple branches
and conditional branches, then basic blocks and loops are built out of
that.  So the divergence between the source code and the compiled code
can be fairly large.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-16 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-16 17:06 source code to object code tracetability Barry Holm
2013-06-16 22:57 ` Ian Lance Taylor

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).