Behaviour with -fcheck=all

Salvatore Filippone filippone.salvatore@gmail.com
Thu Apr 19 14:48:00 GMT 2018


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

==================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try_vassign.f90
Type: text/x-fortran
Size: 543 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180419/fd4b5d66/attachment.bin>


More information about the Fortran mailing list