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]

optimizing away parts of macros?


I am using
gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)

under the Inline::C perl module

and having a very weird situation.

I have a multi-line macro that declares several variables and then does some
work with them, for use in several functions that have similar invocations,
interfacing to an external library.

I was getting mysterious segfaults so I went over everything with a tweezers,
eventually adding a printf line to the end of the macro so I could verify that
the unpacking of my arguments was proceeding correctly.

To my surprise, the addition of this line, which shouldn't have any
side effects,
has solved the problem.

Adding -O0 to the CCFLAGS makes no difference.

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.

Is this a known problem with 4.0.2?  Is there a workaround?  Should I upgrade?

--
David L Nicol
Can you remember when vending machines took pennies?


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