[Bug middle-end/54068] Compiler passes wrong argument to function when using optimize attribute with -O3

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 23 08:26:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54068

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-07-23
                 CC|                            |hubicka at gcc dot gnu.org
     Ever Confirmed|0                           |1
      Known to fail|                            |4.4.7, 4.5.4, 4.6.3, 4.7.1,
                   |                            |4.8.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-23 08:25:58 UTC ---
Confirmed.  Note that I would not expect

void myfn (int a, int b) __attribute__((optimize("-O3")));

to work reliably.  Attribute optimize is supposed to be used for debugging
only.  C testcase, compile with -O0 -m32:

extern void abort (void);
void myfn (int a, int b) __attribute__((optimize("-O3")));
static inline void showme (int b)
{
   if (b != 12)
     abort ();
}
void myfn (int a, int b)
{
   showme (b);
}
int main ()
{
   myfn (5, 12);
   return 0;
}

I suppose this is the known issue with tail-call optimization which
may get upset if you have parts compiled with -O0 and parts with -O3.



More information about the Gcc-bugs mailing list