Home Neural Network The way to catch detection of project on non-allocated array?

The way to catch detection of project on non-allocated array?

0
The way to catch detection of project on non-allocated array?

[ad_1]

Hello,

I came upon that ifort (ifx as nicely) allow the next code to run efficiently:

 

 

module check
implicit none
logical, allocatable :: array(:)
finish module

program primary
use check
implicit none
logical :: x

x = .false.
array(:) = x
print *, ‘hi there’
finish program

 

 

Whereas GNU gfortran will segfault since array has not been allotted. Which appears to me to be the suitable habits because it allows catching a bug within the code.

 

I attempted utilizing the flags “-check all -warn all” however the code nonetheless runs prompting “hi there”.

 

Is there one thing else that I may use to power the compiler to catch that I am doing an project on an uninitialized array?

 

Right here a compiler explorer hyperlink with this minimal code: https://godbolt.org/z/4MdEc8do5

 

Thanks,



[ad_2]