Bug 30352 - [4.1, 4.2 only] False error on INTENT(IN) when modifying pointees
Summary: [4.1, 4.2 only] False error on INTENT(IN) when modifying pointees
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2007-01-02 10:08 UTC by Harald Anlauf
Modified: 2007-01-14 21:41 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-01-08 22:25:46


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Anlauf 2007-01-02 10:08:29 UTC
Hi,

the following *legal Fortran 95* code is falsely rejected
by gfortran.  Note that this differs from PR 29624 which
specifies a F2003 feature for pointers.

% cat gfcbug52.f90
program gfcbug52
  implicit none

  type t
     integer, pointer :: p(:) => NULL ()
  end type t

  type(t) :: a

  allocate (a%p(1))
  call set (a)
  print *, a%p(1)

contains

  subroutine set (b)
    type(t), intent(in) :: b
    if (associated (b%p)) b%p(1) = 1
  end subroutine set

end program gfcbug52
% gfc gfcbug52.f90
gfcbug52.f90:18.27:

    if (associated (b%p)) b%p(1) = 1
                          1
Error: Can't assign to INTENT(IN) variable 'b' at (1)
Comment 1 Harald Anlauf 2007-01-08 22:06:38 UTC
(In reply to comment #0)

It appears that the fix to PR 29624 also fixed this one
properly.
Comment 2 Tobias Burnus 2007-01-08 22:25:46 UTC
> It appears that the fix to PR 29624 also fixed this one properly.
So far I had only managed to cause collateral damage not collateral fixes :-)
Comment 3 Paul Thomas 2007-01-14 21:41:47 UTC
This is indeed fixed.

Paul