This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: optimizing away parts of macros?


On 17 April 2006 23:47, David Nicol wrote:

> Thank you.  Nobody is aware of such a problem.

  There is no problem.  What you described - at least, in the terms you used
to describe it in your first post - is exactly what the compiler does and
exactly what it should do:

"GCC appears to be treating my long macro as some kind of block
and throwing out variables that are not used within it instead of simply
pasting the code in at the macro invocation point."

  What exactly do you think gcc does with the code after "simply pasting [it]
in"?

  Yes, it treats the entire function as a block and optimises it.  That's part
of the process of compilation.  Even at -O0 there are some basic processes of
data life and flow analysis occurring.  The variables will probably have had
stack slots assigned to them (that simply don't get used) at O0.  How you can
infer that gcc has "thrown them out" when by your own admission the code
doesn't use them is a mystery to me.

  If you have mysterious segfaults that are fixed by placing a printf call,
that almost certainly reflects a bug in your code; most likely an aliasing
problem that is leading the register allocator to think something's in one
place when it's actually somewhere else, but without any reproducible testcase
nobody can help you with that.  Hence the requests to visit the bug report
page at the gcc site and refashion your query along the lines suggested there.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]