Bug 109765 - [14 regression] ICE in real_to_decimal_for_mode
Summary: [14 regression] ICE in real_to_decimal_for_mode
Status: RESOLVED MOVED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: 14.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2023-05-07 22:25 UTC by Sam James
Modified: 2023-05-09 23:08 UTC (History)
0 users

See Also:
Host:
Target: aarch64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-05-07 22:25:04 UTC
Happens for all sorts of input, noticed initially with Meson's test program:
```
compiler stderr:

Running command: aarch64-unknown-linux-gnu-gcc -E -dM -

../wayland-1.22.0/meson.build:1:0: ERROR: Unable to detect GNU compiler type:
Compiler stdout:

-----
Compiler stderr:
<built-in>: internal compiler error: in real_to_decimal_for_mode, at real.cc:1899
0xe036af real_to_decimal_for_mode(char*, real_value const*, unsigned long, unsigned long, int, machine_mode)
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/real.cc:1899
0x80cdeb builtin_define_with_hex_fp_value
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:1877
0x80e8bf builtin_define_float_constants
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:277
0x810103 c_cpp_builtins(cpp_reader*)
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:1245
0x82f853 c_finish_options
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-opts.cc:1489
0x831fb3 c_common_init()
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-opts.cc:1226
0x708243 lang_dependent_init
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/toplev.cc:1820
0x708243 do_compile
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/toplev.cc:2115
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.

-----
```

```
# echo hi  | aarch64-unknown-linux-gnu-gcc -E -dM -
<built-in>: internal compiler error: in real_to_decimal_for_mode, at real.cc:1899

0xe036af real_to_decimal_for_mode(char*, real_value const*, unsigned long, unsigned long, int, machine_mode)
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/real.cc:1899
0x80cdeb builtin_define_with_hex_fp_value
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:1877
0x80e8bf builtin_define_float_constants
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:277
0x810103 c_cpp_builtins(cpp_reader*)
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-cppbuiltin.cc:1245
0x82f853 c_finish_options
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-opts.cc:1489
0x831fb3 c_common_init()
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-opts.cc:1226
0x708243 lang_dependent_init
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/toplev.cc:1820
0x708243 do_compile
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/toplev.cc:2115
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

```
gcc (Gentoo 14.0.0.9999 p, commit ab60d0a28615153ee13cbf1401bdcdf2382ae0c4) 14.0.0 20230507 (experimental) 681ba2f7681f295a102cd63ffd5ce2b86a5f706e
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Comment 1 Andrew Pinski 2023-05-07 22:42:34 UTC
I just built for aarch64 last night and I can't reproduce this.
ubuntu@ubuntu:~/src/upstream-gcc-aarch64/gcc\# ~/upstream-gcc/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/ubuntu/upstream-gcc/bin/gcc
COLLECT_LTO_WRAPPER=/home/ubuntu/upstream-gcc/libexec/gcc/aarch64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /home/ubuntu/src/upstream-gcc-aarch64/gcc/configure --prefix=/home/ubuntu/upstream-gcc --enable-languages=c,c++,fortran,lto,objc,go,rust
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230507 (experimental) [master f2c31b4c1e2] (GCC)

r14-553-g2c8fa77120b48b4682f423 plus the patch for r14-558-ga1a9ce2441df0675 .
Comment 2 Andrew Pinski 2023-05-07 22:49:15 UTC
The crash is coming from this:
  sprintf (name, "__%s_MIN__", name_prefix);
  sprintf (buf, "0x1p%d", fmt->emin - 1);
  builtin_define_with_hex_fp_value (name, type, decimal_dig, buf, fp_suffix, fp_cast);

The only patch which might have an effect on this is r14-554 I think.
Trying to do a bootstrap right now.
Comment 3 Andrew Pinski 2023-05-07 23:25:13 UTC
Ok, I heard from Sam, that GMP might be miscompiling so building after doing ./contrib/download_prerequisites now.
Comment 4 Sam James 2023-05-08 05:15:36 UTC
Thanks to pinskia for looking at this with me and quickly ruling things out.

I'm pretty sure at this point it's a GMP bug. I've reported it on gmp-bugs with a full summary but it's not on the archive yet. I'll include a link here when it appears.
Comment 5 Andrew Pinski 2023-05-08 05:23:29 UTC
My build/test that included building GMP just finished with no difference from my last build too.
Comment 6 Sam James 2023-05-09 23:08:07 UTC
Report is at https://marc.info/?l=gmp-bugs&m=168367093126416&w=2. I ended up sending it a few times because I've had mail delivery problems before and I didn't realise the list was moderated even for subscribers. Oops.