public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
@ 2023-12-05 18:30 slyfox at gcc dot gnu.org
2023-12-05 18:31 ` [Bug c++/112869] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-12-05 18:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
Bug ID: 112869
Summary: [14 regression] ICE at gimplify_expr, at
gimplify.cc:17531 on libopenmpt-0.7.3
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Initially observed ICE on gcc-master at r14-6191-g9c3a880feecf81 compiling
libopenmpt-0.7.3.
Extracted example:
$ cat a.cpp.cpp
void min(long, long);
template <class T> void Binaryread(int &, T, unsigned long);
template <> void Binaryread(int &, float, unsigned long bytecount) {
min(bytecount, sizeof(int));
}
Crashing:
$ g++ -std=c++20 -c a.cpp.cpp -o a.o
a.cpp.cpp: In function 'void Binaryread(int&, T, long unsigned int) [with T =
float]':
a.cpp.cpp:4:18: internal compiler error: in gimplify_expr, at gimplify.cc:17531
4 | min(bytecount, sizeof(int));
| ^~~~~~~~~~~
0x1fe24d4 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
???:0
0x1fe2cb9 internal_error(char const*, ...)
???:0
0x76d566 fancy_abort(char const*, int, char const*)
???:0
0x7387b4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int) [clone .cold]
???:0
0xc30cb6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xc35c39 gimplify_arg(tree_node**, gimple**, unsigned int, bool)
???:0
0xc35e9d gimplify_call_expr(tree_node**, gimple**, bool)
???:0
0xc3158e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xc34b33 gimplify_cleanup_point_expr(tree_node**, gimple**)
???:0
0xc315e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xc3428e gimplify_body(tree_node*, bool)
???:0
0xc34650 gimplify_function_tree(tree_node*)
???:0
0xa9bf07 cgraph_node::analyze()
???:0
0xa9e607 analyze_functions(bool)
???:0
0xa9f27d symbol_table::finalize_compilation_unit()
???:0
$ LANG=C gcc/xg++ -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xg++
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer
--disable-libstdcxx-pch --enable-languages=c,c++ --disable-libgomp
--disable-libquadmath --disable-libvtv CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0'
LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231205 (experimental) (GCC)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
@ 2023-12-05 18:31 ` pinskia at gcc dot gnu.org
2023-12-05 18:34 ` [Bug c++/112869] [14 Regression] " mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-05 18:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Keywords| |ice-on-valid-code
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
2023-12-05 18:31 ` [Bug c++/112869] " pinskia at gcc dot gnu.org
@ 2023-12-05 18:34 ` mpolacek at gcc dot gnu.org
2023-12-05 19:01 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-12-05 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Priority|P3 |P1
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Summary|[14 regression] ICE at |[14 Regression] ICE at
|gimplify_expr, at |gimplify_expr, at
|gimplify.cc:17531 on |gimplify.cc:17531 on
|libopenmpt-0.7.3 |libopenmpt-0.7.3
Last reconfirmed| |2023-12-05
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
commit 1f1c432226cf3db399b2a2a627e3c5720b02b1d6
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Sep 19 16:31:17 2023 -0400
c++: implement P2564, consteval needs to propagate up [PR107687]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
2023-12-05 18:31 ` [Bug c++/112869] " pinskia at gcc dot gnu.org
2023-12-05 18:34 ` [Bug c++/112869] [14 Regression] " mpolacek at gcc dot gnu.org
@ 2023-12-05 19:01 ` mpolacek at gcc dot gnu.org
2023-12-06 20:50 ` slyfox at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-12-05 19:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This should fix it:
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -1177,13 +1177,9 @@ cp_fold_immediate_r (tree *stmt_p, int *walk_subtrees,
void *data_)
? tf_error : tf_none);
const tree_code code = TREE_CODE (stmt);
- /* No need to look into types or unevaluated operands.
- NB: This affects cp_fold_r as well. */
+ /* No need to look into types or unevaluated operands. */
if (TYPE_P (stmt) || unevaluated_p (code) || in_immediate_context ())
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
+ return NULL_TREE;
tree decl = NULL_TREE;
bool call_p = false;
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2023-12-05 19:01 ` mpolacek at gcc dot gnu.org
@ 2023-12-06 20:50 ` slyfox at gcc dot gnu.org
2023-12-07 18:34 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-12-06 20:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
I confirm the proposed change fixes build of libopenmpt-0.7.3 as well. Thank
you!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2023-12-06 20:50 ` slyfox at gcc dot gnu.org
@ 2023-12-07 18:34 ` pinskia at gcc dot gnu.org
2023-12-08 17:16 ` dcb314 at hotmail dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-07 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sjames at gcc dot gnu.org
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 112907 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
` (4 preceding siblings ...)
2023-12-07 18:34 ` pinskia at gcc dot gnu.org
@ 2023-12-08 17:16 ` dcb314 at hotmail dot com
2023-12-14 21:06 ` cvs-commit at gcc dot gnu.org
2023-12-14 21:06 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2023-12-08 17:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcb314 at hotmail dot com
--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
I see this one also, in a build of tlx-0.6.1 package.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
` (5 preceding siblings ...)
2023-12-08 17:16 ` dcb314 at hotmail dot com
@ 2023-12-14 21:06 ` cvs-commit at gcc dot gnu.org
2023-12-14 21:06 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-14 21:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:8cccdc2176740f3e034ee6caa49552cf2f142744
commit r14-6561-g8cccdc2176740f3e034ee6caa49552cf2f142744
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Dec 5 15:23:52 2023 -0500
c++: fix ICE with sizeof in a template [PR112869]
This test shows that we cannot clear *walk_subtrees in
cp_fold_immediate_r when we're in_immediate_context, because that
checks even e.g. sk_template_parms, and, as the comment says, affects
cp_fold_r as well. Here we had an expression with
min ((long int) VIEW_CONVERT_EXPR<long unsigned int>(bytecount), (long
int) <<< Unknown tree: sizeof_expr
(int) <<< error >>> >>>)
as its sub-expression, and we never evaluated that into
min ((long int) bytecount, 4)
so the SIZEOF_EXPR leaked into the middle end. We need to make sure
we are calling cp_fold on the SIZEOF_EXPR.
PR c++/112869
gcc/cp/ChangeLog:
* cp-gimplify.cc (cp_fold_immediate_r): Check
cp_unevaluated_operand
and DECL_IMMEDIATE_FUNCTION_P rather than in_immediate_context.
gcc/testsuite/ChangeLog:
* g++.dg/template/sizeof18.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/112869] [14 Regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
` (6 preceding siblings ...)
2023-12-14 21:06 ` cvs-commit at gcc dot gnu.org
@ 2023-12-14 21:06 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-12-14 21:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112869
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-12-14 21:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 18:30 [Bug c++/112869] New: [14 regression] ICE at gimplify_expr, at gimplify.cc:17531 on libopenmpt-0.7.3 slyfox at gcc dot gnu.org
2023-12-05 18:31 ` [Bug c++/112869] " pinskia at gcc dot gnu.org
2023-12-05 18:34 ` [Bug c++/112869] [14 Regression] " mpolacek at gcc dot gnu.org
2023-12-05 19:01 ` mpolacek at gcc dot gnu.org
2023-12-06 20:50 ` slyfox at gcc dot gnu.org
2023-12-07 18:34 ` pinskia at gcc dot gnu.org
2023-12-08 17:16 ` dcb314 at hotmail dot com
2023-12-14 21:06 ` cvs-commit at gcc dot gnu.org
2023-12-14 21:06 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).