https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128966
--- Comment #1 from Frank Scheiner <frank.scheiner at web dot de> --- ## Reproducer ### Attachments - `powl.i` - preprocessed source (self-contained; no musl tree needed) - `m.c` - driver - `p.c.322r.postreload`, `p.c.323r.late_combine2` - GCC 15.2.0 RTL dumps - `p.i.325r.postreload`, `p.i.326r.late_combine2` - GCC 17.0.0 trunk RTL dumps - `p.o` - cross-compiled object file for reference - `p.s` - cross-compiled annotated assembly for reference ### Generating `powl.i` ```bash git clone https://github.com/johnny-mnemonic/epic-musl.git musl && cd musl ./configure --prefix=/opt/musl-ia64 make -j8 # generates obj/include INC="-I./arch/ia64 -I./arch/generic -Iobj/src/internal -I./src/include \ -I./src/internal -Iobj/include -I./include" gcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard \ -frounding-math -fno-strict-aliasing -D_XOPEN_SOURCE=700 $INC \ -Dpowl=my_powl -E src/math/powl.c -o powl.i ``` ### Compiling - minimal flag set, reproduces on a bare cross-compiler ```bash ia64-linux-gcc -x cpp-output -O2 -std=c99 -ffreestanding \ -fexcess-precision=standard -frounding-math -fno-strict-aliasing \ -fdump-rtl-all -c powl.i -o p.o ``` No musl tuning flags are required. ### Checking ```bash grep -n -B4 -A4 'mem/c:RF\|mem/c:XF' p.i.*postreload p.i.*late_combine* ``` At `powl.c:251:14`, an RF load feeding a plain `movxf_internal` copy in `postreload` becomes a single `mem/c:XF` load in `late_combine2`. Assembly cross-check - match slots by the `adds rN=<off>,r12` offset, **not** by register name: ```bash ia64-linux-objdump -d --no-show-raw-insn p.o | grep -n -A6 'adds r14=64,r12' ``` Control: adding `-fno-late-combine-instructions` preserves the RF load + copy. ### `m.c` (runtime check, needs musl) ```c #include <stdio.h> long double my_powl(long double, long double); int main(void) { volatile long double x = -1.0L, y = 2.0L, nx = -0.0L; printf("powl(-1,2) = %La (expected 0x1p+0)\n", my_powl(x, y)); printf("powl(-0,2) = %La (expected 0x0p+0)\n", my_powl(nx, y)); return 0; } ``` ```bash # __p1evll lives inside __polevll.c; compile it with the same flags /opt/musl-ia64/bin/musl-gcc -o t p.o pl.o m.c && ./t ``` `volatile` is required on the arguments - with literals GCC constant-folds the call and the bug is masked.
