https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71623
Bug ID: 71623
Summary: Segfault when allocating deferred-length characters to
size of a pointer
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: zed.three at gmail dot com
Target Milestone: ---
Created attachment 38748
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38748&action=edit
MVCE for allocation bug
When running the attached MVCE with gfortran 5.4.0 and 6.1.1 (20160615
[gcc-6-branch revision 237474]), there's a segfault on the line:
allocate(character(len=size(array_ptr))::string)
but not on
allocate(character(len=size(array))::string)
or
allocate(character(len=ptr_size)::string)
where array_ptr => array, and ptr_size = size(array_ptr).
This works in 4.9.0 and 4.8.3, as well as ifort 14.