Bug 39555 - concat-op not allowed in STOP
Summary: concat-op not allowed in STOP
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2009-03-25 18:27 UTC by Daniel Franke
Modified: 2010-05-23 14:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-28 13:37:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Franke 2009-03-25 18:27:27 UTC
The following is illegal (only digits or a character constant can follow STOP):

$> cat stop.f90
  STOP "a" // "constant"
END

$> gfortran-svn stop.f90 && ./a.out
STOP aconstant

gcc version 4.4.0 20090324 (experimental) (GCC)
Comment 1 Tobias Burnus 2009-03-27 23:28:02 UTC
I think it is allowed in Fortran 2008 (could also be F2003 - I don't recall). Since that Fortran version also "STOP <integer-expression>" is allowed.
Comment 2 kargls 2009-03-28 03:40:35 UTC
(In reply to comment #1)
> I think it is allowed in Fortran 2008 (could also be F2003 - I don't recall).
> Since that Fortran version also "STOP <integer-expression>" is allowed.
> 

It is not allowed in F2003.

8.4  STOP statement
R849 stop-stmt      is STOP [ stop-code ]
R850 stop-code      is scalar-char-constant
                    or digit [ digit [ digit [ digit [ digit ] ] ] ]

The pdf I have marked as F2008 also contains the above text.
Comment 3 Francois-Xavier Coudert 2009-03-28 13:37:28 UTC
(In reply to comment #2)
> It is not allowed in F2003.
> 
> 8.4  STOP statement
> R849 stop-stmt      is STOP [ stop-code ]
> R850 stop-code      is scalar-char-constant
>                     or digit [ digit [ digit [ digit [ digit ] ] ] ]

I agree with you for F2003. For F2008, however, the draft I have (08-007r1:2008/02/19) says:

R855    stop-stmt is STOP [ stop-code ]
R857    stop-code is scalar-char-initialization-expr
                                or scalar-int-initialization-expr
Comment 4 Tobias Burnus 2010-05-23 10:20:45 UTC
Now that PR 43851 has been fixed, can we close this PR as WONTFIX?

[Checking the constraints for -std=f2003 is quite difficult - as it turned out - and Fortran 2008 allows any constant expression (= 'initialization expression' in F2003 lingo).]
Comment 5 Jerry DeLisle 2010-05-23 14:46:09 UTC
yes, lets close