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

--- Comment #11 from Christopher Albert <albert at tugraz dot at> ---
Created attachment 64104
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64104&action=edit
Proposed patch: fix ICE with assumed-rank + contiguous

Patch to fix the ICE in gfc_trans_create_temp_array (PR100194, PR102729).

When a non-contiguous assumed-rank actual argument is passed to a contiguous
assumed-rank dummy, the compiler routes it through gfc_conv_subref_array_arg
which uses the scalarizer.  The scalarizer requires compile-time known rank,
but assumed-rank arrays have rank = -1, hitting gcc_assert (ss->dimen > 0).

The fix skips the scalarizer path for assumed-rank expressions (e->rank == -1)
and lets them fall through to gfc_conv_array_parameter, which handles
assumed-rank correctly via runtime pack/unpack.

Bootstrapped and regtested on x86_64-pc-linux-gnu, no regressions.

Reply via email to