From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DAFF385840B; Thu, 23 Dec 2021 19:07:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DAFF385840B From: "dani at danielbertalan dot dev" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/103819] New: [12 Regression] ICE in redirect_callee, at cgraph.c:1389 with __attribute__((flatten)) and -O2 Date: Thu, 23 Dec 2021 19:07:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dani at danielbertalan dot dev X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2021 19:07:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103819 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=3D52052&action=3Dedit Test case Link to Compiler Explorer: https://godbolt.org/z/5bE9zsvfh The following code fails to compile with gcc 12 (commit 61e53698a08dc1d9a54d785218af687a6751c1b3): =3D=3D=3D template struct Optional { ~Optional() { if (m_has_value) value(); } T value(); void release_value() { m_has_value =3D false; } bool m_has_value; }; struct Completion { Optional m_target; }; struct ThrowCompletionOr { void release_error() { m_throw_completion.release_value(); } Optional m_throw_completion; } __trans_tmp_1; __attribute__((flatten)) void value_to_numeric() { auto _temporary_result(__trans_tmp_1); _temporary_result.release_error(); } =3D=3D=3D 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=3D../../Toolchain/Local/gcc-12/i686/bin/i686-pc-serenity-g++ Target: i686-pc-serenity Configured with: ../../Tarballs/gcc/configure --prefix=3D/home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-1= 2/i686 --target=3Di686-pc-serenity --with-sysroot=3D/home/dani/Projects/contributions/serenity/Build/i686/Root --disable-nls --with-newlib --enable-shared --enable-languages=3Dc,c++ --enable-default-pie --enable-lto --enable-threads=3Dposix Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211223 (experimental) (GCC) COLLECT_GCC_OPTIONS=3D'-O2' '-v' '-save-temps' '-c' '-shared-libgcc' '-mtune=3Dgeneric' '-march=3Dpentiumpro' /home/dani/Projects/contributions/serenity/Toolchain/Local/gcc-12/i686/libe= xec/gcc/i686-pc-serenity/12.0.0/cc1plus -fpreprocessed repro.ii -ftls-model=3Dinitial-exec -fPIC -fno-semantic-interposition -quiet -dumpbase repro.ii -dumpbase-ext .ii -mtune=3Dgeneric -march=3Dpentiumpro -O2 -version -ftls-model=3Dinitial-exe= c -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=3D30 --param ggc-min-heapsize=3D4096 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=3D30 --param ggc-min-heapsize=3D4096 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= *, 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=