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

            Bug ID: 121635
           Summary: [16 Regression] ICE on nodejs-22.18.0: ICE in
                    ix86_emit_tls_call, at
                    config/i386/i386-features.cc:3805
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Noticed an ICE on gcc-master today (from r16-3341-g73a2a9d6c2eab3). DId not
bisect, but strongly suspect recent TLS optimizations. cvise produces this:

// $ cat abseil.cordz_functions.cc.cc
int get_cordz_mean_interval();
thread_local long cordz_next_sample, kIntervalIfDisabled;
bool cordz_should_profile_slow();
inline bool cordz_should_profile() { return cordz_should_profile_slow(); }
bool cordz_should_profile_slow() {
  int mean_interval = get_cordz_mean_interval();
  if (mean_interval)
    cordz_next_sample = kIntervalIfDisabled;
  return cordz_next_sample || cordz_should_profile();
}

gcc/xg++ -Bgcc -c abseil.cordz_functions.cc.cc -o bug.o -std=c++20 -O2 -fPIC
-Wall
during RTL pass: x86_cse
abseil.cordz_functions.cc.cc: In function ‘bool cordz_should_profile_slow()’:
abseil.cordz_functions.cc.cc:10:1: internal compiler error: in
ix86_emit_tls_call, at config/i386/i386-features.cc:3805
   10 | }
      | ^
0x2926b70 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x291b8bc internal_error(char const*, ...)
        ???:0
0x2924030 fancy_abort(char const*, int, char const*)
        ???:0
0x1999b8e ix86_place_single_tls_call(rtx_def*, rtx_def*, x86_cse_kind,
auto_bitmap&, auto_bitmap&, auto_bitmap&, rtx_def*)
        ???:0
0x19a0a32 (anonymous namespace)::pass_x86_cse::execute(function*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ gcc/xg++ -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xg++
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer
--disable-libstdcxx-pch --enable-languages=c,c++ --disable-libgomp
--disable-libquadmath --disable-libvtv CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0'
LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250822 (experimental) (GCC)

Reply via email to