[Bug fortran/85603] ICE with character array substring assignment

2019-01-25 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Paul Thomas  ---
Fixed on trunk. Thanks for the report.

Paul

[Bug fortran/85603] ICE with character array substring assignment

2018-10-23 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

--- Comment #5 from Paul Thomas  ---
Author: pault
Date: Tue Oct 23 08:27:14 2018
New Revision: 265412

URL: https://gcc.gnu.org/viewcvs?rev=265412=gcc=rev
Log:
2018-10-23  Paul Thomas  

PR fortran/85603
* frontend-passes.c (get_len_call): New function to generate a
call to intrinsic LEN.
(create_var): Use this to make length expressions for variable
rhs string lengths.
Clean up some white space issues.

2018-10-23  Paul Thomas  

PR fortran/85603
* gfortran.dg/deferred_character_23.f90 : Check reallocation is
occurring as it should and a regression caused by version 1 of
this patch.


Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/deferred_character_23.f90

[Bug fortran/85603] ICE with character array substring assignment

2018-09-23 Thread w6ws at earthlink dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

--- Comment #4 from Walter Spector  ---
Hi Paul,

I built an updated compiler that includes your fix.  The ICE is gone - thanks! 
However the assignment is still not correctly compiled.

The example should be reallocating the character string length of the array to
15.  Unfortunately it remains at 32.  Slightly longer example:

program strlen_bug
  implicit none

  character(:), allocatable :: strings(:)
  integer :: maxlen

  strings = [ character(32) ::  &
  'short',  &
  'somewhat longer' ]
  maxlen = maxval (len_trim (strings))
  print *, 'max length =', maxlen

! Used to cause an ICE
  strings = strings(:)(:maxlen) ! Should realloc
  print *, strings
  print *, 'string length =', len (strings)

end program

wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ /usr/local/gcc-9/bin/gfortran
-frealloc-lhs strlen_bug.f90
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ a.out
 max length =  15
 short   somewhat longer 
 string length =  32
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ /usr/local/gcc-9/bin/gfortran
--version
GNU Fortran (GCC) 9.0.0 20180922 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ 

Note that I tried explicitly adding the -frealloc-lhs option, but it didn't
make a difference either way.

[Bug fortran/85603] ICE with character array substring assignment

2018-09-22 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

--- Comment #3 from Paul Thomas  ---
Author: pault
Date: Sat Sep 22 10:21:25 2018
New Revision: 264502

URL: https://gcc.gnu.org/viewcvs?rev=264502=gcc=rev
Log:
2018-09-22  Paul Thomas  

PR fortran/85603
* trans-array.c (gfc_alloc_allocatable_for_assignment): Test
the charlen backend_decl before using the VAR_P macro.

2018-09-22  Paul Thomas  

PR fortran/85603
* gfortran.dg/deferred_character_23.f90 : New test.


Added:
trunk/gcc/testsuite/gfortran.dg/deferred_character_23.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/85603] ICE with character array substring assignment

2018-09-22 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas  ---
Hi Walt,

I am on a roll with deferred length string bugs so I will take this one.

I already have a fix for it which I will transmit to the list in the next few
days. (I am just setting off for a 'break' in Wales. Both my wife and daughter
have work to do so I might as well join them:-) )

Paul

[Bug fortran/85603] ICE with character array substring assignment

2018-05-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-03
 Blocks||68241
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed from at least 4.8 up to trunk (9.0).

I am pretty sure this is a duplicate.

The code compiles if I replace

  strings = strings(:)(:maxlen)

with

  strings(1) = strings(1)(:maxlen)
  strings(2) = strings(2)(:maxlen)

but this does not set the length of 'strings' to 'maxlen'.

IIRC I have recently seen a post saying that substrings of string array
sections are forbidden by the standard.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68241
[Bug 68241] [meta-bug] [F03] Deferred-length character