Bug 24285 - [4.2 only] format(1000(a,$))
Summary: [4.2 only] format(1000(a,$))
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.1
: P2 enhancement
Target Milestone: 4.2.0
Assignee: Francois-Xavier Coudert
URL:
Keywords: patch
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-10-09 13:27 UTC by Debian GCC Maintainers
Modified: 2006-11-24 22:27 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-10-29 13:42:24


Attachments
Patch fixing this PR (585 bytes, patch)
2006-11-17 21:09 UTC, Francois-Xavier Coudert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2005-10-09 13:27:23 UTC
[forwarded from http://bugs.debian.org/324600]

Bug submitter writes:

I had no compilation problems with g77.

300   format( 1000(a,$))
                      1
Error: $ must the last specifier in format string at (1)

301   format(/1000(a,$))

Error: $ must the last specifier in format string at (1)

If it is really a code problem what would be the correct syntax?

Reply from FX Coudert:

g77 documentation states:

"A dollar sign at the end of an output format specification suppresses 
the newline at the end of the output."

Since this (a $ as format specifier) is an extension, there is nothing 
in the standard against this. On the other hand, all the compilers I 
have at hand accept this, so I think we might as well remove this contraint.

I think this can be reported as a bug.
Comment 1 Francois-Xavier Coudert 2005-10-29 13:42:24 UTC
Confirmed. I'm working on this and related problems in io.c.
Comment 2 Alex Galakhov 2005-11-18 10:19:41 UTC
Exactly the same bug has been fixed about a year ago in g95. You may want to borrow some of its code.
Comment 3 kargl 2005-11-18 17:44:59 UTC
(In reply to comment #2)
> Exactly the same bug has been fixed about a year ago in g95. You may want to
> borrow some of its code.
> 

gfortran and g95 have diverged to the point that code in g95
is irrelevant.  You, of course, can prove me wrong if you 
want to try porting g95 code to gfortran.
Comment 4 Steven Bosscher 2006-07-09 10:29:08 UTC
FX, are you working on this problem?
Comment 5 Francois-Xavier Coudert 2006-07-09 20:49:30 UTC
(In reply to comment #4)
> FX, are you working on this problem?

No, I'm not working on it any more.
Comment 6 Francois-Xavier Coudert 2006-11-17 21:09:06 UTC
Created attachment 12633 [details]
Patch fixing this PR

This patch allows $ at other places than the end of the format, and makes gfortran issue a warning in that case.
Comment 7 Francois-Xavier Coudert 2006-11-18 12:17:06 UTC
Subject: Bug 24285

Author: fxcoudert
Date: Sat Nov 18 12:16:42 2006
New Revision: 118971

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118971
Log:
	PR fortran/24285

	* io.c (check_format): Allow dollars everywhere in format, and
	issue a warning.

	* gfortran.dg/dollar_edit_descriptor-3.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/dollar_edit_descriptor-3.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog

Comment 8 Francois-Xavier Coudert 2006-11-18 12:19:09 UTC
Fixed on 4.3, and I'll backport it to 4.2 after some time.
Comment 9 Francois-Xavier Coudert 2006-11-24 22:25:52 UTC
Subject: Bug 24285

Author: fxcoudert
Date: Fri Nov 24 22:25:34 2006
New Revision: 119174

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119174
Log:
	PR fortran/29391
	PR fortran/29489
	* simplify.c (simplify_bound): Fix the simplification of
	LBOUND/UBOUND intrinsics.
	* trans-intrinsic.c (simplify_bound): Fix the logic, and
	remove an erroneous assert.
	* gfortran.dg/bound_2.f90: New test.
	* gfortran.dg/bound_3.f90: New test.

	PR fortran/24285
	* io.c (check_format): Allow dollars everywhere in format, and
	issue a warning.
	* gfortran.dg/dollar_edit_descriptor-3.f: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/dollar_edit_descriptor-3.f
      - copied unchanged from r118971, trunk/gcc/testsuite/gfortran.dg/dollar_edit_descriptor-3.f
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/io.c
    branches/gcc-4_2-branch/gcc/fortran/simplify.c
    branches/gcc-4_2-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/bound_2.f90

Comment 10 Francois-Xavier Coudert 2006-11-24 22:27:12 UTC
Fixed on 4.2 also.