While programming something recently, I used the VALUE attribute on an optional argument without thinking much about it. In retrospect its probably an odd choice, but I can’t see any reason it would be invalid. However the resulting code, when combined with an allocatable array, causes segfaults under several compilers, in particular intel 2022 and ifx 2023. 2025 seems to have fixed it, and gfortran seems to handle it fine. Is this invalid, or is it a compiler bug? I would guess both the allocatable and the optional are inserting some extra status info and the two are colliding.
mre.f90 (442 Bytes)