From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 29F423858437; Tue, 28 Sep 2021 20:02:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29F423858437 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/32122] indirect goto to an integer accepted Date: Tue, 28 Sep 2021 20:02:50 +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: unknown X-Bugzilla-Keywords: accepts-invalid, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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, 28 Sep 2021 20:02:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D32122 --- Comment #7 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:e12f66d96fe41c8ef8a0d01b6a8394cd6bce3978 commit r12-3947-ge12f66d96fe41c8ef8a0d01b6a8394cd6bce3978 Author: Andrew Pinski Date: Fri Sep 17 04:59:03 2021 +0000 c: [PR32122] Require pointer types for computed gotos So GCC has always accepted non-pointer types in computed gotos but that was wrong based on the documentation: Any expression of type void * is allowed. So this fixes the problem by requiring the type to be a pointer type. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR c/32122 gcc/c/ChangeLog: * c-parser.c (c_parser_statement_after_labels): Pass the c_expr instead of the tree to c_finish_goto_ptr. * c-typeck.c (c_finish_goto_ptr): Change the second argument type to c_expr. * c-tree.h (c_finish_goto_ptr): Likewise. Error out if the expression was not of a pointer type. gcc/testsuite/ChangeLog: * gcc.dg/comp-goto-5.c: New test. * gcc.dg/comp-goto-6.c: New test.=