-
Notifications
You must be signed in to change notification settings - Fork 137
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
[from discourse] Wrong understanding of the rules for lbound and ubound for non-pointer dummy arguments #1435
Comments
@wanbinchen-hnc Would you be able to take a look at this issue? |
IMHO, this difference is an undefined behavior. In addition, as mentioned in paragraph 3 of section 7.2.1.3 of the Fortran 2008 standard,
gfortran outputs: 1 1 11 4 11 4 |
Eventually, we'd contacted the Fortran committee and the response was that there is no undefined behaviour here, quite contrary, the behavior is well-defined as per J3/10-007r1 (Fortran 2008). The subclause 7.2.1.3 paragraph 3 states the array is allocated with o if /expr/ is an array, the shape of the /expr/ with each lower bound equal to the corresponding element of LBOUND(/expr/). The subclause 13.7.90 (LBOUND) says that in this case, the lower bounds have the value 1. |
@pawosm-arm Section 13.7.90 on
Could you explain why, in the example programs above, |
There is a comment from Robert Corbett on this issue. https://mailman.j3-fortran.org/pipermail/j3/2024-July/014788.html |
@shivaramaarao Thanks for the link! That clears it up really well. |
@wanbinchen-hnc Do you have any time to consider this issue? |
This issue was signaled on discourse as such: https://fortran-lang.discourse.group/t/an-interesting-difference-between-compilers/7131
There is also a reproducer initially written for AOCC, but since AOCC is based on classic flang, it can also be reproduced with it:
Note that the most recent changes to LBOUND/UBOUND in classic flang did not improve the reported behavior.
The text was updated successfully, but these errors were encountered: