Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

gcc version 12.0.1 generated incorrect code for glibc lib codes with option " -fno-math-errno" #378

Open
chihinko opened this issue Jun 29, 2023 · 1 comment

Comments

@chihinko
Copy link

test case:
./glibc/sysdeps/ieee754/dbl-64/e_sqrt.c
reduced e_sqrt.c to tmp.c:
double
__ieee754_sqrt (double x)
{
return __builtin_sqrt (x);
}
compile option:
vgcc12 -O2 -fno-math-errno tmp.c -S
__ieee754_sqrt:
tail sqrt

Cause infinite looping at run time.

If no option -fno-math-errno specified, then the .s file is good
vgcc12 -O2 tmp.c -S
__ieee754_sqrt:
fmv.d.x fa4,zero
frflags a4
flt.d a5,fa0,fa4
fsflags a4
bne a5,zero,.L10
fsqrt.d fa0,fa0
ret

============================================================================
vgcc12 -v
Using built-in specs.
COLLECT_GCC=/home/chihinko/gnu/riscv_rvv_12/bin/riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/home/chihinko/gnu/riscv_rvv_12/libexec/gcc/riscv64-unknown-elf/12.0.1/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /home1/chihinko/riscv-gnu-toolchain-rvv-scm-12/build/../riscv-gcc/configure --target=riscv64-unknown-elf --prefix=/home/chihinko/gnu/riscv_rvv_12 --disable-shared --disable-threads --enable-languages=c,c++ --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/chihinko/gnu/riscv_rvv_12/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=../../riscv-gcc --disable-multilib --with-abi=lp64d --with-arch=rv64imafdcv --with-tune=rocket 'CFLAGS_FOR_TARGET=-Os -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medlow'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220505 (prerelease) (GCC)

@kito-cheng
Copy link
Collaborator

Could you file bug on https://gcc.gnu.org/bugzilla/ ? there would be more people family with that :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants