[Bug fortran/57522] [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component

2013-06-04 Thread alan.briolat at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57522

--- Comment #1 from Alan Briolat  ---
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?


[Bug fortran/57522] New: [F03] ASSOCIATE construct creates array descriptor with incorrect stride for derived type array component

2013-06-04 Thread alan.briolat at gmail dot com
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.