I changed the defaults for cris*-linux*, but didn't fix the test-suite to go with that, so with unaligned accesses working, the test-suite still checked that they trapped, doh. Here's the update, checked trunk cris-elf and crisv32-elf (because of difference in atomics) and crisv32-linux* on the local 4.7 import - sorry, no actual trunk results. Some new tests piggy-backed to check that unaligned atomics don't fall over when exposed to actual unaligned accesses, but the results of the operations aren't properly checked. A buglet fixed; a local var shadowed the intended global var. Committed.
gcc/testsuite: Handle recent changes in default atomics for cris*-*-linux*. * gcc.target/cris/torture/sync-mis-xchg-i-1ml.c, gcc.target/cris/torture/sync-mis-xchg-i-2ml.c, gcc.target/cris/torture/sync-mis-xchg-i-3ml.c, gcc.target/cris/torture/sync-mis-xchg-s-1ml.c, gcc.target/cris/torture/sync-mis-op-i-1ml.c, gcc.target/cris/torture/sync-mis-op-i-2ml.c, gcc.target/cris/torture/sync-mis-op-i-3ml.c, gcc.target/cris/torture/sync-mis-op-s-1ml.c: New tests. * gcc.target/cris/torture/sync-mis-op-i-2a.c: Make sure -mno-unaligned-atomic-may-use-library is in effect for cris*-*-linux*. * gcc.target/cris/torture/sync-mis-xchg-i-1.c, gcc.target/cris/torture/sync-mis-xchg-i-2.c, gcc.target/cris/torture/sync-mis-xchg-i-3.c, gcc.target/cris/torture/sync-mis-xchg-i-2a.c, gcc.target/cris/torture/sync-mis-xchg-s-1.c, gcc.target/cris/torture/sync-mis-op-i-1.c, gcc.target/cris/torture/sync-mis-op-i-2.c, gcc.target/cris/torture/sync-mis-op-i-1a.c, gcc.target/cris/torture/sync-mis-op-i-3.c, gcc.target/cris/torture/sync-mis-op-i-3a.c, gcc.target/cris/torture/sync-mis-op-s-1a.c, gcc.target/cris/torture/sync-mis-xchg-i-1a.c, gcc.target/cris/torture/sync-mis-xchg-i-3a.c, gcc.target/cris/torture/sync-mis-xchg-s-1a.c: Similar. * gcc.target/cris/torture/sync-mis-op-s-1.c: Ditto. (main): Remove local variable x. [mis_ok]: Check that atomics don't fail. Index: gcc.target/cris/torture/sync-mis-op-i-2a.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-2a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-2a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dop -Dtype=int -Dmisalignment=2 -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-1ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-1ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-xchg-i-1ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dxchg -Dtype=int -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-2ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-2ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-xchg-i-2ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2 -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-3ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-3ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-xchg-i-3ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3 -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-1.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-1.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-1.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dxchg -Dtype=int" } */ +/* { dg-options "-Dxchg -Dtype=int -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-2.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-2.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-2.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2" } */ +/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2 -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-3.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-3.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-3.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3" } */ +/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3 -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-2a.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-2a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-2a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2 -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-s-1ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-s-1ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-xchg-s-1ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dxchg -Dtype=short -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-s-1.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-s-1.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-s-1.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dxchg -Dtype=short" } */ +/* { dg-options "-Dxchg -Dtype=short -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-1ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-1ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-op-i-1ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dop -Dtype=int -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-2ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-2ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-op-i-2ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dop -Dtype=int -Dmisalignment=2 -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-3ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-3ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-op-i-3ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dop -Dtype=int -Dmisalignment=3 -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-1.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-1.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-1.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dop -Dtype=int" } */ +/* { dg-options "-Dop -Dtype=int -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-2.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-2.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-2.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dop -Dtype=int -Dmisalignment=2" } */ +/* { dg-options "-Dop -Dtype=int -Dmisalignment=2 -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-1a.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-1a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-1a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dop -Dtype=int -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-3.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-3.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-3.c (working copy) @@ -1,4 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dop -Dtype=int -Dmisalignment=3" } */ +/* { dg-options "-Dop -Dtype=int -Dmisalignment=3 -mno-unaligned-atomic-may-use-library" } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-i-3a.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-i-3a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-i-3a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dop -Dtype=int -Dmisalignment=3 -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-s-1ml.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-s-1ml.c (revision 0) +++ gcc.target/cris/torture/sync-mis-op-s-1ml.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-additional-sources "../sync-1.c" } */ +/* { dg-options "-Dop -Dtype=short -Dmis_ok" } */ +#include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-op-s-1.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-s-1.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-s-1.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do run { target *-*-linux* } } */ /* { dg-additional-sources "../sync-1.c" } */ -/* { dg-options "-Dop -Dtype=short" } */ +/* { dg-options "-Dop -Dtype=short -mno-unaligned-atomic-may-use-library" } */ /* Make sure we get a SIGTRAP or equivalent when passing unaligned but otherwise valid pointers to the atomic builtins. */ @@ -76,7 +76,6 @@ void trap_handler(int signum) int main(void) { - type x = 0; type ret; #ifndef TRAP_USING_ABORT @@ -86,7 +85,9 @@ int main(void) #endif #endif +#ifndef mis_ok trap_expected = 1; +#endif #if op sfa (&s.i, &s.i, 42); @@ -98,10 +99,24 @@ int main(void) should do it. */ trap_expected = 0; +#ifdef mis_ok + /* We're missing a sequence point, but we shouldn't have the initial + value. */ + if (s.i == (type) 0xdeadbeef) + abort (); + exit (0); +#endif + sfa (&x, &x, 1); #else acen (&s.i, &x, &ret); +#ifdef mis_ok + if (s.i != 2 || x != 2 || ret != (type) 0xdeadbeef) + abort (); + exit (0); +#endif + trap_expected = 0; acen (&x, &x, &ret); Index: gcc.target/cris/torture/sync-mis-op-s-1a.c =================================================================== --- gcc.target/cris/torture/sync-mis-op-s-1a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-op-s-1a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dop -Dtype=short -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-1a.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-1a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-1a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dxchg -Dtype=int -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-i-3a.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-i-3a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-i-3a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3 -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" Index: gcc.target/cris/torture/sync-mis-xchg-s-1a.c =================================================================== --- gcc.target/cris/torture/sync-mis-xchg-s-1a.c (revision 189754) +++ gcc.target/cris/torture/sync-mis-xchg-s-1a.c (working copy) @@ -2,4 +2,5 @@ /* { dg-additional-sources "../sync-1.c" } */ /* { dg-options "-Dxchg -Dtype=short -DTRAP_USING_ABORT -mno-trap-using-break8" } */ /* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */ +/* { dg-additional-options "-mno-unaligned-atomic-may-use-library" { target cris*-*-linux* } } */ #include "sync-mis-op-s-1.c" brgds, H-P