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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-07
           Keywords|                            |ice-on-valid-code
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.  Reduced testcase:

subroutine s
  character(1)          :: w = "4"
  character(:), pointer :: chr_pointer
  allocate (chr_pointer, source=        "123"//w   ) ! ICE at -O0,-Og
! allocate (chr_pointer, source=adjustl("123"//w)  ) ! ICE at -O0,-Og
! allocate (chr_pointer, source=trim   ("123"//w)  ) ! OK
! allocate (chr_pointer, source=repeat ("123"//w,1)) ! OK
end

In the indicated cases where we ICE at -O0 or -Og the length of source
is determined to be 4 at compile time, in the others it is an expression.
Setting a breakpoint in gfc_allocate_using_malloc:

(gdb) p debug_tree(size)
 <integer_cst 0x7ffff6a29030 type <integer_type 0x7ffff6a25000 sizetype>
constant 4>

I do not see anything being obviously wrong with the dump-tree...

Reply via email to