This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is it a bug allowing to copy GIMPLE_ASM with labels?
- From: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sat, 29 Dec 2018 15:22:44 +0800
- Subject: 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