This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/30478] FAIL: gfortran.dg/enum_2.f90 -O (internal compiler error)



------- Comment #19 from tobi at gcc dot gnu dot org  2007-02-10 02:11 -------
This patch (the diff is against 4.1) fixes it on linux-i686 under valgrind. 
I'm currently giving it the full testsuite exercise.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 121787)
+++ gcc/fortran/decl.c  (working copy)
@@ -1037,7 +1037,7 @@ gfc_match_null (gfc_expr ** result)
    symbol table or the current interface.  */

 static match
-variable_decl (int elem)
+variable_decl (int elem, bool enumerator)
 {
   char name[GFC_MAX_SYMBOL_LEN + 1];
   gfc_expr *initializer, *char_len;
@@ -1293,7 +1293,7 @@ variable_decl (int elem)
      initializer, the initialization value of the previous enumerator 
      (stored in last_initializer) is incremented by 1 and is used to
      initialize the current enumerator.  */
-  if (gfc_current_state () == COMP_ENUM)
+  if (enumerator)
     {
       if (initializer == NULL)
         initializer = gfc_enum_initializer (last_initializer, old_locus);
@@ -2317,7 +2317,7 @@ ok:
   elem = 1;
   for (;;)
     {
-      m = variable_decl (elem++);
+      m = variable_decl (elem++, false);
       if (m == MATCH_ERROR)
        goto cleanup;
       if (m == MATCH_NO)
@@ -4081,7 +4081,7 @@ gfc_match_enum (void)
     return m;

   if (gfc_notify_std (GFC_STD_F2003, 
-                     "New in Fortran 2003: ENUM AND ENUMERATOR at %C")
+                     "New in Fortran 2003: ENUM and ENUMERATOR at %C")
       == FAILURE)
     return MATCH_ERROR;

@@ -4123,7 +4123,7 @@ gfc_match_enumerator_def (void)
   elem = 1;
   for (;;)
     {
-      m = variable_decl (elem++);
+      m = variable_decl (elem++, true);
       if (m == MATCH_ERROR)
        goto cleanup;
       if (m == MATCH_NO)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30478


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]