Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 12: test FAIL: t-get_d #295

Open
marxin opened this issue Jan 26, 2022 · 1 comment
Open

GCC 12: test FAIL: t-get_d #295

marxin opened this issue Jan 26, 2022 · 1 comment

Comments

@marxin
Copy link

marxin commented Jan 26, 2022

The test crashes with:

mpn_get_d wrong, didn't get 0.0 on underflow
  nsize    1
  exp      -999999
  sign     0
  got      =[00 00 00 00 00 00 00 1C] 8.0863492239043898133e-174
Aborted (core dumped)

Started with GCC revision gcc-mirror/gcc@0288527f47cec6 but I think it's bug in MPIR, please run it with fsanitize=undefined:

LD_LIBRARY_PATH=.libs ./tests/mpn/.libs/t-get_d
get_d.c:107:154: runtime error: signed integer overflow: 2147483647 - -100 cannot be represented in type 'long int'
    #0 0xf7f90772 in __gmpn_get_d /home/marxin/Programming/mpir/mpn/get_d.c:107
    #1 0x565576cc in check_onebit /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:101
    #2 0x5655745f in main /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:474
    #3 0xf7c67354 in __libc_start_call_main (/lib/libc.so.6+0x25354)
    #4 0xf7c67425 in __libc_start_main@@GLIBC_2.34 (/lib/libc.so.6+0x25425)
    #5 0x565574c6 in _start (/home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/.libs/t-get_d+0x24c6)

get_d.c:160:31: runtime error: shift exponent 32 is too large for 32-bit type 'long unsigned int'
    #0 0xf7f4358b in __gmpn_get_d /home/marxin/Programming/mpir/mpn/get_d.c:160
    #1 0x565576cc in check_onebit /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:101
    #2 0x5655745f in main /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:474
    #3 0xf7c67354 in __libc_start_call_main (/lib/libc.so.6+0x25354)
    #4 0xf7c67425 in __libc_start_main@@GLIBC_2.34 (/lib/libc.so.6+0x25425)
    #5 0x565574c6 in _start (/home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/.libs/t-get_d+0x24c6)

get_d.c:161:31: runtime error: shift exponent 32 is too large for 32-bit type 'long unsigned int'
    #0 0xf7f4359b in __gmpn_get_d /home/marxin/Programming/mpir/mpn/get_d.c:161
    #1 0x565576cc in check_onebit /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:101
    #2 0x5655745f in main /home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/t-get_d.c:474
    #3 0xf7c67354 in __libc_start_call_main (/lib/libc.so.6+0x25354)
    #4 0xf7c67425 in __libc_start_main@@GLIBC_2.34 (/lib/libc.so.6+0x25425)
    #5 0x565574c6 in _start (/home/abuild/rpmbuild/BUILD/mpir-3.0.0/tests/mpn/.libs/t-get_d+0x24c6)
@marxin
Copy link
Author

marxin commented Jan 26, 2022

I'm attaching self-container test-case
get.c.txt

that works with -O2 -fwrapv. But as mentioned, it contains undefined behavior, namely the 'signed integer overflow'.

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

No branches or pull requests

1 participant