Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of "stop retval" is not portable #188

Merged
merged 1 commit into from
Jul 2, 2019
Merged

Conversation

wkliao
Copy link
Contributor

@wkliao wkliao commented Jun 25, 2019

When using gfortran 4.4.7, I got compile error message below.

Making check in nf_test4
Fortran/netcdf-fortran/nf_test4/ftst_groups.F:44.72:
         if (retval .ne. nf_noerr) stop retval                          
                                                                        1
Error: Syntax error in STOP statement at (1)

Fortran stop statement: STOP [str] where str is a
string of no more that 5 digits or a character constant.

string of no more that 5 digits or a character constant
@edhartnett
Copy link
Contributor

gfortran 4.4.7 is pretty old. I am using 7.4.0.

Do we want to make this change just because of this very old fortran? I have not heard of any other problems with the stop statements.

Is it really not allowed by the fortran standard to do stop var, where var is an integer?

@wkliao
Copy link
Contributor Author

wkliao commented Jun 26, 2019

Intel Fortran, ifort, version 17.0.2 gives the following error message.

error #6345: Either a PAUSE, STOP or ERROR STOP statement has an invalid argument.   [RETVAL]
         stop retval
--------------^

NAG Fortran Compiler 6.1.

NAG Fortran Compiler Release 6.1(Tozai) Build 6120
Error: RETVAL is not permitted in a constant expression
[NAG Fortran Compiler error termination, 1 error]

@WardF
Copy link
Member

WardF commented Jul 2, 2019

Unless this causes a problem with modern gfortran, I'm for incorporating it to support ifort and NAG. Thanks!

@WardF WardF merged commit 977a0e0 into Unidata:master Jul 2, 2019
WardF added a commit that referenced this pull request Jul 2, 2019
@wkliao wkliao deleted the fortran_stop branch April 17, 2022 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants