[Bug fortran/103045] New: False report substring out of bounds with -fbounds-check

krefson at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 2 12:32:09 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103045

            Bug ID: 103045
           Summary: False report substring out of bounds with
                    -fbounds-check
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krefson at gmail dot com
  Target Milestone: ---

Created attachment 51723
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51723&action=edit
Test program

The attached (correct) program generates an incorrect report of a substring
bounds error when compiled with -fbounds-check.

$ gfortran-10 -g -fbounds-check -fbacktrace debugtest.f90
$ ./a.out
Fortran runtime error: Substring out of bounds: lower bound (0) of 'sf_string'
is less than one

Error termination. Backtrace:
#0  0x7f9a46a8a744 in ???
#1  0x7f9a46a8b219 in ???
#2  0x7f9a46a8b82a in ???
#3  0x4009b4 in debugtest
        at /home/kr/CASTEP/Compiler_BUGS/Gfortran_Debug_False/debugtest.f90:10
#4  0x400c86 in main
        at /home/kr/CASTEP/Compiler_BUGS/Gfortran_Debug_False/debugtest.f90:14

This occurs with gcc-fortran version 8, 9, 10.


More information about the Gcc-bugs mailing list