-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] USE-associated explicit INTRINSIC names (#76199)
The compiler doesn't USE-associate names of intrinsic procedures from modules (in the absence of ONLY:), so that the associating scope doesn't get populated with names of intrinsics that were used only in declarations (e.g., SELECTED_REAL_KIND). A recent bug report (below) shows that we should modify that policy in the case of names that appear in explicit INTRINSIC attribute statements. The behaviors of other Fortran compilers are not consistent and the requirements of the standard are not clear; this fix follows the precedent set by gfortran and nvfortran. Fixes #72084.
- Loading branch information
Showing
5 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
! RUN: %python %S/test_errors.py %s %flang_fc1 | ||
module explicit | ||
intrinsic cos | ||
end | ||
subroutine testExplicit | ||
use explicit | ||
!ERROR: 'cos' is use-associated from module 'explicit' and cannot be re-declared | ||
real :: cos = 2. | ||
end | ||
subroutine extendsUsedIntrinsic | ||
use explicit | ||
interface cos | ||
pure real function mycos(x) | ||
real, intent(in) :: x | ||
end | ||
end interface | ||
end | ||
subroutine sameIntrinsic1 | ||
use explicit | ||
!WARNING: Use-associated 'cos' already has 'INTRINSIC' attribute | ||
intrinsic cos | ||
real :: one = cos(0.) | ||
end | ||
module renamer | ||
use explicit, renamedCos => cos | ||
end | ||
subroutine sameIntrinsic2 | ||
use explicit | ||
use renamer, cos => renamedCos | ||
real :: one = cos(0.) | ||
end | ||
module implicit | ||
real :: one = cos(0.) | ||
end | ||
subroutine testImplicit | ||
use implicit | ||
real :: cos = 2. | ||
end |