[Bug fortran/83522] New: gfortran is sometimes confused between what is an element range and what is a character range

urbanjost at comcast dot net gcc-bugzilla@gcc.gnu.org
Thu Dec 21 06:59:00 GMT 2017


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

            Bug ID: 83522
           Summary: gfortran is sometimes confused between what is an
                    element range and what is a character range
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urbanjost at comcast dot net
  Target Milestone: ---

In the attachment:

 If I try to print any range of elements of the array other than all of them
 and do not specify the extent of the character range I get errors. It is
 somewhat like it is confused as to whether I am specifying the range of 
 elements or the range of characters.

 Lines commented with double-exclamations cause different kinds of errors,
 usually ICE; sometimes print the wrong strings or get segmentation faults
 depending on the LEN value.

 So if you take the attachment as-is it will run with some lines a lot like
 the commented lines. Try to uncomment the commented lines and you get ICE
 when you compile, or various run-time errors; either the wrong output or 
 run-time segfaults. There is a pattern as to what works and what does not,
 but could not quite figure it out so I left all the cases that failed in
 the example because I did not want to over-simplify what I was seeing, but ...

 I think it is all the same problem, but I cannot even compile this program:

      program testit
      character(len=:),allocatable :: strings(:)
      strings=[character(len=2) :: 'AA','BB']
      write(*,*)strings(:)(:)  ! <<<< COMPILES WITHOUT THE WRITE(3f)
      end program testit

internal compiler error: Segmentation fault
gfortran: internal compiler error: Segmentation fault (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.


More information about the Gcc-bugs mailing list