On Mon, Mar 25, 2019 at 11:41:35AM -0600, Jeff Law wrote:
> > PR c/89812 - incorrect maximum in error: requested alignment 
> > ‘536870912’ exceeds maximum 2147483648
> > 
> > gcc/c-family/ChangeLog:
> > 
> >     PR c/89812
> >     * c-common.c (check_user_alignment): Rename local.  Correct maximum
> >     alignment in diagnostic.  Avoid assuming argument fits in SHWI,
> >     convert it to UHWI when it fits.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> >     PR c/89812
> >     * gcc.dg/attr-aligned-3.c: New test.
> OK

The test FAILs on all 32-bit targets (where __UINT64_TYPE__ is unsigned long
long) due to -pedantic-errors, and I bet will fail on all non-ELF targets on
AVR, because only config/elfos.h defines 1 << 28 as MAX_OFILE_ALIGNMENT (in
bytes) and the test relies on exactly that value, nothing else.

Fixed thusly, tested on x86_64-linux (-m32/-m64), ok for trunk?

If we have some elf targets that still don't use elfos.h, we might need to
add them next to avr too.

2019-03-26  Jakub Jelinek  <ja...@redhat.com>

        PR c/89812
        * gcc.dg/attr-aligned-3.c: Limit the test to known ELF targets
        other than AVR.  Add dg-options "".

--- gcc/testsuite/gcc.dg/attr-aligned-3.c.jj    2019-03-26 08:52:54.510611778 
+0100
+++ gcc/testsuite/gcc.dg/attr-aligned-3.c       2019-03-26 16:25:44.518085453 
+0100
@@ -1,7 +1,10 @@
 /* PR c/89812 - incorrect maximum in error: requested alignment '536870912'
    exceeds maximum 2147483648
-   { dg-do compile }
-   { dg-require-effective-target size32plus } */
+   Limit to ELF targets that are known to use MAX_OFILE_ALIGNMENT
+   (1 << 28) * BITS_PER_UNIT.
+   { dg-do compile { target { { *-*-elf* *-*-gnu* } && { ! avr*-*-* } } } }
+   { dg-require-effective-target size32plus }
+   { dg-options "" } */
 
 #define POWALIGN(N) __attribute__ ((aligned ((__UINT64_TYPE__)1 << (N))))
 


        Jakub

Reply via email to