------- Comment #4 from burnus at gcc dot gnu dot org  2008-05-28 22:19 -------
Update summary.

> I see.  If component x were an allocatable instead of a pointer,
> would I then get an error?

Yes.

> It might be useful to emit a warning when -Wsurprising (or some
> other option turned on by -Wall) is enabled.

I changed the title now.

> I could not yet find this wording in the standard.  Do you by chance
> know the exact verse?  The only thing I could find was:

Sorry, I was too lazy to search the standard and wrote how I understood the
standard (copied over from the PR without realizing that I was not copying the
standard).


> [F2003 draft]
> 5.1.2.7 INTENT attribute
> [...]
> The INTENT (IN) attribute for a pointer
> dummy argument specifies that during the execution of the procedure
> its association shall not be changed except that it may become
> undefined if the target is deallocated other than through the pointer
> (16.4.2.1.3).

I think this is the essential point: The value of the pointer target may change
but not the *association status*. Thus assigning to a pointer is OK,
allocating, deallocating or re-associating is invalid.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |diagnostic
      Known to work|4.4.0                       |
           Priority|P4                          |P3
            Summary|[4.3 regression] Missed     |Add -Wsurprising for
                   |error with assignment to    |pointers arguments with
                   |INTENT(IN) argument         |INTENT(IN)
   Target Milestone|4.3.1                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36271

Reply via email to