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/59016] f951: internal compiler error: Segmentation fault


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59016

--- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> As it seems the problem with the program bug.f90 is that the generic
> attribute is set in a symbol as the parser tries to match a declaration
> type specification; but finally, the statement isn't matched as such
> and the generic attribute wasn't cleared.
>
> So, the attached patch makes the cleanup, without causing the regressions
> listed in comment 9.

IMO the patch addresses the root of the problem and prevents the ICEs in the
PRs listed in comment 9. However it causes 3000+ failures in the test suite, so
the filter you apply is not narrow enough.

> The question here is if gfortran had to print an error message for
> this program:
> 
> module types
>   public :: undefined
> end module types
> write (*,*) "undefined types!"
> end 

Why should it without "implicit none"?

Your patches do not follow the GNU coding standards:

http://www.gnu.org/prep/standards/

The last patch should look as

--- ../_clean/gcc/fortran/decl.c    2015-03-25 14:07:04.000000000 +0100
+++ gcc/fortran/decl.c    2015-04-05 13:02:38.000000000 +0200
@@ -4427,6 +4427,31 @@ ok:
   gfc_free_data_all (gfc_current_ns);

 cleanup:
+  //<pr59016> in gfc_match_data_decl; cleanup the garbages  
+  gfc_symbol *csym = NULL;
+  if (current_ts.u.derived && current_ts.u.derived->name)
+    {
+      char iname[129];
+      iname[128] = 0;
+      for (int i = 0; i < 128; i++)
+    {
+      iname[i] = current_ts.u.derived->name[i];
+      if (current_ts.u.derived->name[i] == 0)
+        break;
+    }
+      iname[0] = TOLOWER(iname[0]);
+      for (int i = 0; i < 4; i++)
+    {
+     gfc_find_symbol (iname, NULL, i, &csym) ;
+     if (csym && csym->generic
+         && (csym->generic->sym == current_ts.u.derived))
+       {
+          csym->generic = NULL;
+          break;
+       }
+    }
+    }
+  //</pr59016>
   gfc_free_array_spec (current_as);
   current_as = NULL;
   return m;

(note that I may have done some errors myself). In addition you should comment
what you are trying to do.


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