Summary: | gfortran: parser chokes on complex literal constant | ||
---|---|---|---|
Product: | gcc | Reporter: | Harald Anlauf <anlauf> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, reichelt |
Priority: | P2 | Keywords: | monitored, patch |
Version: | 4.0.0 | ||
Target Milestone: | 4.0.0 | ||
Host: | i686-pc-linux-gnu | Target: | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2004-10-11 20:51:07 | |
Bug Depends on: | |||
Bug Blocks: | 19292 |
Description
Harald Anlauf
2004-10-11 20:33:08 UTC
Confirmed, IFC accepts the code. 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) No, that's not sufficient. mpfr_set_str apparently doesn't like spaces in constants. The patch here http://gcc.gnu.org/ml/fortran/2004-12/msg00265.html fiexes the problem. (In reply to comment #4) > fiexes the problem. s/fiexes/fixes/ Technically illagal, so removing rejects-valid keyword. IFC is not a particularly good judge of whether code is legal ;-) 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. 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. A new path is available. http://gcc.gnu.org/ml/fortran/2005-01/msg00243.html 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 Fixed. |