* Re: Behaviour with -fcheck=all
@ 2018-04-21 13:01 Dominique d'Humières
0 siblings, 0 replies; 2+ messages in thread
From: Dominique d'Humières @ 2018-04-21 13:01 UTC (permalink / raw)
To: filippone.salvatore; +Cc: gfortran
Hi Salvatore,
> Consider the attached code. …
This is pr52162. If you want it for older revisions you can try to apply the patch for trans-expr.c at revisions r256607.
Cheers,
Dominique
^ permalink raw reply [flat|nested] 2+ messages in thread
* Behaviour with -fcheck=all
@ 2018-04-19 14:48 Salvatore Filippone
0 siblings, 0 replies; 2+ messages in thread
From: Salvatore Filippone @ 2018-04-19 14:48 UTC (permalink / raw)
To: Fortran List
[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]
Hello everybody
Consider the attached code. At line 11 we do have both allocation on
assignment and KIND conversion; my reading of the standard is that
this is allowed. And indeed if I compile with "normal" options I do
get the expected output.
However, if I compile with -fcheck=all, the runtime throws me an error
with 6.3 and 7.3, but works with 8.0. I did not find anything obivious
in bugzilla, the closest thing I can see is PR67430 but there is no
intrinsic vs defined assignment here.
Feel free to add to the test suite if appropriate; in the meantime
I'll be forced to do some defensive programming, since so much of my
code has to run on platforms down to GCC version 4.9, and I suppose
that even in the best circumstances, whatever fixed this in 8 will not
be backported that far.
Cheers
Salvatore
====================================
[sfilippo@localhost NewMixedI8]$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/gnu/7.3.0/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.3.0/configure --prefix=/opt/gnu/7.3.0
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 7.3.0 (GCC)
[sfilippo@localhost NewMixedI8]$ gfortran -o try_vassign try_vassign.f90
[sfilippo@localhost NewMixedI8]$ ./try_vassign
5 6 7
8
-4 6 7
8
[sfilippo@localhost NewMixedI8]$ gfortran -o try_vassign
try_vassign.f90 -ggdb -O0 -fcheck=all -fbacktrace
[sfilippo@localhost NewMixedI8]$ ./try_vassign
5 6 7
8
At line 11 of file try_vassign.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'w' (0/4)
Error termination. Backtrace:
#0 0x400b35 in __foobar_mod_MOD_foo
at /home/sfilippo/NUMERICAL/PSBLAS/GitHub/NewMixedI8/try_vassign.f90:11
#1 0x4013c6 in try
at /home/sfilippo/NUMERICAL/PSBLAS/GitHub/NewMixedI8/try_vassign.f90:28
#2 0x401474 in main
at /home/sfilippo/NUMERICAL/PSBLAS/GitHub/NewMixedI8/try_vassign.f90:22
[sfilippo@localhost NewMixedI8]$ module load gnu/8.0.0
gnu/8.0.0 - loads the GNU 8.0.0 compilers suite
Version 8.0.0
[sfilippo@localhost NewMixedI8]$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/gnu/8.0.0/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gnu/8.0.0
--enable-languages=c,c++,fortran,lto --no-create --no-recursion
Thread model: posix
gcc version 8.0.1 20180228 (experimental) (GCC)
[sfilippo@localhost NewMixedI8]$ gfortran -o try_vassign
try_vassign.f90 -ggdb -O0 -fcheck=all -fbacktrace
[sfilippo@localhost NewMixedI8]$ ./try_vassign
5 6 7
8
-4 6 7
8
==================================================
[-- Attachment #2: try_vassign.f90 --]
[-- Type: text/x-fortran, Size: 543 bytes --]
module foobar_mod
contains
subroutine foo(x)
use iso_fortran_env
implicit none
integer(int64), allocatable, intent(inout) :: x(:)
integer(int32), allocatable :: w(:)
if (allocated(x)) then
w = x
if (size(w) > 0) then
w(1) = 1 - w(1)
end if
x = w
end if
end subroutine foo
end module foobar_mod
program try
use iso_fortran_env
use foobar_mod
integer(int64), allocatable :: v(:)
v = (/5,6,7,8/)
write(*,*) v
call foo(v)
write(*,*) v
end program try
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-21 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-21 13:01 Behaviour with -fcheck=all Dominique d'Humières
-- strict thread matches above, loose matches on Subject: below --
2018-04-19 14:48 Salvatore Filippone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).