This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/25030] Character pointer can associated with not the same length character variable.
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Dec 2005 05:32:08 -0000
- Subject: [Bug fortran/25030] Character pointer can associated with not the same length character variable.
- References: <bug-25030-9795@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pault at gcc dot gnu dot org 2005-12-06 05:32 -------
(In reply to comment #3)
> I believe the code is illegal from 7.5.2, page 110,
>
> Constraint: The target shall be of the same type, kind type parameters,
> and rank as the pointer.
>
> Then on page 111, you find "The target shall have the same type parameters
> as the pointer-object."
I believe that you are correct - I worried at this one with PR15809. Automatic
character length pointer dummies are a bit out of frame if this constraint is
asserted.
>
> BTW, both Lahey's web-based checking utility and NAG's compiler
> rejects this code.
This could easily be done in gfortran. I will prepare a patch to do it.
>
> BTW2, gfortran 4.2 compiles the code, but I get garbage.
>
If you make the pointer very much bigger than the pointee/target, you can
provoke segfaults.
I am working (very slowly) on a patch that would enable pointer aliassing in
gfortran. This would include aliassing between characters of different sizes.
This PR flags up:
(i) This will have to subject to -std=gnu
(ii) The size of the elements of the pointer will have to be asserted to be
smaller than that of the pointee/target.
(iii) I will have to be fiendishly clever with warnings, errors and
assertions....
In the mean time, I will ban it all!
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25030