From e227ac577f38755f5852702025eb6d504d051880 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Mon, 2 Oct 2006 11:21:45 +0200 Subject: [PATCH] re PR fortran/29210 ([4.1 only] Name parameter in complex constant not allowed in F95) 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. * gfortran.dg/complex_parameter_1.f90: New test. From-SVN: r117368 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/primary.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/complex_parameter_1.f90 | 10 ++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/complex_parameter_1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ff1f55ed2ef7..e574f1869444 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2006-10-02 Francois-Xavier Coudert + + 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 * gfortran.texi: Corrected references to MALLOC intrinsic. diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 6f61ad749ea4..7adc9082515a 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3efeac11f40..b4c70d2df5c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-10-02 Francois-Xavier Coudert + + PR fortran/29210 + * gfortran.dg/complex_parameter_1.f90: New test. + 2006-10-02 Jakub Jelinek 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 index 000000000000..7b631a6cc732 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/complex_parameter_1.f90 @@ -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 -- 2.47.2