https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67939
Bug ID: 67939 Summary: ICE on using data with negative substring range Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gerhard.steinmetz.fort...@t-online.de Target Milestone: --- Depending on compiler options the following codes show different reactions (sometimes with hanging process). Depending on environment settings too (e.g. $LANG, $LC_ALL). All suffer from a negative substring-range (length < -1). $ cat z1.f90 program p character(100) :: x data x(998:99) /'ab'/ end $ cat z2.f90 program p character(2) :: x data x(:-1) /'ab'/ end $ gfortran -c z1.f90 z1.f90:3:20: data x(998:99) /'ab'/ 1 Warning: Initialization string starting at (1) was truncated to fit the variable (-898/2) f951: internal compiler error: Segmentation fault $ gfortran -c z2.f90 z2.f90:3:17: data x(:-1) /'ab'/ 1 Warning: Initialization string starting at (1) was truncated to fit the variable (-1/2) *** Error in `/usr/lib64/gcc/x86_64-suse-linux/5/f951': malloc(): memory corruption (fast): 0x0000000001c03420 *** $ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize -c z2.f90 z2.f90:3:17: data x(:-1) /'ab'/ 1 Warning: Initialization string starting at (1) was truncated to fit the variable (-1/2) *** Error in `/usr/lib64/gcc/x86_64-suse-linux/5/f951': corrupted double-linked list: 0x00000000036d5db0 ***