OSDN Git Service

PR fortran/29210
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 Oct 2006 09:21:45 +0000 (09:21 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 Oct 2006 09:21:45 +0000 (09:21 +0000)
* primary.c (match_sym_complex_part): Named constants as real or
imaginary part of complex a named constant are only allowed in
Fortran 2003.

* gfortran.dg/complex_parameter_1.f90: New test.

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

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

index ff1f55e..e574f18 100644 (file)
@@ -1,3 +1,10 @@
+2006-10-02  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/29210
+       * primary.c (match_sym_complex_part): Named constants as real or
+       imaginary part of complex a named constant are only allowed in
+       Fortran 2003.
+
 2006-10-01  Brooks Moses  <bmoses@stanford.edu>
 
        * gfortran.texi: Corrected references to MALLOC intrinsic.
index 6f61ad7..7adc908 100644 (file)
@@ -1084,6 +1084,10 @@ match_sym_complex_part (gfc_expr ** result)
       return MATCH_ERROR;
     }
 
+  if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PARAMETER symbol in "
+                     "complex constant at %C") == FAILURE)
+    return MATCH_ERROR;
+
   switch (sym->value->ts.type)
     {
     case BT_REAL:
index c3efeac..b4c70d2 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-02  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/29210
+       * gfortran.dg/complex_parameter_1.f90: New test.
+
 2006-10-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/29154
diff --git a/gcc/testsuite/gfortran.dg/complex_parameter_1.f90 b/gcc/testsuite/gfortran.dg/complex_parameter_1.f90
new file mode 100644 (file)
index 0000000..7b631a6
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+  integer,parameter :: i = 42
+  real,parameter :: x = 17.
+  complex,parameter :: z = (1.,2.)
+  complex,parameter :: c1 = (i, 0.5) ! { dg-error "Fortran 2003: PARAMETER symbol in complex constant" }
+  complex,parameter :: c2 = (x, 0.5) ! { dg-error "Fortran 2003: PARAMETER symbol in complex constant" }
+  complex,parameter :: c3 = (z, 0.) ! { dg-error "Fortran 2003: PARAMETER symbol in complex constant" }
+  print *, c1, c2, c3
+  end