re PR c/79730 (ICE tree check: expected var_decl, have function_decl in finish_decl, at c/c-decl.c:5063)

PR c/79730
	* c-decl.c (finish_decl): Check VAR_P.

	* gcc.dg/pr79730.c: New test.

From-SVN: r246578
This commit is contained in:
Marek Polacek 2017-03-29 23:40:36 +00:00 committed by Marek Polacek
parent fdc54f39c1
commit 10fa8dfb3a
4 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-03-29 Marek Polacek <polacek@redhat.com>
PR c/79730
* c-decl.c (finish_decl): Check VAR_P.
2017-03-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/80162

View File

@ -5066,7 +5066,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
when a tentative file-scope definition is seen.
But at end of compilation, do output code for them. */
DECL_DEFER_OUTPUT (decl) = 1;
if (asmspec && C_DECL_REGISTER (decl))
if (asmspec && VAR_P (decl) && C_DECL_REGISTER (decl))
DECL_HARD_REGISTER (decl) = 1;
rest_of_decl_compilation (decl, true, 0);
}

View File

@ -1,3 +1,8 @@
2017-03-29 Marek Polacek <polacek@redhat.com>
PR c/79730
* gcc.dg/pr79730.c: New test.
2017-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/78670

View File

@ -0,0 +1,6 @@
/* PR c/79730 */
/* { dg-do compile } */
/* { dg-options "-std=gnu11" } */
register int x() asm (""); /* { dg-error "invalid storage class" } */
register float y() asm (""); /* { dg-error "invalid storage class" } */