http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52921
Bug #: 52921 Summary: Memory errors when compiled with -fstrict-overflow flag Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: alipasha.cele...@gmail.com The following test code generates memory errors (valgrind : "Conditional jump or move depends on uninitialised value(s)") when assigning the values to %CMP components without allocating it first, if it is compiled with flag -fstrict-overflow. PROGRAM QUICK_TEST TYPE COMP INTEGER, ALLOCATABLE :: CMP(:) END TYPE COMP TYPE COMP_ARRAY TYPE (COMP), ALLOCATABLE :: ARR(:) END TYPE COMP_ARRAY INTEGER :: I TYPE (COMP_ARRAY), TARGET :: MY_ARR READ *, I ALLOCATE (MY_ARR%ARR(I)) MY_ARR%ARR(I)%CMP = [1, 2] END PROGRAM QUICK_TEST However, if "READ *, I" is replaced with "I = 10", i.e. allocation size and the array index are known at compile time, then no memory errors are generated. Furthermore, this flag is included in -O3 optimization flag, but it is not shown when compiling with -Q --help=optimizers .