public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2
@ 2021-12-23 19:07 dani at danielbertalan dot dev
2021-12-23 19:47 ` [Bug ipa/103819] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: dani at danielbertalan dot dev @ 2021-12-23 19:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Bug ID: 103819
Summary: [12 Regression] ICE in redirect_callee, at
cgraph.c:1389 with __attribute__((flatten)) and -O2
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: dani at danielbertalan dot dev
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Created attachment 52052
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52052&action=edit
Test case
Link to Compiler Explorer: https://godbolt.org/z/5bE9zsvfh
The following code fails to compile with gcc 12 (commit
61e53698a08dc1d9a54d785218af687a6751c1b3):
===
template <typename T> struct Optional {
~Optional() {
if (m_has_value)
value();
}
T value();
void release_value() { m_has_value = false; }
bool m_has_value;
};
struct Completion {
Optional<int> m_target;
};
struct ThrowCompletionOr {
void release_error() { m_throw_completion.release_value(); }
Optional<Completion> m_throw_completion;
} __trans_tmp_1;
__attribute__((flatten)) void value_to_numeric() {
auto _temporary_result(__trans_tmp_1);
_temporary_result.release_error();
}
===
The issue is both present in Compiler Explorer's trunk compiler, and in my
local build that has SerenityOS-specific patches applied. The error, as
reported by the latter, is:
$ g++ -O2 -v -save-temps -c repro.ii:
Using built-in specs.
COLLECT_GCC=../../Toolchain/Local/gcc-12/i686/bin/i686-pc-serenity-g++
Target: i686-pc-serenity
Configured with: ../../Tarballs/gcc/configure
--prefix=/home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-12/i686
--target=i686-pc-serenity
--with-sysroot=/home/dani/Projects/contributions/serenity/Build/i686/Root
--disable-nls --with-newlib --enable-shared --enable-languages=c,c++
--enable-default-pie --enable-lto --enable-threads=posix
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211223 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-O2' '-v' '-save-temps' '-c' '-shared-libgcc'
'-mtune=generic' '-march=pentiumpro'
/home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-12/i686/libexec/gcc/i686-pc-serenity/12.0.0/cc1plus
-fpreprocessed repro.ii -ftls-model=initial-exec -fPIC
-fno-semantic-interposition -quiet -dumpbase repro.ii -dumpbase-ext .ii
-mtune=generic -march=pentiumpro -O2 -version -ftls-model=initial-exec -o
repro.s
GNU C++17 (GCC) version 12.0.0 20211223 (experimental) (i686-pc-serenity)
compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++17 (GCC) version 12.0.0 20211223 (experimental) (i686-pc-serenity)
compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 42faffcdcc480dea6a6ccc95e1bcf344
during IPA pass: inline
repro.ii:21:1: internal compiler error: in redirect_callee, at cgraph.c:1389
21 | }
| ^
0x761a99 cgraph_edge::redirect_callee(cgraph_node*)
../../../Tarballs/gcc/gcc/cgraph.c:1389
0xf0a8af redirect_to_unreachable
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:260
0xf0a8af edge_set_predicate
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:284
0xf0ad3d remap_edge_summaries
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:4037
0xf0e246 ipa_merge_fn_summary_after_inlining(cgraph_edge*)
../../../Tarballs/gcc/gcc/ipa-fnsummary.c:4200
0xf23cd5 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*,
int*, bool, bool*)
../../../Tarballs/gcc/gcc/ipa-inline-transform.c:504
0x1eb2477 flatten_function
../../../Tarballs/gcc/gcc/ipa-inline.c:2413
0x1eb69eb ipa_inline
../../../Tarballs/gcc/gcc/ipa-inline.c:2736
0x1eb69eb execute
../../../Tarballs/gcc/gcc/ipa-inline.c:3148
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
@ 2021-12-23 19:47 ` pinskia at gcc dot gnu.org
2021-12-23 19:50 ` [Bug ipa/103819] [10/11/12 " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target Milestone|--- |12.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
2021-12-23 19:47 ` [Bug ipa/103819] " pinskia at gcc dot gnu.org
@ 2021-12-23 19:50 ` pinskia at gcc dot gnu.org
2021-12-28 10:17 ` [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034 marxin at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-checking
Summary|[12 Regression] ICE in |[10/11/12 Regression] ICE
|redirect_callee, at |in redirect_callee, at
|cgraph.c:1389 with |cgraph.c:1389 with
|__attribute__((flatten)) |__attribute__((flatten))
|and -O2 |and -O2
Known to fail| |10.3.0, 11.1.0, 12.0
Ever confirmed|0 |1
Known to work| |10.1.0, 10.2.0
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-12-23
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With -fchecking, GCC 10.3.0, 11.1.0 also ICE:
<source>:22:1: error: calls_comdat_local is set outside of a comdat group
22 | }
| ^
<source>:22:1: error: invalid calls_comdat_local flag
_Z16value_to_numericv/5 (void value_to_numeric()) @0x7f780edb3ca8
Type: function definition analyzed
Visibility: externally_visible public
References:
Referring:
Availability: available
Function flags: count:1073741824 (estimated locally) body calls_comdat_local
Called by:
Calls: _ZN8OptionalI10CompletionED2Ev/25 (inlined) (1073741824 (estimated
locally),1.00 per call)
<source>:22: confused by earlier errors, bailing out
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
2021-12-23 19:47 ` [Bug ipa/103819] " pinskia at gcc dot gnu.org
2021-12-23 19:50 ` [Bug ipa/103819] [10/11/12 " pinskia at gcc dot gnu.org
@ 2021-12-28 10:17 ` marxin at gcc dot gnu.org
2022-01-24 21:57 ` dani at danielbertalan dot dev
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-28 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE |[10/11/12 Regression] ICE
|in redirect_callee, at |in redirect_callee, at
|cgraph.c:1389 with |cgraph.c:1389 with
|__attribute__((flatten)) |__attribute__((flatten))
|and -O2 |and -O2 since
| |r11-7940-ge7fd3b783238d034
CC| |hubicka at gcc dot gnu.org
Priority|P3 |P1
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-7940-ge7fd3b783238d034.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
` (2 preceding siblings ...)
2021-12-28 10:17 ` [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034 marxin at gcc dot gnu.org
@ 2022-01-24 21:57 ` dani at danielbertalan dot dev
2022-03-08 13:21 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dani at danielbertalan dot dev @ 2022-01-24 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
--- Comment #3 from Daniel Bertalan <dani at danielbertalan dot dev> ---
Here's an even smaller test case (https://gcc.godbolt.org/z/ee9GceMx3):
===
template <typename T> struct Optional {
~Optional() {
if (m_has_value)
value();
}
T value();
bool m_has_value{};
};
__attribute__((flatten)) int main(){
Optional<Optional<int>> _temporary_result{};
return 0;
}
===
during IPA pass: inline
<source>:12:1: internal compiler error: in redirect_callee, at cgraph.cc:1389
12 | }
| ^
0x215b739 internal_error(char const*, ...)
???:0
0x73b7e7 fancy_abort(char const*, int, char const*)
???:0
0xbe2bbe cgraph_edge::redirect_callee(cgraph_node*)
???:0
0xe6b781 ipa_merge_fn_summary_after_inlining(cgraph_edge*)
???:0
0xe85396 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*,
int*, bool, bool*)
???:0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
` (3 preceding siblings ...)
2022-01-24 21:57 ` dani at danielbertalan dot dev
@ 2022-03-08 13:21 ` rguenth at gcc dot gnu.org
2022-04-09 20:59 ` hubicka at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-08 13:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P1 |P2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
` (4 preceding siblings ...)
2022-03-08 13:21 ` rguenth at gcc dot gnu.org
@ 2022-04-09 20:59 ` hubicka at gcc dot gnu.org
2022-05-06 8:32 ` [Bug ipa/103819] [10/11/12/13 " jakub at gcc dot gnu.org
2023-05-08 12:23 ` [Bug ipa/103819] [10/11/12/13/14 " rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: hubicka at gcc dot gnu.org @ 2022-04-09 20:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
mine.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12/13 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
` (5 preceding siblings ...)
2022-04-09 20:59 ` hubicka at gcc dot gnu.org
@ 2022-05-06 8:32 ` jakub at gcc dot gnu.org
2023-05-08 12:23 ` [Bug ipa/103819] [10/11/12/13/14 " rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06 8:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |12.2
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/103819] [10/11/12/13/14 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
` (6 preceding siblings ...)
2022-05-06 8:32 ` [Bug ipa/103819] [10/11/12/13 " jakub at gcc dot gnu.org
@ 2023-05-08 12:23 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.3 |12.4
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-05-08 12:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 19:07 [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 dani at danielbertalan dot dev
2021-12-23 19:47 ` [Bug ipa/103819] " pinskia at gcc dot gnu.org
2021-12-23 19:50 ` [Bug ipa/103819] [10/11/12 " pinskia at gcc dot gnu.org
2021-12-28 10:17 ` [Bug ipa/103819] [10/11/12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 since r11-7940-ge7fd3b783238d034 marxin at gcc dot gnu.org
2022-01-24 21:57 ` dani at danielbertalan dot dev
2022-03-08 13:21 ` rguenth at gcc dot gnu.org
2022-04-09 20:59 ` hubicka at gcc dot gnu.org
2022-05-06 8:32 ` [Bug ipa/103819] [10/11/12/13 " jakub at gcc dot gnu.org
2023-05-08 12:23 ` [Bug ipa/103819] [10/11/12/13/14 " rguenth 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).