see also: http://gcc.gnu.org/ml/fortran/2006-11/msg00511.html

With -fbounds-check, an error message is shown if the character substrings
exceed the size of the variable. This error message contains also the name of
the variable, but this piece of information is not always passed to
gfc_conv_substring.

There are two places where gfc_conv_substring is called:
a) In gfc_conv_variable
b) In gfc_conv_substring_expr, here the name is always unknown.

I checked it against the regression test suite. The result:

First case, gfc_conv_variable: None found.

Secondly, gfc_conv_substring_expr (tested by adding the following to
gfc_conv_substring_expr:
 printf("ERROR: gfc_conv_substring_expr: NO NAME"
        "(in file '%s', at line %d)\n", expr->where.lb->file->filename, 
        expr->where.lb->linenum); ):

Several matches of this kind:
- gfortran.dg/char_cshift_1.f90
  a(i1, i2, i3) = 'ab'(i1:i1) // 'cde'(i2:i2) // 'fghi'(i3:i3)
=> Unsolvable as no name exists

Solvable case: gfortran.dg/pr29067.f:
      character(len=16),parameter :: s = "", s2 = "1234567890123456"
      print *, s(9:16)
      print *, s2(9:16)
The problem is that s and s2 have the parameter type


-- 
           Summary: substring out of bounds: Missing variable name for
                    variables with parameter attribute
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29892

Reply via email to