Bug 2481846 - internal compiler error: Segmentation fault when compiling __builtin_powf
Summary: internal compiler error: Segmentation fault when compiling __builtin_powf
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-05-27 09:36 UTC by Richard W.M. Jones
Modified: 2026-05-29 09:21 UTC (History)
25 users (show)

Fixed In Version: glibc-2.43.9000-18.fc45
Clone Of:
Environment:
Last Closed: 2026-05-29 09:21:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2026-05-27 09:36:24 UTC
Description of problem:

On all architectures, in current Rawhide, compiling some code that uses std::pow / __builtin_powf causes a segmentation fault in GCC:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I../include -DUBLKSRV_INTERNAL_H_ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fcoroutines -c ublksrv_json.cpp  -fPIC -DPIC -o .libs/libublksrv_la-ublksrv_json.o
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | annobin: Generate final annotations
PLUGIN_START_UNIT                | annobin: Generate global annotations
PLUGIN_ALL_PASSES_START          | annobin: Generate per-function annotations
PLUGIN_ALL_PASSES_END            | annobin: Register per-function end symbols
In file included from /usr/include/c++/16/valarray:41,
                 from ../include/nlohmann/json.hpp:82,
                 from ublksrv_json.cpp:6:
/usr/include/c++/16/cmath: In instantiation of '_Tp std::__detail::__ellint_rf(_Tp, _Tp, _Tp) [with _Tp = float]':
/usr/include/c++/16/tr1/ell_integral.tcc:201:27:   required from '_Tp std::__detail::__comp_ellint_1(_Tp) [with _Tp = float]'
  201 |         return __ellint_rf(_Tp(0), _Tp(1) - __k * __k, _Tp(1));
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/16/bits/specfun.h:358:44:   required from here
  358 |   { return __detail::__comp_ellint_1<float>(__k); }
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/16/tr1/ell_integral.tcc:102:40:   in 'constexpr' expansion of 'std::pow(1.1920929e-7f, 1.66666672e-1f)'
  102 |           const _Tp __errtol = std::pow(__eps, _Tp(1) / _Tp(6));
      |                                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/16/cmath:384:26: internal compiler error: Segmentation fault
  384 |   { return __builtin_powf(__x, __y); }
      |            ~~~~~~~~~~~~~~^~~~~~~~~~
/usr/libexec/gcc/x86_64-redhat-linux/16/cc1plus -quiet -I . -I .. -I ../include -D_GNU_SOURCE -D HAVE_CONFIG_H -D UBLKSRV_INTERNAL_H_ -D PIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS ublksrv_json.cpp -quiet -dumpdir .libs/ -dumpbase libublksrv_la-ublksrv_json.cpp -dumpbase-ext .cpp -m64 -march=x86-64 -mtune=generic -mtls-dialect=gnu2 -mno-omit-leaf-frame-pointer -g -grecord-gcc-switches -O2 -Wall -Werror=format-security -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -fno-omit-frame-pointer -fcoroutines -fPIC -iplugindir=/usr/lib/gcc/x86_64-redhat-linux/16/plugin -fplugin=annobin -o -
Please submit a full bug report, with preprocessed source.
See <https://bugzilla.redhat.com/> for instructions.
Preprocessed source stored into /tmp/cckdfvAW.out file, please attach this to your bugreport.

I was able to reproduce this locally.

Version-Release number of selected component (if applicable):

gcc 16.1.1-2.fc45
binutils 2.46.50-9.fc45
annobin-plugin-gcc 13.17-1.fc45
redhat-rpm-config 344-2.fc45.noarch
glibc 2.43.9000-17.fc45

How reproducible:

100%

Steps to Reproduce:
1. Try building https://src.fedoraproject.org/rpms/ubdsrv in Koji

Actual results:

See the build log here:
https://koji.fedoraproject.org/koji/taskinfo?taskID=145947191

Comment 1 Jakub Jelinek 2026-05-27 09:41:38 UTC
Testcase something as simple as
echo 'double a = __builtin_log (60e6);' | gcc -xc - -S -o -
This crashes within mpfr library and is caused by 
 glibc-2.43.9000-17.fc45 (glibc-2.43.9000-16.fc45 is fine).
Looking at the diff, it is either the elf/dynamic linking changes, or the libio changes.

Comment 2 Richard W.M. Jones 2026-05-27 09:45:04 UTC
Yes, can confirm the test case:

$ echo 'double a = __builtin_log (60e6);' | gcc -xc - -S -o -
	.file	"<stdin>"
<stdin>:1:1: internal compiler error: Segmentation fault
/usr/libexec/gcc/x86_64-redhat-linux/16/cc1 -quiet - -quiet -dumpbase - -mtune=generic -march=x86-64 -mtls-dialect=gnu2 -o -
Please submit a full bug report, with preprocessed source.
See <https://bugzilla.redhat.com/> for instructions.

Comment 3 Richard W.M. Jones 2026-05-27 09:47:53 UTC
Also I can confirm that going back to glibc -16 fixes the problem, it only happens with -17.

Comment 4 Florian Weimer 2026-05-27 09:57:19 UTC
Upstream discussion with a patch:

[PATCH] elf: Re-initialise static TLS after .tdata relocation (BZ 34164)
<https://inbox.sourceware.org/libc-alpha/20260526185235.4093779-1-adhemerval.zanella@linaro.org>

Comment 5 Jakub Jelinek 2026-05-27 10:08:35 UTC
Reduced testcase without gcc:
#include <mpfr.h>

void
foo (int (*func)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t))
{
  mpfr_set_emin (-32990);
  mpfr_set_emax (32770);
  mpfr_t m1;
  mpfr_init2 (m1, 192);
  mpfr_strtofr (m1, "60e6", NULL, 10, MPFR_RNDZ);
  mpfr_exp_t exp;
  char *rstr = mpfr_get_str (NULL, &exp, 16, 0, m1, MPFR_RNDZ); 
  mpfr_free_str (rstr);
  mpfr_clear (m1);
  mpfr_t m2;
  mpfr_init2 (m2, 53);
  mpfr_set_str (m2, "0x0.e4e1cp+26", 16, MPFR_RNDN);
  mpfr_clear_flags ();
  func (m2, m2, MPFR_RNDN);
}

int
main ()
{
  foo (mpfr_log);
}

gcc -o test{,.c} -lmpfr
./test

Comment 6 Richard W.M. Jones 2026-05-27 12:20:07 UTC
Could we untag the glibc -17 package to allow builds to continue?

Comment 7 Richard W.M. Jones 2026-05-27 12:21:09 UTC
(In reply to Richard W.M. Jones from comment #6)
> Could we untag the glibc -17 package to allow builds to continue?

Oh I see that has already been done, thanks!

Comment 8 Frédéric Bérat 2026-05-28 06:07:45 UTC
This issue should be fixed by upstream commit eceaece54bf178eb2d9115cfcbd6249239b7556c (elf: Re-initialise static TLS after .tdata relocation (BZ 34164)) which got merged a few hours ago, I'll re-sync rawhide today.


Note You need to log in before you can comment on or make changes to this bug.