[Bug fortran/91390] treatment of extra parameter in a subroutine call
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Aug 18 09:47:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91390
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tschwinge at gcc dot gnu.org
--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I'm currently working on this... finding a lot of interesting
cases in the test suite, in particular one where I am not sure
what to do.
The test case is gfortran.dg/goacc/acc_on_device-1.f95 , and the code is
! Have to enable optimizations, as otherwise builtins won't be expanded.
! { dg-additional-options "-O -fdump-rtl-expand" }
logical function f ()
implicit none
external acc_on_device
logical (4) acc_on_device
f = .false.
f = f .or. acc_on_device ()
f = f .or. acc_on_device (1, 2)
f = f .or. acc_on_device (3.14)
f = f .or. acc_on_device ("hello")
return
end function f
! Unsuitable to be handled as a builtin, so we're expecting four calls.
! { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 4
"expand" } }
With my current patch, this would result in
/home/ig25/Gcc/trunk/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95:12:12:
11 | f = f .or. acc_on_device ()
| 2
12 | f = f .or. acc_on_device (1, 2)
| 1
Error: More actual than formal arguments in procedure call at (1) for procedure
defined at (2)
/home/ig25/Gcc/trunk/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95:13:12:
11 | f = f .or. acc_on_device ()
| 2
12 | f = f .or. acc_on_device (1, 2)
13 | f = f .or. acc_on_device (3.14)
| 1
Error: More actual than formal arguments in procedure call at (1) for procedure
defined at (2)
/home/ig25/Gcc/trunk/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95:14:12:
11 | f = f .or. acc_on_device ()
| 2
......
14 | f = f .or. acc_on_device ("hello")
| 1
Error: More actual than formal arguments in procedure call at (1) for procedure
defined at (2)
where the warnings could be mitigated to a warning using -std=legacy.
Now, needless to say, this is illegal Fortran. Is the test case actually
a valid use case? Wouldn't it be better to make this into an intrinsic
with -fopenacc? Would it be acceptable to have to set -std=legacy on that
particular use case?
More information about the Gcc-bugs
mailing list