![]() ![]() TYPE(neuts_type), INTENT(INOUT) :: neuts_out Note that this is cut down version of the full production code just to illustrate the problem MODULE mod1 The following example illustrates the problem. We have discovered an error which only occurs in optimised (-O2) code. I would think that since the compiler knows the size of array p in sub2, it should put it on the stack, given the chosen options at compile time. So, my question is, why is the second subroutine not producing a stack overflow? I've tried using ifort 16.0.8 and 14.0.4 with similar results. However, compiling with ifort using three different flags:Īll three executables produce the output: The compiler does not know the size of the array in sub1, so it allocates it to the heap. I'm attempting to understand stack overflows brought about by large statically-sized local arrays using ifort on linux. I hoped to produce a stack overflow error by reducing the stack size to 1000kb using "ulimit -s 1000" and then running a test program included below.įor reference, I compiled this program with gfortran using a variety of options and was given an output: Note a normal result with the version 17. There seems to be something bad in interprocedural optimization with an inter dependency of two structures separated in two source files (primvar derivedtype rot and invrot operators depend on the derived type vec2d rot and invrot operators) ifort -versionĬopyright (C) 1985-2018 Intel Corporation. Generic :: operator(.invrot.) => invrot_primvarĮLEMENTAL SUBROUTINE equal_primvar( self, from )ĮLEMENTAL FUNCTION rot_primvar( self, normal ) RESULT( this )ĮLEMENTAL FUNCTION invrot_primvar( self, normal ) RESULT( this )Īt execution, the vector part of my primvar structure is set to zero ! whereas normal result is produced without ipo compilation option as with gfortran with or without lfto compilation option Generic :: operator(.rot.) => rot_primvar Generic :: assignment(=) => equal_primvar Procedure, pass( self ) :: invrot_primvar ![]() Generic :: operator(.invrot.) => invrot_vec2dĮLEMENTAL SUBROUTINE equal_vec2d( self, from )ĮLEMENTAL FUNCTION rot_vec2d( self, n ) RESULT( this )ĮLEMENTAL FUNCTION invrot_vec2d( self, n ) RESULT( this ) I found a possible big bug in ipo optimzation using "sophisticated" derived type with generic-type bound procedures ![]()
0 Comments
Leave a Reply. |