2009-07-10 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jul 2009 04:37:19 +0000 (04:37 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Jul 2009 04:37:19 +0000 (04:37 +0000)
PR fortran/39334
* primary.c (match_kind_param): Return MATCH_NO if the symbol
has no value.

2009-07-10  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/39334
* gfortran.dg/recursive_parameter_1.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149456 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/recursive_parameter_1.f90 [new file with mode: 0644]

index 5b1ed77..20894cb 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-10  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/39334
+       * primary.c (match_kind_param): Return MATCH_NO if the symbol
+       has no value.
+
 2008-07-09  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/40629
index 4a84aed..8013cc8 100644 (file)
@@ -57,6 +57,9 @@ match_kind_param (int *kind)
   if (sym->attr.flavor != FL_PARAMETER)
     return MATCH_NO;
 
+  if (sym->value == NULL)
+    return MATCH_NO;
+
   p = gfc_extract_int (sym->value, kind);
   if (p != NULL)
     return MATCH_NO;
index 333544c..48711da 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-10  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/39334
+       * gfortran.dg/recursive_parameter_1.f90: New test.
+
 2009-07-09  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * gfortran.dg/c_kind_tests_2.f03: clean-up leftover module(s).
diff --git a/gcc/testsuite/gfortran.dg/recursive_parameter_1.f90 b/gcc/testsuite/gfortran.dg/recursive_parameter_1.f90
new file mode 100644 (file)
index 0000000..8a13d25
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! Tests the fix for PR39334 in which the recursive parameter declaration
+! caused a sgfault.
+!
+! Reported by James van Buskirk on comp.lang.fortran
+!
+program recursive_parameter
+   implicit none
+   integer, parameter :: dp = kind(1.0_dp) ! { dg-error "Missing kind-parameter" }
+   write(*,*) dp ! { dg-error "has no IMPLICIT type" }
+end program recursive_parameter