This is the mail archive of the gcc-patches@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]

[Patch, fortran] PR29051 - ICE on error in "old-style" initializer


:ADDPATCH fortran:

Bud,

Quite by chance, I had noticed the cause of this a couple of days ago; if you
look at the Doxygen documentation for gfc_data, you will see that the only
reference to the locus field 'where' is in resolve.c(resolve_data), where the
error is emitted. I was mulling over where the locus was being set and why the
documentation might miss it, when I saw your PR and realised that it isn't set
at all!


An Occam's Razor moment.....

The patch is utterly trivial and your (Bud's) test has been dejagnuified.

Regtests on FC5/Athlon - OK for trunk and 4.1?

PS My 4.2.0 tree is being used for TR15581 testing right now, so the diff is relative to 4.1

Paul

2006-09-13 Paul Thomas <pault@gcc.gnu.org>

   PR fortran/29051
   * decl.c (match_old_style_init): Set the 'where' field of the
   gfc_data structure 'newdata'.

2006-09-13 Paul Thomas <pault@gcc.gnu.org>

   PR fortran/29051
   * gfortran.dg/oldstyle_3.f90: New test.



Index: gcc/fortran/decl.c
===================================================================
*** gcc/fortran/decl.c	(revision 116870)
--- gcc/fortran/decl.c	(working copy)
*************** match_old_style_init (const char *name)
*** 395,400 ****
--- 395,401 ----
    newdata = gfc_get_data ();
    newdata->var = gfc_get_data_variable ();
    newdata->var->expr = gfc_get_variable_expr (st);
+   newdata->where = gfc_current_locus;
  
    /* Match initial value list. This also eats the terminal
       '/'.  */
Index: gcc/testsuite/gfortran.dg/oldstyle_3.f90
===================================================================
*** gcc/testsuite/gfortran.dg/oldstyle_3.f90	(revision 0)
--- gcc/testsuite/gfortran.dg/oldstyle_3.f90	(revision 0)
***************
*** 0 ****
--- 1,10 ----
+ ! { dg-do compile }
+ ! Suppress the warning about an old-style initializer;
+ ! { dg-options "" }
+ ! This tests the fix for PR29052 in which the error below would cause a seg-fault
+ ! because the locus of the initializer was never set.
+ !
+ ! Contributed by Bud Davis  <bdavis@gcc.gnu.org>
+ !
+        character*10 a(4,2) /'aaa','bbb','ccc','ddd'/ ! { dg-error "more variables than values" }
+        end

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