diff mbox

[ARM] Improve guality tests - part 1 - pr36728-1.c

Message ID 54D1EF49.5080809@arm.com
State New
Headers show

Commit Message

Ramana Radhakrishnan Feb. 4, 2015, 10:07 a.m. UTC
Hi,

	I decided to spend some time looking at the large number of guality 
test failures on arm. I see a number of fails with 
gcc.dg/guality/pr36728-1.c as below. pr36728-2.c also fails in similar 
sort of ways. Before I go adjusting too many other tests I'd like to get 
some feedback regarding this from folks.

	On ARM parameters are passed in r0 - r3 which maps to arg1 - arg4. The 
code generated appears to use r0 for the return value and as a 
temporary. r2 and r3 are used as temporaries to adjust the stack as 
those are the first temporaries used in the register allocaton order. 
Therefore it is understandeable that arg1, arg3 and arg4 end up being 
"optimized" out and there is no chance of reclaiming the information at 
line #16 or line #18 in the testcase linked. r1 gets used at O2 and 
therefore that starts failing at O2 and above.

	Depending on optimization levels, registers used for arg1 - arg4 get 
reused at various optimization levels therefore we have no choice but to 
disable this lot.

	Once you do that the only failures left are with the variable 'y' at 
optimization levels O2 and O3 which I'm going to leave as is until the 
time as I understand what's going on here. My initial thought is that 
this also appears to be a testism, but I'm not a 100% sure yet.

I pondered adding a testsuite keyword for this but it appears to be so 
special cased per target, that I don't see any easy way of handling this 
as each target appears to be special in the way in which it handles this 
- fundamentally would end up depending on the number of registers used 
as parameter registers and being caller saved registers and that varies 
from port to port.


FAIL: gcc.dg/guality/pr36728-1.c   -O1  line 16 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O1  line 16 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O1  line 18 arg1 == 1
FAIL: gcc.dg/guality/pr36728-1.c   -O1  line 18 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O1  line 18 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 18 arg2 == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 18 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 18 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 18 arg2 == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 18 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 18 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  line 18 arg1 == 1
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  line 18 arg2 == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  line 18 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  line 18 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 18 
arg2 == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 18 
arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 18 
arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 18 arg2 == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 18 arg3 == 3
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 18 arg4 == 4
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 18 y == 2

to

FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 16 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 16 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -fomit-frame-pointer  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 16 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O3 -g  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 16 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fno-use-linker-plugin 
-flto-partition=none  line 18 y == 2
FAIL: gcc.dg/guality/pr36728-1.c   -O2 -flto -fuse-linker-plugin 
-fno-fat-lto-objects  line 16 y == 2


Changelog:

* gcc.dg/guality/pr36728-1.c: Skip some tests for arm.

Ok ? Thoughts ?

regards,
Ramana


P.S. I got caught out by the yama security module in the kernel 
preventing me from running some of the guality tests on the chromebook I 
was running this on. 
https://www.kernel.org/doc/Documentation/security/Yama.txt. JFTR it may 
be a good idea to do

  echo 0 > /proc/sys/kernel/yama/ptrace_scope


to get these things to work. Also I was using a trunk gdb to get these 
results.

Comments

Ramana Radhakrishnan Feb. 4, 2015, 11:03 a.m. UTC | #1
>
> Changelog:
>
> * gcc.dg/guality/pr36728-1.c: Skip some tests for arm.
>

Segher and I discussed an alternative approach - marking these as "m"
(arg1) , "m" (arg2) .... etc in the asm blocks also gives us the same
effect and then probably removes the need to rely on such target
markers.  I've just noticed that the AArch64 port has the same issues.

I'll spin something up along those lines, maybe that is more acceptable

Ramana
Jakub Jelinek Feb. 4, 2015, 11:10 a.m. UTC | #2
On Wed, Feb 04, 2015 at 11:03:29AM +0000, Ramana Radhakrishnan wrote:
> >
> > Changelog:
> >
> > * gcc.dg/guality/pr36728-1.c: Skip some tests for arm.
> >
> 
> Segher and I discussed an alternative approach - marking these as "m"
> (arg1) , "m" (arg2) .... etc in the asm blocks also gives us the same
> effect and then probably removes the need to rely on such target
> markers.  I've just noticed that the AArch64 port has the same issues.

I don't think it is a good idea to significantly change the function being
tested.  Then it tests completely different thing from what it is meant to
test.
But in the pr36728-{1,2}.c case, perhaps you could instead change the
caller, by adding
  asm volatile ("" : : "r" (l));
before return 0; in main, that way DW_OP_GNU_entry_value could work if there
is no other way to find the value of the arguments, because l will need to
live somewhere (in some register or memory) across the foo call.

	Jakub
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-1.c b/gcc/testsuite/gcc.dg/guality/pr36728-1.c
index ba7a6c2..6e6ba3f 100644
--- a/gcc/testsuite/gcc.dg/guality/pr36728-1.c
+++ b/gcc/testsuite/gcc.dg/guality/pr36728-1.c
@@ -23,20 +23,23 @@  foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
    when adjusting the addresses in order to meet the alignment
    requirements above.  They usually hold the function arguments arg1
    and arg2.  So it is expected that these values are unavailable in
-   some of these tests.  */
+   some of these tests.  On ARM, a similar problem occurs with registers
+   r0-r3 which contain arg1-arg4.  The registers r0-r3 are caller saved
+   and are used for various purposes including aligning the stack and
+   holding temporaries, thereby destroying the values in their parameters.  */
 
-/* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 16 "arg3" "3" } } */
-/* { dg-final { gdb-test 16 "arg4" "4" } } */
+/* { dg-final { gdb-test 16 "arg1" "1" { target { { ! "s390*-*-*" } && { ! "arm*-*-*" } } } } } */
+/* { dg-final { gdb-test 16 "arg2" "2" { target { { ! "s390*-*-*" } && { ! "arm*-*-*" } } } } } */
+/* { dg-final { gdb-test 16 "arg3" "3" { target { ! "arm*-*-*" } } } } */
+/* { dg-final { gdb-test 16 "arg4" "4" { target { ! "arm*-*-*" } } } } */
 /* { dg-final { gdb-test 16 "arg5" "5" } } */
 /* { dg-final { gdb-test 16 "arg6" "6" } } */
 /* { dg-final { gdb-test 16 "arg7" "30" } } */
 /* { dg-final { gdb-test 16 "y" "2" } } */
-/* { dg-final { gdb-test 18 "arg1" "1" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 18 "arg2" "2" { target { ! "s390*-*-*" } } } } */
-/* { dg-final { gdb-test 18 "arg3" "3" } } */
-/* { dg-final { gdb-test 18 "arg4" "4" } } */
+/* { dg-final { gdb-test 18 "arg1" "1" { target { { ! "s390*-*-*" } && { ! "arm*-*-*" } } } } } */
+/* { dg-final { gdb-test 18 "arg2" "2" { target { { ! "s390*-*-*" } && { ! "arm*-*-*" } } } } } */
+/* { dg-final { gdb-test 18 "arg3" "3" { target { ! "arm*-*-*" } } } } */
+/* { dg-final { gdb-test 18 "arg4" "4" { target { ! "arm*-*-*" } } } } */
 /* { dg-final { gdb-test 18 "arg5" "5" } } */
 /* { dg-final { gdb-test 18 "arg6" "6" } } */
 /* { dg-final { gdb-test 18 "arg7" "30" } } */