Bug 31466 - spurious error message when inner parentheses of a FORMAT statement are empty
Summary: spurious error message when inner parentheses of a FORMAT statement are empty
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-03 19:04 UTC by Michael Richmond
Modified: 2007-04-07 16:54 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Richmond 2007-04-03 19:04:14 UTC
When I compile the program listed below I receive a spurious error message:

test134.f90:2.11:

1 FORMAT(())
          1
Error: Unexpected element in format string at (1)

PROGRAM test134
1 FORMAT(())
END
Comment 1 Tobias Burnus 2007-04-03 21:58:46 UTC
I believe this bug is invalid as the format string is invalid.

NAG f95 also claims:
*** Malformed format specification

Reasoning:
R1001 format-stmt is FORMAT format-specification
R1002 format-specification is ( [ format-item-list ] )

Thus the question is whether "()" is a valid format-item(-list).

R1003 format-item is [ r ] data-edit-desc
                  or control-edit-desc
                  or char-string-edit-desc
                  or [ r ] ( format-item-list )
R1004 r is int-literal-constant

I would claim that "()" is not
- a data-edit-desc
- a char-string-edit-desc

It matches however, "( format-item-list )", but then I would claim that "" is not:
- a data-edit-desc
- a char-string-edit-desc
- ( format-item-list )
Comment 2 Jerry DeLisle 2007-04-04 00:28:31 UTC
Lahey reports this as a fatal syntax error.

Checking file SOURCE.F90.
Checking program unit TEST134 at line 1.
Line 2, file SOURCE.F90
1 FORMAT(())
|         |
FATAL -- Essential LF90 requires that defined labels be referenced.
FATAL -- Syntax error.
Comment 3 Tobias Schlüter 2007-04-07 16:54:21 UTC
I verified Tobias' reading of the standard.  Closing as invalid.  Perhaps the error message could be more helpful.