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

            Bug ID: 93119
           Summary: [ICE] The traditional TLS support of aarch64-ilp32
                    target may be not perfect while enable fPIC
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pengliren at huawei dot com
  Target Milestone: ---

My code: 
#cat 1.c
__thread int g_tlsdata;

int func1()
{
  g_tlsdata++;
  return g_tlsdata;
}

gcc version:
gcc version 10.0.0 20191228 (experimental)

#./gcc 1.c -c -mabi=ilp32  -fPIC -mtls-dialect=trad
1.c: In function ‘func1’:
1.c:8:1: error: unrecognizable insn:
    8 | }
      | ^
(call_insn/u 5 2 6 2 (parallel [
            (set (reg:DI 0 x0)
                (call (mem:DI (symbol_ref:DI ("__tls_get_addr") [flags 0x41]
<function_decl 0xffff9b969d00 __tls_get_addr>) [0  S8 A8])
                    (const_int 1 [0x1])))
            (unspec:DI [
                    (const_int 0 [0])
                ] UNSPEC_CALLEE_ABI)
            (unspec:DI [
                    (symbol_ref:DI ("g_tlsdata") [flags 0x10] <var_decl
0xffffa90442d0 g_tlsdata>)
                ] UNSPEC_GOTSMALLTLS)
            (clobber (reg:DI 30 x30))
        ]) "1.c":6:12 -1
     (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000])
        (nil))
    (expr_list (clobber (reg:DI 17 x17))
        (expr_list (clobber (reg:DI 16 x16))
            (nil))))
during RTL pass: vregs
1.c:8:1: internal compiler error: in extract_insn, at recog.c:2294
0x5e788f _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-616fb84/gcc/rtl-error.c:108
0x5e78c3 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-616fb84/gcc/rtl-error.c:116
0xa56e6f extract_insn(rtx_insn*)
        ../../gcc-616fb84/gcc/recog.c:2294
0x845f63 instantiate_virtual_regs_in_insn
        ../../gcc-616fb84/gcc/function.c:1656
0x845f63 instantiate_virtual_regs
        ../../gcc-616fb84/gcc/function.c:1977
0x845f63 execute
        ../../gcc-616fb84/gcc/function.c:2026
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

I have read the  Bug 78382 - ICE when compiling on aarch64 in ILP32 mode with
traditional thread local storage and pic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78382, it was fixed, but ICE
trigger while using  gcc 10.0.0  to compile my code.

Reply via email to