-
Notifications
You must be signed in to change notification settings - Fork 138
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
[F03] bogus error: Could not resolve generic type bound procedure #533 #849
Open
kiranktp
wants to merge
5
commits into
flang-compiler:master
Choose a base branch
from
kiranktp:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6aa81f7
[F03] bogus error: Could not resolve generic type bound procedure #533
kiranktp 17c072e
Updated with correct license
kiranktp 6244084
Removed unwanted lines
kiranktp f43ed48
Incorporated review comments
kiranktp e491503
Updated the test case
kiranktp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
|
||
########## Make rule to test type-bound procedures ######## | ||
|
||
fcheck.o check_mod.mod: $(SRC)/check_mod.f90 | ||
-$(FC) -c $(FFLAGS) $(SRC)/check_mod.f90 -o fcheck.o | ||
|
||
tbp.o: $(SRC)/tbp.f90 check_mod.mod | ||
@echo ------------------------------------ building test $@ | ||
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/tbp.f90 -o tbp.o | ||
|
||
tbp: tbp.o fcheck.o | ||
-$(FC) $(FFLAGS) $(LDFLAGS) tbp.o fcheck.o $(LIBS) -o tbp | ||
|
||
tbp.run: tbp | ||
@echo ------------------------------------ executing test tbp | ||
tbp | ||
-$(RM) test_m.mod | ||
|
||
### TA Expected Targets ### | ||
|
||
build: $(TEST) | ||
|
||
.PHONY: run | ||
run: $(TEST).run | ||
|
||
verify: ; | ||
|
||
### End of Expected Targets ### |
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,9 @@ | ||
# | ||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
|
||
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t | ||
# RUN: cat %t | FileCheck %S/runmake |
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,111 @@ | ||
! | ||
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
! See https://llvm.org/LICENSE.txt for license information. | ||
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
! | ||
|
||
|
||
module test_m | ||
implicit none | ||
|
||
type A_t | ||
contains | ||
! Case 1: | ||
procedure :: f_none | ||
procedure ,nopass :: f_int | ||
procedure :: f_real | ||
generic :: f => f_none, f_int, f_real | ||
! Case 2: | ||
procedure , nopass :: f_none1 | ||
procedure :: f_int1 | ||
procedure ,nopass :: f_real1 | ||
generic :: f1 => f_none1, f_int1, f_real1 | ||
! Case 3: | ||
procedure ,nopass:: f_int2 | ||
procedure ,nopass :: f_real2 | ||
generic :: f2 => f_int2, f_real2 | ||
! Case 4: | ||
procedure :: f_int3 | ||
procedure :: f_real3 | ||
generic :: f3 => f_int3, f_real3 | ||
endtype | ||
|
||
contains | ||
! Case 1: | ||
integer function f_none( me ) result (RSLT) | ||
class(A_t) :: me | ||
RSLT = 1 | ||
end function f_none | ||
integer function f_int( n ) result (RSLT) | ||
integer :: n | ||
RSLT = n - 1 | ||
end function f_int | ||
real function f_real( me, x ) result (RSLT) | ||
class(A_t) :: me | ||
real :: x | ||
RSLT = x + 1 | ||
end function f_real | ||
|
||
! Case 2: | ||
integer function f_none1() result (RSLT) | ||
RSLT = 2 | ||
end function f_none1 | ||
integer function f_int1( me, n ) result (RSLT) | ||
class(A_t) :: me | ||
integer :: n | ||
RSLT = n - 1 | ||
end function f_int1 | ||
real function f_real1( x ) result (RSLT) | ||
real :: x | ||
RSLT = x + 1 | ||
end function f_real1 | ||
|
||
! Case 3: | ||
integer function f_int2( n ) result (RSLT) | ||
integer :: n | ||
RSLT = n - 1 | ||
end function f_int2 | ||
real function f_real2( x ) result (RSLT) | ||
real :: x | ||
RSLT = x + 1 | ||
end function f_real2 | ||
|
||
! Case 3: | ||
integer function f_int3( me, n ) result (RSLT) | ||
class(A_t) :: me | ||
integer :: n | ||
RSLT = n - 1 | ||
end function f_int3 | ||
real function f_real3( me, x ) result (RSLT) | ||
class(A_t) :: me | ||
real :: x | ||
RSLT = x + 1 | ||
end function f_real3 | ||
end module | ||
|
||
program main | ||
USE CHECK_MOD | ||
use test_m | ||
implicit none | ||
type(A_t) :: A | ||
logical results(10) | ||
logical expect(10) | ||
|
||
results = .false. | ||
expect = .true. | ||
|
||
results(1) = 9 .eq. A%f(10) | ||
results(2) = 99 .eq. A%f1(100) | ||
results(3) = 999 .eq. A%f2(1000) | ||
results(4) = 9999 .eq. A%f3(10000) | ||
|
||
results(5) = 11.1 .eq. A%f(10.1) | ||
results(6) = 101.1 .eq. A%f1(100.1) | ||
results(7) = 1001.1 .eq. A%f2(1000.1) | ||
results(8) = 10001.1 .eq. A%f3(10000.1) | ||
|
||
results(9) = 1 .eq. A%f() | ||
results(10) = 2 .eq. A%f1() | ||
|
||
call check(results,expect,10) | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you call the real ones also through the generic name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had fogotten to add a check for functions without any parameter. I will add them too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was pointing out that you are calling only the integer ones. Call the real ones also in the test for completeness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops sorry, my bad. Sure I will add the check for real type as well.