public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant
@ 2004-10-11 20:33 anlauf at hep dot tu-darmstadt dot de
  2004-10-11 20:51 ` [Bug fortran/17941] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: anlauf at hep dot tu-darmstadt dot de @ 2004-10-11 20:33 UTC (permalink / raw)
  To: gcc-bugs

Hi,

here's another problem, this time with "legacy f90" code:

program gfcbug17
  ! gfortran cannot parse this complex constant:
  complex, parameter :: c0 = (- 0.5, -0.5)
  print *, c0
end program gfcbug17

I get:


 In file gfcbug17.f90:3

  complex, parameter :: c0 = (- 0.5, -0.5)
                                  1
Error: Expected a right parenthesis in expression at (1)


Apparently the space between the "-" and 0.5 lets the parser choke.
Can the parsing rules be relaxed to accept the above form?

Cheers,
-ha

-- 
           Summary: gfortran: parser chokes on complex literal constant
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at hep dot tu-darmstadt dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
@ 2004-10-11 20:51 ` pinskia at gcc dot gnu dot org
  2004-10-11 22:48 ` tobi at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-11 20:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-11 20:51 -------
Confirmed, IFC accepts the code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-11 20:51:07
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
  2004-10-11 20:51 ` [Bug fortran/17941] " pinskia at gcc dot gnu dot org
@ 2004-10-11 22:48 ` tobi at gcc dot gnu dot org
  2004-10-12 21:37 ` tobi at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-10-11 22:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-10-11 22:48 -------
I'm not sure if this suffices, will try tomorrow:

