diff options
author | Andrew Pinski <apinski@marvell.com> | 2021-09-17 04:59:03 +0000 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2021-09-28 20:01:14 +0000 |
commit | e12f66d96fe41c8ef8a0d01b6a8394cd6bce3978 (patch) | |
tree | fa2b27371e00155ebf3f6ee89a78f8cee7ffb4a1 /gcc/c/c-tree.h | |
parent | c44c5f3d9f46705a262911c2098c1568d7e8ac2d (diff) | |
download | gcc-e12f66d96fe41c8ef8a0d01b6a8394cd6bce3978.zip gcc-e12f66d96fe41c8ef8a0d01b6a8394cd6bce3978.tar.gz gcc-e12f66d96fe41c8ef8a0d01b6a8394cd6bce3978.tar.bz2 |
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.
Diffstat (limited to 'gcc/c/c-tree.h')
-rw-r--r-- | gcc/c/c-tree.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index d50d0cb..a046c6b 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -746,7 +746,7 @@ extern tree c_finish_expr_stmt (location_t, tree); extern tree c_finish_return (location_t, tree, tree); extern tree c_finish_bc_stmt (location_t, tree, bool); extern tree c_finish_goto_label (location_t, tree); -extern tree c_finish_goto_ptr (location_t, tree); +extern tree c_finish_goto_ptr (location_t, c_expr val); extern tree c_expr_to_decl (tree, bool *, bool *); extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree); extern tree c_finish_oacc_data (location_t, tree, tree); |