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

            Bug ID: 83752
           Summary: gfortran.dg/common_align_2.f90 fails in execution for
                    target with __BIGGEST_ALIGNMENT__ < 8
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

The test contains a list of common vars:
...
  real(8) x, y
  common i, x, j, y ! { dg-warning "Padding" }                                  
...

and assumes a byte layout:
...
i:  0-3
x:  8-15
j: 16-19
y: 24-31
...
based on 8-byte alignment for the real(8).

On targets with BIGGEST_ALIGNMENT == 32 (so __BIGGEST_ALIGNMENT__ == 4), we
have instead:
...
i:  0-3
x:  4-11
j: 12-15
y: 16-23
...

So this minimal version:
...
subroutine foo ()
  common i(8)
  if ((i(5) .ne. 43)) call abort
end subroutine

  real(8) x, y
  common i, x, j, y
  j = 43
  call foo ()
end
...
tests i(5), which is at offset ((5 - 1) * 4) == 16, where it expects to find j,
but instead finds y.

This test needs a:
...
! { dg-require-biggest-alignment ">=" "8" }
...
or some such.

Just adding -cpp and conditionalizing on __BIGGEST_ALIGNMENT__ will work for
the execution failure, but not for the missing padding warning.

Reply via email to