[Bug fortran/125606] gimplification failed: with -O1
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jun 5 18:40:51 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125606
--- Comment #10 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
(In reply to David Binderman from comment #9)
> As expected:
>
> trunk $ git bisect bad ee9ded19244ab887
> ee9ded19244ab887759eb3faef452ee70316835e is the first bad commit
> commit ee9ded19244ab887759eb3faef452ee70316835e (HEAD)
> Author: Harald Anlauf <anlauf@gmx.de>
> Date: Thu Dec 4 22:16:10 2025 +0100
>
> Fortran: associate to a contiguous pointer or target [PR122977]
>
> PR fortran/122977
>
> Adding Harald for their opinion.
When I add option -std=f2023 the code is rejected:
pr125606.f90:20:27:
20 | write (unit) loc(p(2)%c1)
| 1
Error: Explicit interface required for polymorphic argument at (1)
pr125606.f90:24:24:
24 | write (7) loc(t(2)%c2e)
| 1
Error: Explicit interface required for polymorphic argument at (1)
This makes sense: LOC() is an extension.
So shall we accept it nonetheless?
I looked at C_LOC(), which has (F2023:18.2.3.7):
"Argument. X shall have either the POINTER or TARGET attribute. It shall not
be a coindexed object. It shall be a variable with interoperable type and
kind type parameters, an assumed-type variable, or a nonpolymorphic
variable that has no length type parameter. If it is allocatable, it shall
be allocated. If it is a pointer, it shall be associated. If it is an
array, it shall be contiguous and have nonzero size. It shall not be a
zero-length string."
Steve, any opinions?
More information about the Gcc-bugs
mailing list