public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault
@ 2024-05-27 4:37 markus at oberhumer dot com
2024-05-27 4:40 ` [Bug c++/115239] " pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: markus at oberhumer dot com @ 2024-05-27 4:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Bug ID: 115239
Summary: ICE: internal compiler error: Segmentation fault
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: markus at oberhumer dot com
Target Milestone: ---
Link at Compiler Explorer:
https://godbolt.org/z/b1oW566E5
I stumbled on this while compiling some invalid code during refactoring.
Test case has been reduced by cvise.
Discovered using gcc-14.1.1-4.fc40.x86_64. Might be a regression - gcc-13 does
not crash.
Acutal code: ```
constexpr bool foo(const char *, char *, long) { return true; }
constexpr bool foo(const char *, char *, unsigned) { return true; }
constexpr bool foo(char, char, long) { return true; }
constexpr bool foo(char, char, unsigned) { return true; }
static_assert(foo((char *)nullptr, nullptr, 0));
```
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] ICE: internal compiler error: Segmentation fault
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
@ 2024-05-27 4:40 ` pinskia at gcc dot gnu.org
2024-05-27 4:42 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call from static_assert in some cases pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-27 4:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-05-27
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
[apinski@xeond2 gcc]$ ./cc1plus t.cc
constexpr bool foo(const char*, char*, long int) constexpr bool foo(const
char*, char*, unsigned int) constexpr bool foo(char, char, long int) constexpr
bool foo(char, char, unsigned int)
t.cc: At global scope:
t.cc:7:18: internal compiler error: Segmentation fault
7 | static_assert(foo((char *)nullptr, nullptr, 0));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x134bdbf crash_signal
/home/apinski/src/upstream-gcc-match/gcc/gcc/toplev.cc:319
0xa49a4e compare_ics
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/call.cc:12124
0xa5736a joust
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/call.cc:12958
0xa58ee8 tourney
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/call.cc:13476
0xa59068 perform_overload_resolution
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/call.cc:5006
0xa5db12 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/call.cc:5098
0xcadf7d finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/semantics.cc:3136
0xc0c2bb cp_parser_postfix_expression
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:8191
0xbe74f0 cp_parser_binary_expression
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:10411
0xbe82b4 cp_parser_assignment_expression
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:10755
0xbe93fd cp_parser_constant_expression
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:11045
0xbeb84b cp_parser_static_assert
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:17096
0xc32672 cp_parser_declaration
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:15706
0xc336fa cp_parser_toplevel_declaration
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:15727
0xc336fa cp_parser_translation_unit
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:5297
0xc336fa c_parse_file()
/home/apinski/src/upstream-gcc-match/gcc/gcc/cp/parser.cc:51518
0xd81961 c_common_parse_file()
/home/apinski/src/upstream-gcc-match/gcc/gcc/c-family/c-opts.cc:1311
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call from static_assert in some cases
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
2024-05-27 4:40 ` [Bug c++/115239] " pinskia at gcc dot gnu.org
@ 2024-05-27 4:42 ` pinskia at gcc dot gnu.org
2024-05-27 4:43 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-27 4:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE: internal compiler |[14/15 Regression] ICE:
|error: Segmentation fault |Segmentation fault with
| |ambiguous function call
| |from static_assert in some
| |cases
Target Milestone|--- |14.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call from static_assert in some cases
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
2024-05-27 4:40 ` [Bug c++/115239] " pinskia at gcc dot gnu.org
2024-05-27 4:42 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call from static_assert in some cases pinskia at gcc dot gnu.org
@ 2024-05-27 4:43 ` pinskia at gcc dot gnu.org
2024-05-27 4:45 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call " pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-27 4:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58294
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58294&action=edit
Reduced further
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (2 preceding siblings ...)
2024-05-27 4:43 ` pinskia at gcc dot gnu.org
@ 2024-05-27 4:45 ` pinskia at gcc dot gnu.org
2024-05-27 7:22 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-27 4:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #58294|0 |1
is obsolete| |
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58295
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58295&action=edit
Reduced further, removed one argument
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`)
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (3 preceding siblings ...)
2024-05-27 4:45 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call " pinskia at gcc dot gnu.org
@ 2024-05-27 7:22 ` rguenth at gcc dot gnu.org
2024-05-27 8:52 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522 jakub at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-27 7:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (4 preceding siblings ...)
2024-05-27 7:22 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) rguenth at gcc dot gnu.org
@ 2024-05-27 8:52 ` jakub at gcc dot gnu.org
2024-06-13 14:02 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-27 8:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jakub at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Summary|[14/15 Regression] ICE: |[14/15 Regression] ICE:
|Segmentation fault with |Segmentation fault with
|ambiguous function call in |ambiguous function call in
|some cases (`const char*` |some cases (`const char*`
|vs `char` with `long` vs |vs `char` with `long` vs
|`unsigned`) |`unsigned`) since r14-6522
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r14-6522-gb24c09bfb626271cda345f5a6f0d3a6b6480593d
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (5 preceding siblings ...)
2024-05-27 8:52 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522 jakub at gcc dot gnu.org
@ 2024-06-13 14:02 ` cvs-commit at gcc dot gnu.org
2024-06-14 14:50 ` [Bug c++/115239] [14 " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-13 14:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:7fed7e9bbc57d502e141e079a6be2706bdbd4560
commit r15-1292-g7fed7e9bbc57d502e141e079a6be2706bdbd4560
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Jun 13 10:02:43 2024 -0400
c++: ICE w/ ambig and non-strictly-viable cands [PR115239]
Here during overload resolution we have two strictly viable ambiguous
candidates #1 and #2, and two non-strictly viable candidates #3 and #4
which we hold on to ever since r14-6522. These latter candidates have
an empty second arg conversion since the first arg conversion was deemed
bad, and this trips up joust when called on #3 and #4 which assumes all
arg conversions are there.
We can fix this by making joust robust to empty arg conversions, but in
this situation we shouldn't need to compare #3 and #4 at all given that
we have a strictly viable candidate. To that end, this patch makes
tourney shortcut considering non-strictly viable candidates upon
encountering ambiguity between two strictly viable candidates (taking
advantage of the fact that the candidates list is sorted according to
viability via splice_viable).
PR c++/115239
gcc/cp/ChangeLog:
* call.cc (tourney): Don't consider a non-strictly viable
candidate as the champ if there was ambiguity between two
strictly viable candidates.
gcc/testsuite/ChangeLog:
* g++.dg/overload/error7.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (6 preceding siblings ...)
2024-06-13 14:02 ` cvs-commit at gcc dot gnu.org
@ 2024-06-14 14:50 ` ppalka at gcc dot gnu.org
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-14 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Summary|[14/15 Regression] ICE: |[14 Regression] ICE:
|Segmentation fault with |Segmentation fault with
|ambiguous function call in |ambiguous function call in
|some cases (`const char*` |some cases (`const char*`
|vs `char` with `long` vs |vs `char` with `long` vs
|`unsigned`) since r14-6522 |`unsigned`) since r14-6522
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (7 preceding siblings ...)
2024-06-14 14:50 ` [Bug c++/115239] [14 " ppalka at gcc dot gnu.org
@ 2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-17 14:27 ` ppalka at gcc dot gnu.org
2024-06-24 21:51 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-17 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:4df86402990e2f45e02a367f1734a22ebc041e98
commit r14-10319-g4df86402990e2f45e02a367f1734a22ebc041e98
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Jun 13 10:02:43 2024 -0400
c++: ICE w/ ambig and non-strictly-viable cands [PR115239]
Here during overload resolution we have two strictly viable ambiguous
candidates #1 and #2, and two non-strictly viable candidates #3 and #4
which we hold on to ever since r14-6522. These latter candidates have
an empty second arg conversion since the first arg conversion was deemed
bad, and this trips up joust when called on #3 and #4 which assumes all
arg conversions are there.
We can fix this by making joust robust to empty arg conversions, but in
this situation we shouldn't need to compare #3 and #4 at all given that
we have a strictly viable candidate. To that end, this patch makes
tourney shortcut considering non-strictly viable candidates upon
encountering ambiguity between two strictly viable candidates (taking
advantage of the fact that the candidates list is sorted according to
viability via splice_viable).
PR c++/115239
gcc/cp/ChangeLog:
* call.cc (tourney): Don't consider a non-strictly viable
candidate as the champ if there was ambiguity between two
strictly viable candidates.
gcc/testsuite/ChangeLog:
* g++.dg/overload/error7.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 7fed7e9bbc57d502e141e079a6be2706bdbd4560)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (8 preceding siblings ...)
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
@ 2024-06-17 14:27 ` ppalka at gcc dot gnu.org
2024-06-24 21:51 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-17 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.2, thanks for the bug report.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/115239] [14 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
` (9 preceding siblings ...)
2024-06-17 14:27 ` ppalka at gcc dot gnu.org
@ 2024-06-24 21:51 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-24 21:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115239
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jan.zizka at nokia dot com
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 115621 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-06-24 21:51 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-27 4:37 [Bug c++/115239] New: ICE: internal compiler error: Segmentation fault markus at oberhumer dot com
2024-05-27 4:40 ` [Bug c++/115239] " pinskia at gcc dot gnu.org
2024-05-27 4:42 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call from static_assert in some cases pinskia at gcc dot gnu.org
2024-05-27 4:43 ` pinskia at gcc dot gnu.org
2024-05-27 4:45 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call " pinskia at gcc dot gnu.org
2024-05-27 7:22 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) rguenth at gcc dot gnu.org
2024-05-27 8:52 ` [Bug c++/115239] [14/15 Regression] ICE: Segmentation fault with ambiguous function call in some cases (`const char*` vs `char` with `long` vs `unsigned`) since r14-6522 jakub at gcc dot gnu.org
2024-06-13 14:02 ` cvs-commit at gcc dot gnu.org
2024-06-14 14:50 ` [Bug c++/115239] [14 " ppalka at gcc dot gnu.org
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-17 14:27 ` ppalka at gcc dot gnu.org
2024-06-24 21:51 ` pinskia 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).