https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113377
--- Comment #3 from anlauf at gcc dot gnu.org --- Created attachment 57108 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57108&action=edit Patch to play with This is a first attempt to outline code for handling scalar dummies with the VALUE attribute. This fixes the following variants of the declaration of dummy argument j in function one: integer, value, optional :: j integer, intent(in), optional :: j integer, intent(in), optional :: j(4) integer, intent(in), optional :: j(:) However, integer, allocatable,optional :: j still does not work: the code *in* the generated loop looks fine to me, but the scalarizer dereferences j before the loop. I think that this is correct F2018+, as ifx handles it fine. Not sure how to proceed here. Furthermore, the patch tries to cope (= prevent an ICE) with integer, allocatable,optional :: j(:) which I think might be invalid. At least it also crashed with ifx... Otherwise, the patch so far regtests ok.