This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
optimizing away parts of macros?
- From: "David Nicol" <david at mindtrustllc dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 17 Apr 2006 16:42:18 -0500
- Subject: 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?