c_parser_declarator can return null if there was an error,
but c_parser_gimple_declaration was not ready for that.
This fixes that oversight so we don't get an ICE after the error.
Bootstrapped and tested on x86_64-linux-gnu.
PR c/117749
gcc/c/ChangeLog:
* gimple-parser.cc (c_parser_gimple_declaration): Check
declarator to be non-null.
gcc/testsuite/ChangeLog:
* gcc.dg/gimplefe-55.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
specs->typespec_kind != ctsk_none,
C_DTR_NORMAL, &dummy);
- if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ if (!c_parser_next_token_is (parser, CPP_SEMICOLON))
+ {
+ c_parser_error (parser, "expected %<;%>");
+ return;
+ }
+ if (declarator)
{
/* Handle SSA name decls specially, they do not go into the identifier
table but we simply build the SSA name for later lookup. */
NULL_TREE);
}
}
- else
- {
- c_parser_error (parser, "expected %<;%>");
- return;
- }
}
/* Parse gimple goto statement. */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+/* PR c/117749 */
+/* Make sure we don't ICE after not have a full local
+ declaration in gimple fe. */
+
+__GIMPLE
+void foo ( ) {
+ int ; /* { dg-error "" } */
+}