https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119478

            Bug ID: 119478
           Summary: structure constructor is using the wrong stride
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargls at comcast dot net
  Target Milestone: ---

Created attachment 60890
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60890&action=edit
code showing the issue.

It appears that a structure constructor does not use the correct stride
when an array section is assigned to a component.

The testcase and its comments show the issue.

% gfcx -o z b.f90 -fcheck=all -fmax-errors=1 && ./z
 Display initial values of df
 row: 1     1.1000     1.2000
 row: 2     2.1000     2.2000
 row: 3     3.1000     3.2000
 row: 4     4.1000     4.2000
 row: 5     5.1000     5.2000
 row: 6     6.1000     6.2000
 row: 7     7.1000     7.2000
 row: 8     8.1000     8.2000

 Print df_new, should have rows 1, 4, 7 
 Shape(df_new%values)           3           2
 Bounds of df_new%values, dim 1:            1           3
 Bounds of df_new%values, dim 2:            1           2
 row: 1     1.1000     1.2000
 row: 2     2.1000     2.2000
 row: 3     3.1000     3.2000

 Print df_new, should have rows 1, 4, 7 
 Shape(df_new%values)           3           2
 Bounds of df_new%values, dim 1:            1           3
 Bounds of df_new%values, dim 2:            1           2
 row: 1     1.1000     1.2000
 row: 2     4.1000     4.2000
 row: 3     7.1000     7.2000

Reply via email to