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 middle-end/58670] New: asm goto miscompilation


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

            Bug ID: 58670
           Summary: asm goto miscompilation
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org

__attribute__((noinline, noclone)) int
foo (int a, int b)
{
  if (a)
    return -3;
  asm volatile goto ("bts $1, %0; jc %l[lab]" : : "m" (b) : "memory" : lab);
  return 0;
lab:
  return 0;
}

int
main ()
{
  if (foo (1, 0) != -3 || foo (0, 3) != 0 || foo (0, 0) != 0)
    __builtin_abort ();
  return 0;
}

is miscompiled, *.optimized dump looks fine, but expansion looks wrong, perhaps
during expansion we don't handle the case of at least one asm goto labels
pointing to the fallthru block.


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