https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129272
Steve Kargl <kargl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Harald Anlauf from comment #1)
> Confirmed.
>
> Reduced testcase:
>
> subroutine test_optional_as_addr
> integer, allocatable :: from(:), to(:)
> integer, allocatable :: stat
> allocate(from(20))
> ! call move_alloc(from, to, stat=stat) ! compiles with 16/17
> call move_alloc(from, to, stat) ! ICE
> deallocate(to)
> end subroutine
Looks like the code in trans-intrinsic.cc(conv_intrinsic_move_alloc)
does not handle positional optional arguments (or in iterating over
formal arguments does not set arg->name='stat').
(gdb) b trans-intrinsic.cc:13507
while (arg)
{
if (arg->expr)
{
if (!strcmp ("stat", arg->name))
tmp_sync_stat.stat = arg->expr;
else if (!strcmp ("errmsg", arg->name))
tmp_sync_stat.errmsg = arg->expr;
}
arg = arg->next;
}
(gdb) p *arg->name
Cannot access memory at address 0x0
(gdb) p arg->expr->symtree->name
$6 = 0x805014820 "stat"
There may still be an issue in that the variable is an
unallocated allocated option argument. I cannot remember
if F2023 now permits the argument to be allocated and
then assigned the status value.