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

            Bug ID: 90193
           Summary: asm goto with TLS "m" input operand generates
                    incorrect assembler in O1 and O2
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mathieu.desnoyers at efficios dot com
  Target Milestone: ---

This issue can be reproduced with:

gcc version 8.3.0 (GCC)
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/efficios/local

Command line reproducing the bug:

/home/efficios/local/bin/gcc -O1 -o test-asm-goto test-asm-goto.c
(same with -O2)

Compiler output:

/tmp/ccsWO2Fm.o: In function `main':
test-asm-goto.c:(.text+0x1): undefined reference to `.L2'
collect2: error: ld returned 1 exit status

Preprocessed file reproducing the bug:

# 1 "test-asm-goto.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "test-asm-goto.c"
__thread int var;

static int fct(void)
{
 asm goto ( "jmp %l[testlabel]\n\t"
   : : [var] "m" (var) : : testlabel);
 return 0;
testlabel:
 return 1;
}

int main()
{
 return fct();
}

It works fine with gcc 7.3.0 with and without optimizations, and it works fine
with gcc 8.3.0 without optimizations. It also affects compilation with -m32
(32-bit x86).

Reply via email to