https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106108
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is because .args (the on the side len of the allocatable) is
uninitialized,
its value stored to 2 unused temporary variables and then .dtype.elem_len field
of args:
integer(kind=8) .args;
struct array01_character(kind=1) args;
bitsizetype D.4249;
sizetype D.4250;
D.4249 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.args> * 8;
D.4250 = (sizetype) NON_LVALUE_EXPR <.args>;
args.data = 0B;
args.dtype = {.elem_len=(unsigned long) .args, .rank=1, .type=6};
{
integer(kind=4) overflow.0;
logical(kind=4) not_prev_allocated.1;
.args = 6;
args.dtype = {.elem_len=(unsigned long) .args, .rank=1, .type=6};
and only on allocate .args is overwritten and args.dtype.elem_len updated to
it.
So, I think for the allocatables .args should be initialized to 0 or something
similar before the args variable is "constructed".