| Issue |
172869
|
| Summary |
[flang] Reduce printout for unsuccessful usage of generic
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
foxtran
|
For such code,
```fortran
module test
type :: q
end type q
interface f
module procedure f_i8, f_r8, f_r4
module procedure f_i8_2, f_r8_2, f_r4_2, f_q_2
end interface
contains
subroutine f_i8(a)
integer(8) :: a
end subroutine f_i8
subroutine f_r8(a)
real(8) :: a
end subroutine f_r8
subroutine f_r4(a)
real(4) :: a
end subroutine f_r4
subroutine f_i8_2(a,b)
integer(8) :: a,b
end subroutine f_i8_2
subroutine f_r8_2(a,b)
real(8) :: a,b
end subroutine f_r8_2
subroutine f_r4_2(a,b)
real(4) :: a,b
end subroutine f_r4_2
subroutine f_q_2(a,b)
type(q) :: a,b
end subroutine f_q_2
end module test
subroutine qp
use test
call f(1_4,1_4)
end subroutine qp
```
current flang gives a lot of errors:
```
error: Semantic errors in /app/example.f90
/app/example.f90:34:3: error: No specific subroutine of generic 'f' matches the actual arguments
call f(1_4,1_4)
^^^^^^^^^^^^^^^
/app/example.f90:9:14: Specific procedure 'f_i8' does not match the actual arguments because
subroutine f_i8(a)
^^^^
/app/example.f90:34:3: Too many actual arguments (2) passed to procedure that expects only 1
call f(1_4,1_4)
^^^^^^^^^^^^^^^
/app/example.f90:12:14: Specific procedure 'f_r8' does not match the actual arguments because
subroutine f_r8(a)
^^^^
/app/example.f90:34:3: Too many actual arguments (2) passed to procedure that expects only 1
call f(1_4,1_4)
^^^^^^^^^^^^^^^
/app/example.f90:15:14: Specific procedure 'f_r4' does not match the actual arguments because
subroutine f_r4(a)
^^^^
/app/example.f90:34:3: Too many actual arguments (2) passed to procedure that expects only 1
call f(1_4,1_4)
^^^^^^^^^^^^^^^
/app/example.f90:18:14: Specific procedure 'f_i8_2' does not match the actual arguments because
subroutine f_i8_2(a,b)
^^^^^^
/app/example.f90:34:10: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'INTEGER(8)'
call f(1_4,1_4)
^^^
/app/example.f90:34:14: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'INTEGER(8)'
call f(1_4,1_4)
^^^
/app/example.f90:21:14: Specific procedure 'f_r8_2' does not match the actual arguments because
subroutine f_r8_2(a,b)
^^^^^^
/app/example.f90:34:10: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'REAL(8)'
call f(1_4,1_4)
^^^
/app/example.f90:34:14: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'REAL(8)'
call f(1_4,1_4)
^^^
/app/example.f90:24:14: Specific procedure 'f_r4_2' does not match the actual arguments because
subroutine f_r4_2(a,b)
^^^^^^
/app/example.f90:34:10: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'REAL(4)'
call f(1_4,1_4)
^^^
/app/example.f90:34:14: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'REAL(4)'
call f(1_4,1_4)
^^^
/app/example.f90:27:14: Specific procedure 'f_q_2' does not match the actual arguments because
subroutine f_q_2(a,b)
^^^^^
/app/example.f90:34:10: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'q'
call f(1_4,1_4)
^^^
/app/example.f90:34:14: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'q'
call f(1_4,1_4)
^^^
```
See an example here: https://godbolt.org/z/Pb8ahxYP9
It would be nice to give a shorter version for this case, maybe something like:
```
/app/example.f90:34:3: error: No specific subroutine of generic 'f' matches the actual arguments with signature f(INTEGER(4), INTEGER(4))
call f(1_4,1_4)
^^^^^^^^^^^^^^^
/app/example.f90:34:3: because: it does not match to any of:
f(INTEGER(8))
f(INTEGER(8), INTEGER(8))
f(REAL(8))
f(REAL(8), REAL(8))
f(TYPE(q), TYPE(q))
...
```
That is more clear to see, what is actually wrong.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs