[Patch ARM] Fix PR45070 - Miscompiled c++ class with packed attribute on ARM with -Os optimizations
Mikael Pettersson
mikpe@it.uu.se
Wed Aug 11 15:30:00 GMT 2010
Ian Bolton writes:
> This patch fixes PR45070, and provides a regression test for it.
>
> The bug was caused by a faulty assumption that arm_size_return_regs() did
> not return values in the range 1-3. This meant that the return value for
> a packed struct containing a short could sometimes be clobbered for -Os,
> as shown by the supplied regression test.
...
> --- /dev/null 2010-05-18 17:29:48.296470258 +0100
> +++ gcc/testsuite/gcc.target/arm/pr45070.c 2010-08-11 11:43:32.187695894 +0100
> @@ -0,0 +1,54 @@
> +/* PR45070 */
> +/* { dg-do run { target arm*-*-* } } */
> +/* { dg-options "-mcpu=cortex-a8 -Os" } */
The test case options appear to be incorrect.
1. You'd end up trying to execute cortex-a8 specific object
code on non cortex-a8 compatible CPUs.
2. The bug and the test case are not specific to cortex-a8.
In the PR trail you see at least two people confirming the
bug on plain old armv5te.
The test shouldn't need any option except "-Os".
/Mikael
More information about the Gcc-patches
mailing list