From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5F5938708C4; Mon, 22 Feb 2021 12:50:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5F5938708C4 From: "zhan3299 at purdue dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99198] New: when combinating nested function and __builtin_call_with_static_chain, optimization triggers an internal compiler error (verify_gimple) Date: Mon, 22 Feb 2021 12:50:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhan3299 at purdue dot edu 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 target_milestone 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: Mon, 22 Feb 2021 12:50:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99198 Bug ID: 99198 Summary: when combinating nested function and __builtin_call_with_static_chain, optimization triggers an internal compiler error (verify_gimple) Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zhan3299 at purdue dot edu Target Milestone: --- Following code is reduced by c-reduce and meaningless, but seems valid as g= cc -O0 accept it.=20 Under O0, the program can be successfully compiled (https://godbolt.org/z/zvGxTP); but under O1, it triggers an internal compi= ler error (https://godbolt.org/z/xbvrs6). Besides, any version prior version 11= .0 has no such problem. $ cat test.c int main() { void f() {} __builtin_call_with_static_chain(f(), &f); return 0; } $ gcc --version gcc (Compiler-Explorer-Build) 11.0.0 20210221 (experimental) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc -O0 test.c # Execution build compiler returned: 0 $ gcc -O1 test.c : In function 'main': :1:5: error: static chain with function that doesn't use one 1 | int main() { | ^~~~ f (); [static-chain: f] during GIMPLE pass: *warn_unused_result :1:5: internal compiler error: 'verify_gimple' failed 0x1a31d99 internal_error(char const*, ...) ???:0 0xdc218d verify_gimple_in_seq(gimple*) ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions.=