Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 941543 - sys-devel/gcc-15.0.0_pre20241006 makes ICE from invalid program
Summary: sys-devel/gcc-15.0.0_pre20241006 makes ICE from invalid program
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-14 19:27 UTC by Christian Schmidt
Modified: 2024-10-14 19:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schmidt 2024-10-14 19:27:14 UTC
Compiling an invalid constexpr with gcc-15 cause an ICE message to be shown together with the correct message:

Invalid code:

constexpr int myconst = 2 * 2.5;

compiled with:

gcc-15 -O2 -pipe -Wall --std=gnu23 -o test test.c
test.c:1:25: error: ‘constexpr’ integer initializer is not an integer constant expression
    1 | constexpr int myconst = 2 * 2.5;
      |                         ^
test.c:1:1: internal compiler error: tree check: expected integer_cst, have real_cst in get_len, at tree.h:6509
    1 | constexpr int myconst = 2 * 2.5;
      | ^~~~~~~~~
0x5619670dad94 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t)
	???:0
0x5619670db75d internal_error(char const*, ...)
	???:0
0x5619652f27e2 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
	???:0
0x561965f52d96 int_fits_type_p(tree_node const*, tree_node const*)
	???:0
0x56196543da3f store_init_value(unsigned int, tree_node*, tree_node*, tree_node*)
	???:0
0x56196540c7fb finish_decl(tree_node*, unsigned int, tree_node*, tree_node*, tree_node*)
	???:0
0x561965498be7 c_parse_file()
	???:0
0x56196550f9b0 c_common_parse_file()
	???:0

gcc-14 (14.2.1_p20240921 p1) also is a bit weird about the same:
gcc -O2 -pipe -Wall --std=gnu23 -o test test.c
test.c:1:25: error: ‘constexpr’ integer initializer is not an integer constant expression
    1 | constexpr int myconst = 2 * 2.5;
      |                         ^
test.c:1: confused by earlier errors, bailing out

The first message is actually correct - the line is not valid, and was used during playing with the limits of constexpr.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-10-14 19:33:42 UTC
Thanks, reported the ICE upstream at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117139.

Note that it happens with 14 and 13 with c2x, it's just that it's a checking ICE.