Index: primary.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/primary.c,v
retrieving revision 1.13
diff -u -p -r1.13 primary.c
--- primary.c   7 Oct 2004 15:12:01 -0000       1.13
+++ primary.c   11 Oct 2004 22:46:36 -0000
@@ -1028,6 +1028,13 @@ match_const_complex_part (gfc_expr ** re

   for (;; c = gfc_next_char (), count++)
     {
+      if (c == ' ')
+       {
+         if (seen_dp || seen_digits)
+           break;
+         continue;
+       }
+
       if (c == '.')
        {
          if (seen_dp)

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
  2004-10-11 20:51 ` [Bug fortran/17941] " pinskia at gcc dot gnu dot org
  2004-10-11 22:48 ` tobi at gcc dot gnu dot org
@ 2004-10-12 21:37 ` tobi at gcc dot gnu dot org
  2004-12-31  6:06 ` sgk at troutmask dot apl dot washington dot edu
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-10-12 21:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-10-12 21:37 -------
No, that's not sufficient. mpfr_set_str apparently doesn't like spaces in constants.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (2 preceding siblings ...)
  2004-10-12 21:37 ` tobi at gcc dot gnu dot org
@ 2004-12-31  6:06 ` sgk at troutmask dot apl dot washington dot edu
  2004-12-31  6:08 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2004-12-31  6:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sgk at troutmask dot apl dot washington dot edu  2004-12-31 06:06 -------
The patch here

http://gcc.gnu.org/ml/fortran/2004-12/msg00265.html

fiexes the problem.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (3 preceding siblings ...)
  2004-12-31  6:06 ` sgk at troutmask dot apl dot washington dot edu
@ 2004-12-31  6:08 ` pinskia at gcc dot gnu dot org
  2005-01-06 14:41 ` tobi at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-31  6:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-31 06:08 -------
(In reply to comment #4)
> fiexes the problem.
s/fiexes/fixes/

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (4 preceding siblings ...)
  2004-12-31  6:08 ` pinskia at gcc dot gnu dot org
@ 2005-01-06 14:41 ` tobi at gcc dot gnu dot org
  2005-01-15 11:09 ` pbrook at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-01-06 14:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |19292
              nThis|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (5 preceding siblings ...)
  2005-01-06 14:41 ` tobi at gcc dot gnu dot org
@ 2005-01-15 11:09 ` pbrook at gcc dot gnu dot org
  2005-01-15 20:34 ` sgk at troutmask dot apl dot washington dot edu
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2005-01-15 11:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pbrook at gcc dot gnu dot org  2005-01-15 11:09 -------
Technically illagal, so removing rejects-valid keyword.
IFC is not a particularly good judge of whether code is legal ;-)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (6 preceding siblings ...)
  2005-01-15 11:09 ` pbrook at gcc dot gnu dot org
@ 2005-01-15 20:34 ` sgk at troutmask dot apl dot washington dot edu
  2005-01-15 22:27 ` sgk at troutmask dot apl dot washington dot edu
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2005-01-15 20:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sgk at troutmask dot apl dot washington dot edu  2005-01-15 20:34 -------
Paul, the code is legal!  Both NAG and Lahey compile the code
without warning or error.  Apparently, IFC also compiles the
code.  I just sent you a new patch to fix the bug.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (7 preceding siblings ...)
  2005-01-15 20:34 ` sgk at troutmask dot apl dot washington dot edu
@ 2005-01-15 22:27 ` sgk at troutmask dot apl dot washington dot edu
  2005-01-22  1:33 ` sgk at troutmask dot apl dot washington dot edu
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2005-01-15 22:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sgk at troutmask dot apl dot washington dot edu  2005-01-15 22:27 -------
I started a thread on c.l.f.  The title is "whitespace in signed real literal
constants.  So far, it appears that the code is indeed standard conforming.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (8 preceding siblings ...)
  2005-01-15 22:27 ` sgk at troutmask dot apl dot washington dot edu
@ 2005-01-22  1:33 ` sgk at troutmask dot apl dot washington dot edu
  2005-01-23 22:29 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2005-01-22  1:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sgk at troutmask dot apl dot washington dot edu  2005-01-22 01:32 -------
A new path is available.

http://gcc.gnu.org/ml/fortran/2005-01/msg00243.html

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (9 preceding siblings ...)
  2005-01-22  1:33 ` sgk at troutmask dot apl dot washington dot edu
@ 2005-01-23 22:29 ` cvs-commit at gcc dot gnu dot org
  2005-01-23 22:38 ` pbrook at gcc dot gnu dot org
  2005-01-23 22:39 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-23 22:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-23 22:29 -------
Subject: Bug 17941

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pbrook@gcc.gnu.org	2005-01-23 22:29:41

Modified files:
	gcc/fortran    : ChangeLog arith.c primary.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: complex_int_1.f90 real_const_1.f 
	                           real_const_2.f90 

Log message:
	2004-01-23  Paul Brook  <paul@codesourcery.com>
	Steven G. Kargl  <kargls@comcast.net>
	
	PR fortran/17941
	* arith.c (gfc_convert_real): Remove sign handling.
	* primary.c (match_digits): Allow whitespace after initial sign.
	(match_real_const): Handle signs here.  Allow whitespace after
	initial sign.  Remove dead code.
	(match_const_complex_part): Remove.
	(match_complex_part): Use match_{real,integer}_const.
	(match_complex_constant): Cross-promote integer types.
	testsuite/
	* gfortran.dg/real_const_1.f: New test.
	* gfortran.dg/real_const_2.f90: New test.
	* gfortran.dg/complex_int_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.312&r2=1.313
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/arith.c.diff?cvsroot=gcc&r1=1.20&r2=1.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/primary.c.diff?cvsroot=gcc&r1=1.17&r2=1.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4927&r2=1.4928
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/complex_int_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/real_const_1.f.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/real_const_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (10 preceding siblings ...)
  2005-01-23 22:29 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-23 22:38 ` pbrook at gcc dot gnu dot org
  2005-01-23 22:39 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2005-01-23 22:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pbrook at gcc dot gnu dot org  2005-01-23 22:38 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/17941] gfortran: parser chokes on complex literal constant
  2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
                   ` (11 preceding siblings ...)
  2005-01-23 22:38 ` pbrook at gcc dot gnu dot org
@ 2005-01-23 22:39 ` pinskia at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-23 22:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17941


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-01-23 22:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 20:33 [Bug fortran/17941] New: gfortran: parser chokes on complex literal constant anlauf at hep dot tu-darmstadt dot de
2004-10-11 20:51 ` [Bug fortran/17941] " pinskia at gcc dot gnu dot org
2004-10-11 22:48 ` tobi at gcc dot gnu dot org
2004-10-12 21:37 ` tobi at gcc dot gnu dot org
2004-12-31  6:06 ` sgk at troutmask dot apl dot washington dot edu
2004-12-31  6:08 ` pinskia at gcc dot gnu dot org
2005-01-06 14:41 ` tobi at gcc dot gnu dot org
2005-01-15 11:09 ` pbrook at gcc dot gnu dot org
2005-01-15 20:34 ` sgk at troutmask dot apl dot washington dot edu
2005-01-15 22:27 ` sgk at troutmask dot apl dot washington dot edu
2005-01-22  1:33 ` sgk at troutmask dot apl dot washington dot edu
2005-01-23 22:29 ` cvs-commit at gcc dot gnu dot org
2005-01-23 22:38 ` pbrook at gcc dot gnu dot org
2005-01-23 22:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).