Bug 29210 - [4.1 only] Name parameter in complex constant not allowed in F95
Summary: [4.1 only] Name parameter in complex constant not allowed in F95
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 minor
Target Milestone: 4.2.0
Assignee: Francois-Xavier Coudert
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2006-09-25 09:13 UTC by Francois-Xavier Coudert
Modified: 2006-10-13 08:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0
Known to fail: 4.1.2
Last reconfirmed: 2006-10-02 07:34:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2006-09-25 09:13:10 UTC
The following code is legal F2003 but I believe it's not legal F95. It should be diagnosed as such.

$ cat a.f90 
  real,parameter :: foo = 1.7
  complex,parameter :: bar = (foo, foo)
  end
Comment 1 Francois-Xavier Coudert 2006-10-02 07:34:51 UTC
I'll do it.
Comment 2 Francois-Xavier Coudert 2006-10-02 08:11:06 UTC
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c       (revision 116798)
+++ gcc/fortran/primary.c       (working copy)
@@ -1084,6 +1084,10 @@
       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:
Comment 3 Francois-Xavier Coudert 2006-10-02 09:21:56 UTC
Subject: Bug 29210

Author: fxcoudert
Date: Mon Oct  2 09:21:45 2006
New Revision: 117368

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117368
Log:
	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.

Added:
    trunk/gcc/testsuite/gfortran.dg/complex_parameter_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Francois-Xavier Coudert 2006-10-13 08:33:43 UTC
Not worth a backport. Closing as fixed.