This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46339] [4.3/4.4/4.5/4.6 Regression] ICE (segfault) in gfc_trans_pointer_assignment
- From: "pault at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 21 Nov 2010 07:33:42 +0000
- Subject: [Bug fortran/46339] [4.3/4.4/4.5/4.6 Regression] ICE (segfault) in gfc_trans_pointer_assignment
- Auto-submitted: auto-generated
- References: <bug-46339-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46339
--- Comment #26 from Paul Thomas <pault at gcc dot gnu.org> 2010-11-21 07:18:04 UTC ---
(In reply to comment #0)
> The test program is:
....snip....
> type (particle_struct), optional, target :: p(:)
> real, pointer, optional :: axis(:)
>
> axis => p%r%vec(1)
>
> end subroutine tao_phase_space_axis
>
> end module
'axis' gets labeled, correctly, as a subref_array_pointer. The 'span' variable
that is meant to deal with this is generated in
trans-decl.c:gfc_get_symbol_decl at line 1266, onwards. Dummy variables have
already been returned at line 1136, as remarked in the comment at line 1084.
Since 'axis' is a dummy, it means that the 'span' variable will not exist and
this is the cause of the segfault.
Now, we could remedy this directly by adding the 'span' variable to dummies.
The reason that this was not done is that it cannot be returned to the caller.
We have a choice here:
(i) Hope that the dummy is returned, pointing to something less complicated
(ie. the span value is the same as the actual argument element size);
(ii) Copy the passing of character lengths; or
(iii) Add the requisite field to the descriptor.
(i)-(ii) Are consistent with being in stage 3. (ii) Would not hit the API
because the segfault is bound to occur otherwise.
This is not a regression because the incorrect result was returned in gcc-4.2
and earlier.
Cheers
Paul