public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work
@ 2007-01-28 20:14 pault at gcc dot gnu dot org
2007-01-28 20:33 ` [Bug fortran/30625] " tkoenig at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-28 20:14 UTC (permalink / raw)
To: gcc-bugs
This:
type :: a
real :: r = 3.14159
integer :: i = 42
end type a
type(a), target :: dt(2)
integer, pointer :: ip(:)
ip => dt%i
print *, ip
end
produces
$ ./a
1078530000 42
with gfortran, whereas the correct result should be two 42s
Paul
--
Summary: Array pointers to components of derived type arrays do
not work
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pault at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
@ 2007-01-28 20:33 ` tkoenig at gcc dot gnu dot org
2007-01-29 0:16 ` tobi at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-01-28 20:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tkoenig at gcc dot gnu dot org 2007-01-28 20:33 -------
Confirmed.
Is this related to PR 29606?
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-01-28 20:33:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
2007-01-28 20:33 ` [Bug fortran/30625] " tkoenig at gcc dot gnu dot org
@ 2007-01-29 0:16 ` tobi at gcc dot gnu dot org
2007-01-29 7:50 ` pault at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-01-29 0:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tobi at gcc dot gnu dot org 2007-01-29 00:16 -------
Wasn't there a bug for byte-sized strides in array descriptors? This bug
should depend on it, and PR29606 as well.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
2007-01-28 20:33 ` [Bug fortran/30625] " tkoenig at gcc dot gnu dot org
2007-01-29 0:16 ` tobi at gcc dot gnu dot org
@ 2007-01-29 7:50 ` pault at gcc dot gnu dot org
2007-02-01 11:28 ` dfranke at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-29 7:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pault at gcc dot gnu dot org 2007-01-29 07:50 -------
(In reply to comment #2)
> Wasn't there a bug for byte-sized strides in array descriptors? This bug
> should depend on it, and PR29606 as well.
>
Both of you are right about PR29606. The byte-sized strides I do not remember.
It is one way to go but I do not think that it is the correct one. I think
that we need a new field in the descriptor or, maybe, a new species of
descriptor. This field could serve two functions:
(i) If present for an intrinsic type, it carries the base stride in bytes; and
(ii) If present for a derived type it carries the size in bytes.
The present size subfield should be used to carry a unique code for the type,
so that classes can be implemented, including abstract classes.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-01-29 7:50 ` pault at gcc dot gnu dot org
@ 2007-02-01 11:28 ` dfranke at gcc dot gnu dot org
2007-02-02 19:20 ` paulthomas2 at wanadoo dot fr
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-02-01 11:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dfranke at gcc dot gnu dot org 2007-02-01 11:28 -------
As I came across this once more: is it possible to issue a compile-time warning
that "array pointers to components of derived type arrays" are allowed by the
standard but are not yet implemented in gfortran (gfc_todo, maybe)?
This would prevent some users (e.g. me) from using it right now. If otherwise
the code compiles fine, one silently gets unusable results ...
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
BugsThisDependsOn| |29606
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-02-01 11:28 ` dfranke at gcc dot gnu dot org
@ 2007-02-02 19:20 ` paulthomas2 at wanadoo dot fr
2007-02-10 21:18 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2007-02-02 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paulthomas2 at wanadoo dot fr 2007-02-02 19:20 -------
Subject: Re: Array pointers to components of derived type
arrays do not work
dfranke at gcc dot gnu dot org wrote:
> ------- Comment #4 from dfranke at gcc dot gnu dot org 2007-02-01 11:28 -------
> As I came across this once more: is it possible to issue a compile-time warning
> that "array pointers to components of derived type arrays" are allowed by the
> standard but are not yet implemented in gfortran (gfc_todo, maybe)?
>
> This would prevent some users (e.g. me) from using it right now. If otherwise
> the code compiles fine, one silently gets unusable results ...
>
>
>
Daniel,
I'll see what I can come up with - I have also been feeling round the
edges of how this might be cured. Implementation of F2003 classes will
require another field in the descriptor. I am trying to figure out how
best to do this without completely breaking the library API but I
am attempting to design this field to fulfill both functions.
Best regards
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-02-02 19:20 ` paulthomas2 at wanadoo dot fr
@ 2007-02-10 21:18 ` fxcoudert at gcc dot gnu dot org
2007-02-11 9:52 ` pault at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-10 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from fxcoudert at gcc dot gnu dot org 2007-02-10 21:18 -------
Paul, I take it you are aware of PR21881 ("Array descriptors limit derived type
sizes")... I don't fully grasp the way array descriptor work for derived types,
but I wanted to mention that PR to you... just in case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-02-10 21:18 ` fxcoudert at gcc dot gnu dot org
@ 2007-02-11 9:52 ` pault at gcc dot gnu dot org
2007-07-04 6:34 ` jv244 at cam dot ac dot uk
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-02-11 9:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pault at gcc dot gnu dot org 2007-02-11 09:52 -------
(In reply to comment #6)
> Paul, I take it you are aware of PR21881 ("Array descriptors limit derived type
> sizes")... I don't fully grasp the way array descriptor work for derived types,
> but I wanted to mention that PR to you... just in case.
>
FX, I was aware of the problem but not of the PR; I'll be honest if I say tha I
am not sure that the size limit on derived types is an issue. After all,
pointers or allocatable components can be used to keep the size of the derived
type down.
I think that I need to sketch out a design and post it on the list; it'll have
to be CC'd to Paul Brooks and Steven Bosscher because they are responsible for
the present layout of descriptors. They maybe have opinions about how to
proceed.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-02-11 9:52 ` pault at gcc dot gnu dot org
@ 2007-07-04 6:34 ` jv244 at cam dot ac dot uk
2007-08-18 18:28 ` tkoenig at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-07-04 6:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jv244 at cam dot ac dot uk 2007-07-04 06:33 -------
target milestone 4.3.0 ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-07-04 6:34 ` jv244 at cam dot ac dot uk
@ 2007-08-18 18:28 ` tkoenig at gcc dot gnu dot org
2007-09-03 11:48 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-08-18 18:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from tkoenig at gcc dot gnu dot org 2007-08-18 18:28 -------
Some discussion is here:
http://gcc.gnu.org/ml/fortran/2007-04/msg00115.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-08-18 18:28 ` tkoenig at gcc dot gnu dot org
@ 2007-09-03 11:48 ` pault at gcc dot gnu dot org
2007-09-16 9:18 ` pault at gcc dot gnu dot org
2007-09-16 9:39 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-03 11:48 UTC (permalink / raw)
To: gcc-bugs
--
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 |
Status|NEW |ASSIGNED
Last reconfirmed|2007-01-28 20:33:48 |2007-09-03 11:48:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-09-03 11:48 ` pault at gcc dot gnu dot org
@ 2007-09-16 9:18 ` pault at gcc dot gnu dot org
2007-09-16 9:39 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-16 9:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pault at gcc dot gnu dot org 2007-09-16 09:18 -------
Subject: Bug 30625
Author: pault
Date: Sun Sep 16 09:17:49 2007
New Revision: 128523
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128523
Log:
2007-09-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29396
PR fortran/29606
PR fortran/30625
PR fortran/30871
* trans.h : Add extra argument to gfc_build_array_ref. Rename
gfc_conv_aliased_arg to gfc_conv_subref_array_arg. Move
prototype of is_aliased_array to gfortran.h and rename it
gfc_is_subref_array. Add field span to lang_decl, add a new
decl lang specific flag accessed by GFC_DECL_SUBREF_ARRAY_P
and a new type flag GFC_DECL_SUBREF_ARRAY_P.
* trans.c (gfc_build_array_ref): Add the new argument, decl.
If this is a subreference array pointer, use the lang_decl
field 'span' to calculate the offset in bytes and use pointer
arithmetic to address the element.
* trans-array.c (gfc_conv_scalarized_array_ref,
gfc_conv_array_ref): Add the backend declaration as the third
field, if it is likely to be a subreference array pointer.
(gfc_conv_descriptor_dimension, gfc_trans_array_ctor_element,
gfc_trans_array_constructor_element, structure_alloc_comps,
gfc_conv_array_index_offset): For all other references to
gfc_build_array_ref, set the third argument to NULL.
(gfc_get_dataptr_offset): New function.
(gfc_conv_expr_descriptor): If the rhs of a pointer assignment
is a subreference array, then calculate the offset to the
subreference of the first element and set the descriptor data
pointer to this, using gfc_get_dataptr_offset.
trans-expr.c (gfc_get_expr_charlen): Use the expression for the
character length for a character subreference.
(gfc_conv_substring, gfc_conv_subref_array_arg): Add NULL for
third argument in call to gfc_build_array_ref.
(gfc_conv_aliased_arg): Rename to gfc_conv_subref_array_arg.
(is_aliased_array): Remove.
(gfc_conv_function_call): Change reference to is_aliased_array
to gfc_is_subref_array and reference to gfc_conv_aliased_arg to
gfc_conv_subref_array_arg.
(gfc_trans_pointer_assignment): Add the array element length to
the lang_decl 'span' field.
* gfortran.h : Add subref_array_pointer to symbol_attribute and
add the prototype for gfc_is_subref_array.
* trans-stmt.c : Add NULL for third argument in all references
to gfc_build_array_ref.
* expr.c (gfc_is_subref_array): Renamed is_aliased_array.
If this is a subreference array pointer, return true.
(gfc_check_pointer_assign): If the rhs is a subreference array,
set the lhs subreference_array_pointer attribute.
* trans-decl.c (gfc_get_symbol_decl): Allocate the lang_decl
field if the symbol is a subreference array pointer and set an
initial value of zero for the 'span' field.
* trans-io.c (set_internal_unit): Refer to is_subref_array and
gfc_conv_subref_array_arg.
(nml_get_addr_expr): Add NULL third argument to
gfc_build_array_ref.
(gfc_trans_transfer): Use the scalarizer for a subreference
array.
2007-09-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29396
PR fortran/29606
PR fortran/30625
PR fortran/30871
* gfortran.dg/subref_array_pointer_1.f90: New test.
* gfortran.dg/subref_array_pointer_2.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90
trunk/gcc/testsuite/gfortran.dg/subref_array_pointer_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-io.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/30625] Array pointers to components of derived type arrays do not work
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
` (10 preceding siblings ...)
2007-09-16 9:18 ` pault at gcc dot gnu dot org
@ 2007-09-16 9:39 ` pault at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-16 9:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pault at gcc dot gnu dot org 2007-09-16 09:39 -------
Fixed on trunk
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30625
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-09-16 9:39 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-28 20:14 [Bug fortran/30625] New: Array pointers to components of derived type arrays do not work pault at gcc dot gnu dot org
2007-01-28 20:33 ` [Bug fortran/30625] " tkoenig at gcc dot gnu dot org
2007-01-29 0:16 ` tobi at gcc dot gnu dot org
2007-01-29 7:50 ` pault at gcc dot gnu dot org
2007-02-01 11:28 ` dfranke at gcc dot gnu dot org
2007-02-02 19:20 ` paulthomas2 at wanadoo dot fr
2007-02-10 21:18 ` fxcoudert at gcc dot gnu dot org
2007-02-11 9:52 ` pault at gcc dot gnu dot org
2007-07-04 6:34 ` jv244 at cam dot ac dot uk
2007-08-18 18:28 ` tkoenig at gcc dot gnu dot org
2007-09-03 11:48 ` pault at gcc dot gnu dot org
2007-09-16 9:18 ` pault at gcc dot gnu dot org
2007-09-16 9:39 ` pault at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).