aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/primary.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/pr66545_1.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/pr66545_2.f9023
5 files changed, 54 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c58b646..b977727 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/66545
+ * primary.c (match_sym_complex_part): Do not dereference NULL pointer.
+
2015-07-01 Thomas Koenig <tkoenig@gcc.gnu.org>
* arith.c (gfc_arith_divide): With -Winteger-division,
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 86639aa..f55e420 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1254,6 +1254,9 @@ match_sym_complex_part (gfc_expr **result)
return MATCH_ERROR;
}
+ if (!sym->value)
+ goto error;
+
if (!gfc_numeric_ts (&sym->value->ts))
{
gfc_error ("Numeric PARAMETER required in complex constant at %C");
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7b749b..9e92aae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/66545
+ * gfortran.dg/pr66545_1.f90: New test.
+ * gfortran.dg/pr66545_2.f90: New test.
+
2015-07-02 Alan Lawrence <alan.lawrence@arm.com>
* gcc.dg/vect/vect-strided-a-u16-i4.c (main1): Narrow scope of x,y,z,w.
diff --git a/gcc/testsuite/gfortran.dg/pr66545_1.f90 b/gcc/testsuite/gfortran.dg/pr66545_1.f90
new file mode 100644
index 0000000..7daa800
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr66545_1.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+! PR fortran/66545
+!
+subroutine p
+ complex, parameter :: c1 = (c1) ! { dg-error "before its definition" }
+ complex, parameter :: c2 = c2 ! { dg-error "before its definition" }
+ complex :: c3 = (c3) ! { dg-error "has not been declared or is a variable" }
+ complex :: c4 = c4 ! { dg-error "has not been declared or is a variable" }
+end subroutine p
+
+subroutine q
+ real, parameter :: r1 = (r1) ! { dg-error "before its definition" }
+ real, parameter :: r2 = r2 ! { dg-error "before its definition" }
+ real :: r3 = (r3) ! { dg-error "has not been declared or is a variable" }
+ real :: r4 = r4 ! { dg-error "has not been declared or is a variable" }
+end subroutine q
diff --git a/gcc/testsuite/gfortran.dg/pr66545_2.f90 b/gcc/testsuite/gfortran.dg/pr66545_2.f90
new file mode 100644
index 0000000..e15d8ba
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr66545_2.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-Wuninitialized" }
+! PR fortran/66545
+!
+program foo
+ implicit none
+ call p1
+ call q1
+end program foo
+
+subroutine p1
+ complex :: c5
+ complex :: c6
+ c5 = (c5) ! { dg-warning "used uninitialized in this" }
+ c6 = c6 ! { dg-warning "used uninitialized in this" }
+end subroutine p1
+
+subroutine q1
+ real :: r5
+ real :: r6
+ r5 = (r5) ! { dg-warning "used uninitialized in this" }
+ r6 = r6 ! { dg-warning "used uninitialized in this" }
+end subroutine q1