-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang][semantics] add portability warning and tests for copy-in/copy-out case #153263
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1185,6 +1185,10 @@ bool HasVectorSubscript(const ActualArgument &actual) { | |
| return expr && HasVectorSubscript(*expr); | ||
| } | ||
|
|
||
| bool IsArraySection(const Expr<SomeType> &expr) { | ||
| return expr.Rank() > 0 && IsVariable(expr) && !UnwrapWholeSymbolDataRef(expr); | ||
|
||
| } | ||
|
|
||
| // HasConstant() | ||
| struct HasConstantHelper : public AnyTraverse<HasConstantHelper, bool, | ||
| /*TraverseAssocEntityDetails=*/false> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror | ||
| program call45 | ||
| integer, target :: v(100) = [(i, i=1, 100)] | ||
| integer, pointer :: p(:) => v | ||
| !ERROR: Actual argument associated with VOLATILE dummy argument 'v=' is not definable [-Wundefinable-asynchronous-or-volatile-actual] | ||
| !BECAUSE: Variable 'v([INTEGER(8)::1_8,2_8,2_8,3_8,3_8,3_8,4_8,4_8,4_8,4_8])' has a vector subscript | ||
| call sub(v([1,2,2,3,3,3,4,4,4,4])) | ||
| !PORTABILITY: The array section 'v(21_8:30_8:1_8)' should not be associated with dummy argument 'v=' with VOLATILE attribute, unless the dummy is assumed-shape or assumed-rank [-Wportability] | ||
| call sub(v(21:30)) | ||
| !PORTABILITY: The array section 'v(21_8:40_8:2_8)' should not be associated with dummy argument 'v=' with VOLATILE attribute, unless the dummy is assumed-shape or assumed-rank [-Wportability] | ||
| call sub(v(21:40:2)) | ||
| call sub2(v(21:40:2)) | ||
| call sub4(p) | ||
| print *, v | ||
| contains | ||
| subroutine sub(v) | ||
| integer, volatile :: v(10) | ||
| v = 0 | ||
| end subroutine sub | ||
| subroutine sub1(v) | ||
| integer, volatile :: v(:) | ||
| v = 0 | ||
| end subroutine sub1 | ||
| subroutine sub2(v) | ||
| integer :: v(:) | ||
| !TODO: This should either be an portability warning or copy-in-copy-out warning | ||
| call sub(v) | ||
| call sub1(v) | ||
| end subroutine sub2 | ||
| subroutine sub3(v) | ||
| integer, pointer :: v(:) | ||
| v = 0 | ||
| end subroutine sub3 | ||
| subroutine sub4(v) | ||
| integer, pointer :: v(:) | ||
| !TODO: This should either be a portability warning or copy-in-copy-out warning | ||
| call sub(v) | ||
| call sub1(v) | ||
| call sub3(v) | ||
| end subroutine sub4 | ||
| end program call45 |
Uh oh!
There was an error while loading. Please reload this page.