[Bug middle-end/51323] g++ confuses this with function argument in optimized call

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 28 18:23:00 GMT 2011


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-11-28
                 CC|                            |jakub at gcc dot gnu.org
          Component|c++                         |middle-end
     Ever Confirmed|0                           |1

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-28 17:54:05 UTC ---
Can't reproduce this with 4.6, but can with the trunk.

/* PR middle-end/51323 */

extern void abort (void);
struct S { int a, b, c; };
int v;

__attribute__((noinline, noclone)) void
foo (int x, int y, int z)
{
  if (x != v || y != 0 || z != 9)
    abort ();
}

static inline int
baz (const struct S *p)
{
  return p->b;
}

__attribute__((noinline, noclone)) void
bar (int x, struct S y)
{
  foo (baz (&y), 0, x);
}

int
main ()
{
  struct S s;
  v = 3; s.a = v - 1; s.b = v; s.c = v + 1;
  bar (9, s);
  v = 17; s.a = v - 1; s.b = v; s.c = v + 1;
  bar (9, s);
  return 0;
}

at -O2 -m32 fails.  My http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02413.html
seems to fix this.



More information about the Gcc-bugs mailing list