From: Fritz Reese Date: Tue, 23 Aug 2016 19:33:46 +0000 (+0000) Subject: decl.c (gfc_match_structure_decl): Make gfc_structure_id static. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cfe37db47a363d243f4e2e0a7d6b9b1bf429934b;p=gcc.git decl.c (gfc_match_structure_decl): Make gfc_structure_id static. 2016-08-23 Fritz Reese gcc/fortran/ * decl.c (gfc_match_structure_decl): Make gfc_structure_id static. gcc/testsuite/gfortran.dg/ * dec_structure_12.f90: New testcase. From-SVN: r239709 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d3273a8d99c..6dc44e6f035 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2016-08-23 Fritz Reese + + * decl.c (gfc_match_structure_decl): Make gfc_structure_id static. + 2016-08-23 Fritz Reese * interface.c (compare_components): Fix typo in name check conditional. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index ce5ebb763ba..ce7254f09c8 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -8473,7 +8473,7 @@ match gfc_match_structure_decl (void) { /* Counter used to give unique internal names to anonymous structures. */ - int gfc_structure_id = 0; + static unsigned int gfc_structure_id = 0; char name[GFC_MAX_SYMBOL_LEN + 1]; gfc_symbol *sym; match m; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8dcf3d761ed..4c45e35f50b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-08-23 Fritz Reese + + * gfortran.dg/dec_structure_12.f90: New testcase. + 2016-08-23 Dominik Vogt * gcc.target/s390/insv-1.c: Fix test when running with -m31. diff --git a/gcc/testsuite/gfortran.dg/dec_structure_12.f90 b/gcc/testsuite/gfortran.dg/dec_structure_12.f90 new file mode 100644 index 00000000000..b6cc5aa12ed --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dec_structure_12.f90 @@ -0,0 +1,27 @@ +! { dg-do "compile" } +! { dg-options "-fdec-structure" } +! +! Test a regression where multiple anonymous structures failed to +! receive unique internal names. +! + +implicit none + +structure /s/ + + structure record0 ! (2) + integer i + end structure + + structure record1 ! regression: Type definition was already defined at (2) + real r + end structure + +end structure + +record /s/ var + +var.record0.i = 0 +var.record1.r = 0.0 + +end