From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1251) id F34B33858D39; Thu, 10 Mar 2022 23:50:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F34B33858D39 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Roger Sayle To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7607] PR c++/84964: Middle-end patch to expand_call for ICE after sorry. X-Act-Checkin: gcc X-Git-Author: Roger Sayle X-Git-Refname: refs/heads/master X-Git-Oldrev: a8db9b90439f33af9ef602325df1f1e967fc549a X-Git-Newrev: a717376e99fb33ba3b06bd8122e884f4b63a60c9 Message-Id: <20220310235009.F34B33858D39@sourceware.org> Date: Thu, 10 Mar 2022 23:50:09 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2022 23:50:10 -0000 https://gcc.gnu.org/g:a717376e99fb33ba3b06bd8122e884f4b63a60c9 commit r12-7607-ga717376e99fb33ba3b06bd8122e884f4b63a60c9 Author: Roger Sayle Date: Thu Mar 10 23:49:15 2022 +0000 PR c++/84964: Middle-end patch to expand_call for ICE after sorry. This patch resolves PR c++/84969 which is an ICE in the middle-end after emitting a "sorry, unimplemented" message, and is a regression from earlier releases of GCC. This issue is that after encountering a function call requiring an unreasonable amount of stack space, the code continues and falls foul of an assert checking that stack pointer has been correctly updated. The fix is to (locally) consider aborted function calls as "no return", which skips this downstream sanity check. 2022-03-10 Roger Sayle gcc/ChangeLog PR c++/84964 * calls.cc (expand_call): Ignore stack adjustments after sorry. gcc/testsuite/ChangeLog PR c++/84964 * g++.dg/other/pr84964.C: New test case. Diff: --- gcc/calls.cc | 2 ++ gcc/testsuite/g++.dg/other/pr84964.C | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/gcc/calls.cc b/gcc/calls.cc index 58864d0fdb3..50fa7b8e350 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -3447,6 +3447,8 @@ expand_call (tree exp, rtx target, int ignore) >= (1 << (HOST_BITS_PER_INT - 2))) { sorry ("passing too large argument on stack"); + /* Don't worry about stack clean-up. */ + flags |= ECF_NORETURN; continue; } diff --git a/gcc/testsuite/g++.dg/other/pr84964.C b/gcc/testsuite/g++.dg/other/pr84964.C new file mode 100644 index 00000000000..0f2f6f3e629 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr84964.C @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +struct a { + short b : -1ULL; // { dg-warning "exceeds its type" } +}; +void c(...) { c(a()); } // { dg-message "sorry, unimplemented" } +