This is the mail archive of the gcc-bugs@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]

[Bug ipa/63838] New: [4.8/4.9/5 Regression] ipa-pure-const miscomputes can_throw


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63838

            Bug ID: 63838
           Summary: [4.8/4.9/5 Regression] ipa-pure-const miscomputes
                    can_throw
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: jakub at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org

__attribute__((noinline, noclone)) static void bar (int);
volatile int v;
void (*fn) ();
struct S { S () { v++; } ~S () { v++; } };

__attribute__((noinline, noclone)) static void
foo (int x)
{
  v++;
  if (x == 5)
    bar (x);
}

__attribute__((noinline, noclone)) static void
bar (int x)
{
  v++;
  if (x == 6)
    foo (x);
  else if (x == 5)
    fn ();
}

__attribute__((noinline, noclone)) int
baz (int x)
{
  S s;
  foo (x);
}

void
throw0 ()
{
  throw 0;
}

int
main ()
{
  fn = throw0;
  asm volatile ("" : : : "memory");
  try
    {
      baz (5);
    }
  catch (int)
    {
    }
}

is miscompiled with -O2 with g++ 4.6 and above (4.4 works, haven't tried 4.5),
r160312 works, r160406 already doesn't, -O2 -fno-ipa-pure-const works.


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