public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
@ 2013-06-04  9:18 alan.briolat at gmail dot com
  2013-06-04 10:05 ` [Bug fortran/57522] " alan.briolat at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: alan.briolat at gmail dot com @ 2013-06-04  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57522
           Summary: [F03] ASSOCIATE construct creates array descriptor
                    with incorrect stride for derived type array component
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alan.briolat at gmail dot com

Created attachment 30254
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30254&action=edit
Code demonstrating the bug

The attached code demonstrates a bug (reproducible on 4.6 to 4.9) where using
ASSOCIATE to reference a derived type component in an array appears to have the
wrong stride.  The output is:

           0           1           2           3
           0           4           1           5

when it should be (and is under ifort):

           0           1           2           3
           0           1           2           3

This is probably related to bug 49636, but is a simpler case.  It's also
probably related to http://gcc.gnu.org/wiki/ArrayDescriptorUpdate (which I
found via that bug).  However, if the changes necessary to support this sort of
reference are "future ABI-breaking work", then the current version really
should warn/error rather than generating the wrong stride and silently doing
the wrong thing.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
@ 2013-06-04 10:05 ` alan.briolat at gmail dot com
  2013-07-02  9:20 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: alan.briolat at gmail dot com @ 2013-06-04 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alan Briolat <alan.briolat at gmail dot com> ---
Created attachment 30255
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30255&action=edit
Working "equivalent" code based on pointers

For comparison, this attached code uses pointers to achieve the same thing and
gets the correct result.  What's so different between the array descriptors
used for pointers and the array descriptors use for ASSOCIATE?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
  2013-06-04 10:05 ` [Bug fortran/57522] " alan.briolat at gmail dot com
@ 2013-07-02  9:20 ` dominiq at lps dot ens.fr
  2013-12-02  9:59 ` pault at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-07-02  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-02
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at revision 200581.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
  2013-06-04 10:05 ` [Bug fortran/57522] " alan.briolat at gmail dot com
  2013-07-02  9:20 ` dominiq at lps dot ens.fr
@ 2013-12-02  9:59 ` pault at gcc dot gnu.org
  2014-02-09 20:51 ` pault at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2013-12-02  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #3)
> > print *, a
....
> 
> I have not yet completely understood why, but the call
> gfc_conv_expr_descriptor yields a unit stride.

We have a choice here:
(i) We use the 'span' variable that is used for pointers to some useful effect.
Ideally, this should be accompanied by passing of the 'span' variable to
pointer formal arguments in function calls.  That way, even if kludgy we would
have a full implementation of the F95(!) standard (see for example PR40737 +
others that I cannot find right now); or
(ii) That we attach 'span' to pointer array descriptors; or
(iii) We recognised one the the ASSOCIATE todos, which is the make a temporary
when needed and write the selector result to that temporary. This is also
required for SELECT TYPE. Examples are where the selector is a function call.

(ii)Would cause a diversion from the array descriptor reform but are we really
in a position to implement that?  Both Tobias and I are taken by daytime work
for the foreseeable future.  It certainly would be a clean way to proceed.

(iii) Must be done sometime... soon. It could be used to fix this case using
write-in/write-out but would not fix the F95 problems.

I am prepared to make this my next gfortran job.  I would suggest (i) or (ii)
followed by (iii).

Cheers

Paul


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
                   ` (2 preceding siblings ...)
  2013-12-02  9:59 ` pault at gcc dot gnu.org
@ 2014-02-09 20:51 ` pault at gcc dot gnu.org
  2014-03-18 10:42 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2014-02-09 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Sun Feb  9 20:50:21 2014
New Revision: 207646

URL: http://gcc.gnu.org/viewcvs?rev=207646&root=gcc&view=rev
Log:
2014-02-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/57522
    * resolve.c (resolve_assoc_var): Set the subref_array_pointer
    attribute for the 'associate-name' if necessary.
    * trans-stmt.c (trans_associate_var): If the 'associate-name'
    is a subref_array_pointer, assign the element size of the
    associate variable to 'span'.

2014-02-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/57522
    * gfortran.dg/associated_target_5.f03 : New test

Added:
    trunk/gcc/testsuite/gfortran.dg/associated_target_5.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
                   ` (3 preceding siblings ...)
  2014-02-09 20:51 ` pault at gcc dot gnu.org
@ 2014-03-18 10:42 ` dominiq at lps dot ens.fr
  2014-03-18 10:47 ` dominiq at lps dot ens.fr
  2014-03-18 10:55 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-18 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Any reason why tho PR is not closed as fixed?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
                   ` (4 preceding siblings ...)
  2014-03-18 10:42 ` dominiq at lps dot ens.fr
@ 2014-03-18 10:47 ` dominiq at lps dot ens.fr
  2014-03-18 10:55 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-18 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
*** Bug 58339 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component
  2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
                   ` (5 preceding siblings ...)
  2014-03-18 10:47 ` dominiq at lps dot ens.fr
@ 2014-03-18 10:55 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2014-03-18 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
No reason whatsoever, except that I forgot!

Thanks for the report.

Paul


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-18 10:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04  9:18 [Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component alan.briolat at gmail dot com
2013-06-04 10:05 ` [Bug fortran/57522] " alan.briolat at gmail dot com
2013-07-02  9:20 ` dominiq at lps dot ens.fr
2013-12-02  9:59 ` pault at gcc dot gnu.org
2014-02-09 20:51 ` pault at gcc dot gnu.org
2014-03-18 10:42 ` dominiq at lps dot ens.fr
2014-03-18 10:47 ` dominiq at lps dot ens.fr
2014-03-18 10:55 ` pault at gcc dot gnu.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).