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

Is it a bug allowing to copy GIMPLE_ASM with labels?


Hi,
Give below test:

volatile int a, b, c;
__attribute__((noinline)) int foo ()
{
  int i;
  for (i = 0; i < 1000; i++)
    {
      if (i % 17)
        a++;
      else
        b++;
      asm volatile(
          "foo_label:\n"
          "pushq %%rbx\n"
          "popq %%rbx\n" :"=m"(c) :"r"(i)
      );
      c++;
    }
  return 0;
}
compiled with:
gcc -O2 -fno-crossjumping -ftracer tracer-1.c -o tracer-1.o -c
will end up with following assembler error message:
tracer-1.c: Assembler messages:
tracer-1.c:16: Error: symbol `foo_label' is already defined

Root cause is in tracer.c which duplicates basic block without
checking if any GIMPLE_ASM defines labels.
Is this a bug or invalid code?

Thanks,
bin


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