https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94289
--- Comment #1 from José Rui Faustino de Sousa <jrfsousa at gmail dot com> --- Hi all! My first comment is not very clear so to elaborate a bit. For assumed-rank arrays no temporary array descriptor with the correct bounds is created like it is for assumed-shape arrays. So although the array bounds are correctly reported by the lbound, ubound and shape intrinsics the underlying array descriptor is still the original one. And since it is the original array descriptor, not a temporary with correct array bounds, that is passed down the call chain subsequent procedures will get a descriptor with the wrong bounds. This will probably imply adding assumed-rank arrays to the deferred initialization list, which is already done (I guess accidentally) for bind(c) procedures. I guess by removing the condition on the first if clause in gfc_build_dummy_array_decl and, hopefully, then in the "type_of_array" switch in gfc_trans_deferred_vars. This will imply also solving PR93957. Best regards, José Rui