Committed: fortran [PR126964] Fold the element spacing on the field alignment

Jerry D jvdelisle2@gmail.com
Mon Sep 7 21:36:39 GMT 2026


Patch committed as simple/obvious.

One liner to take care of alignment on 32 bit machines. Testcases adjusted.

Regression tested x86_64 and x386.

The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:81092921c6393d4ed39aacb354228c55fc406d52

commit r17-3980-g81092921c6393d4ed39aacb354228c55fc406d52
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date:   Mon Sep 7 14:24:57 2026 -0700

     fortran: [PR126964] Fold the element spacing on the field alignment

     A target can align a component less strictly than its type: the i386
     ABI aligns a real(8) component to 4, so the spacing of one is not always a
     multiple of 8.  Compare against min_align_of_type instead.

             PR fortran/126964

     gcc/fortran/ChangeLog:

             * trans-array.cc: Include stor-layout.h.
             (gfc_span_folds_into_stride): Compare the element length against
             the least alignment of its type rather than the alignment.

     gcc/testsuite/ChangeLog:

             * gfortran.dg/target_dummy_span_2.f90: New test.
             * gfortran.dg/c_loc_test_22.f90: Expect the addressing of the
             target.
             * gfortran.dg/gomp/target-span-1.f90: Likewise.
             * gfortran.dg/target_dummy_repack_1.f90: Likewise.
             * gfortran.dg/target_dummy_span_1.f90: Likewise.
             * gfortran.dg/class_to_type_9.f90: Do not assert whether an
             assumed shape dummy is passed the strides or a copy.


More information about the Fortran mailing list