From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02AB8398B17B; Tue, 2 Feb 2021 17:06:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02AB8398B17B From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/97882] [8/9/10/11 Regression] Segmentation Fault on improper redeclaration of function Date: Tue, 02 Feb 2021 17:06:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc assigned_to Message-ID: In-Reply-To: References: 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: Tue, 02 Feb 2021 17:06:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97882 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |msebor at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot g= nu.org --- Comment #3 from Martin Sebor --- While testing a fix for this I came up with the following variation on the original test case: void f (void) { auto enum E g (); // valid? unsigned g () { } } This also ICEs but I'm not sure if it should be fixed the same way as the original=20 or rather by rejecting the auto storage specifier on nested function declarations. Since nested functions are implicitly static the auto is in conflict with that, the same way extern is below. Shouldn't the auto be rejected? (There are tests that expect this to be valid, e.g., gcc.dg/nested-func-3.c.) $ cat t.c && /build/gcc-trunk/gcc/cc1 t.c void f (void) { extern enum E g (); unsigned g () { } } f g t.c:4:12: error: static declaration of =E2=80=98g=E2=80=99 follows non-stat= ic declaration 4 | unsigned g () { } | ^ t.c:3:17: note: previous declaration of =E2=80=98g=E2=80=99 was here 3 | extern enum E g (); | ^ t.c: In function =E2=80=98g=E2=80=99: t.c:4:3: internal compiler error: Segmentation fault 4 | unsigned g () { } | ^~~~~~~~ 0x13f321a crash_signal /src/gcc/trunk/gcc/toplev.c:327 0xbdc3b4 must_pass_in_stack_var_size_or_pad(function_arg_info const&) /src/gcc/trunk/gcc/calls.c:6282=