This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66089] [6 Regression] elemental dependency mishandling when derived types are involved
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 29 Jan 2016 20:48:07 +0000
- Subject: [Bug fortran/66089] [6 Regression] elemental dependency mishandling when derived types are involved
- Auto-submitted: auto-generated
- References: <bug-66089-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089
--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> ---
Here is a variant that fails similarly (even with the patch) with optional
arguments.
type :: t
integer :: c
end type t
type(t), dimension(5) :: a, b, c
a = t(1)
b = t(7)
c = t(13)
call do_bug(c, b)
print *, c
if (any(c%c /= 20)) call abort
contains
elemental function plus(lhs, rhs)
optional :: lhs
type(t), intent(in) :: lhs, rhs
type(t) :: plus
if (present(lhs)) then
plus%c = lhs%c + rhs%c
else
plus%c = 0
end if
end function plus
subroutine do_bug(lhs, rhs)
type(t), intent(inout), optional :: lhs(5)
type(t), intent(in) :: rhs(5)
if (present(lhs)) then
lhs = plus(lhs(1), rhs)
end if
end subroutine
end