On 9/19/2021 10:14 PM, apinski--- via Gcc-patches wrote:
From: Andrew Pinski <apin...@marvell.com>

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.
OK
jeff

Reply via email to