From f4b7e754cc9db79e4239ffcdf56acc780543ed05 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 29 Jan 2019 00:49:51 +0100 Subject: [PATCH] re PR c/89045 (ICE in get_parm_info, at c/c-decl.c:7518) PR c/89045 * c-decl.c (build_compound_literal): Don't pushdecl if in parameter scope. * gcc.dg/pr89045.c: New test. From-SVN: r268349 --- gcc/c/ChangeLog | 4 ++++ gcc/c/c-decl.c | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr89045.c | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr89045.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e6bff9c064b..dcb3f2136d9 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,9 @@ 2019-01-29 Jakub Jelinek + PR c/89045 + * c-decl.c (build_compound_literal): Don't pushdecl if in parameter + scope. + PR c/86125 * c-decl.c (last_fileptr_type): Remove. (last_structptr_types): New variable. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 593b34e0047..02a93231130 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5528,7 +5528,7 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const, pushdecl (decl); rest_of_decl_compilation (decl, 1, 0); } - else if (current_function_decl) + else if (current_function_decl && !current_scope->parm_flag) pushdecl (decl); if (non_const) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2e97ef3ae46..9798783152e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-01-29 Jakub Jelinek + PR c/89045 + * gcc.dg/pr89045.c: New test. + PR c/86125 * gcc.dg/Wbuiltin-declaration-mismatch-7.c: Guard testcase for lp64, ilp32 and llp64 only. diff --git a/gcc/testsuite/gcc.dg/pr89045.c b/gcc/testsuite/gcc.dg/pr89045.c new file mode 100644 index 00000000000..d8ba65b62ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89045.c @@ -0,0 +1,15 @@ +/* PR c/89045 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int +foo (int x) +{ + int v[(int){ x }]; + v[0] = 0; + int bar (int p[(int){ x }]) + { + return p[0]; + } + return bar (v); +} -- 2.30.2