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
This commit is contained in:
Jakub Jelinek 2019-01-29 00:49:51 +01:00 committed by Jakub Jelinek
parent 6a335b9669
commit f4b7e754cc
4 changed files with 23 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2019-01-29 Jakub Jelinek <jakub@redhat.com>
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.

View File

@ -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)

View File

@ -1,5 +1,8 @@
2019-01-29 Jakub Jelinek <jakub@redhat.com>
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.

View File

@ -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);
}