diff mbox series

[committed] testsuite: Fix up pr84508* tests [PR84508]

Message ID Zj0eIcO/zXNoGbih@tucnak
State New
Headers show
Series [committed] testsuite: Fix up pr84508* tests [PR84508] | expand

Commit Message

Jakub Jelinek May 9, 2024, 7:04 p.m. UTC
On Thu, May 09, 2024 at 12:45:42PM +0800, Hongtao Liu wrote:
> >         PR target/84508
> >         * gcc.target/i386/pr84508-1.c: New test.
> >         * gcc.target/i386/pr84508-2.c: Ditto.

The tests FAIL on x86_64-linux with
/usr/bin/ld: cannot find -lubsan
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: gcc.target/i386/pr84508-1.c (test for excess errors)
Excess errors:
/usr/bin/ld: cannot find -lubsan

The problem is that only *.dg/ubsan/ubsan.exp calls ubsan_init
which adds the needed search paths to libubsan library.
So, link/run tests for -fsanitize=undefined need to go into
gcc.dg/ubsan/ or g++.dg/ubsan/, even when they are target specific.

Tested on x86_64-linux with
make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} i386.exp=pr84508* ubsan.exp=pr84508*'
and committed to trunk as obvious.

2024-05-09  Jakub Jelinek  <jakub@redhat.com>

	PR target/84508
	* gcc.target/i386/pr84508-1.c: Move to ...
	* gcc.dg/ubsan/pr84508-1.c: ... here.  Restrict to i?86/x86_64
	non-ia32 targets.
	* gcc.target/i386/pr84508-2.c: Move to ...
	* gcc.dg/ubsan/pr84508-2.c: ... here.  Restrict to i?86/x86_64
	non-ia32 targets.


	Jakub

Comments

Hu, Lin1 May 10, 2024, 1:24 a.m. UTC | #1
> -----Original Message-----
> From: Jakub Jelinek <jakub@redhat.com>
> Sent: Friday, May 10, 2024 3:04 AM
> To: Hongtao Liu <crazylht@gmail.com>
> Cc: Hu, Lin1 <lin1.hu@intel.com>; gcc-patches@gcc.gnu.org; Liu, Hongtao
> <hongtao.liu@intel.com>; ubizjak@gmail.com
> Subject: [committed] testsuite: Fix up pr84508* tests [PR84508]
> 
> On Thu, May 09, 2024 at 12:45:42PM +0800, Hongtao Liu wrote:
> > >         PR target/84508
> > >         * gcc.target/i386/pr84508-1.c: New test.
> > >         * gcc.target/i386/pr84508-2.c: Ditto.
> 
> The tests FAIL on x86_64-linux with
> /usr/bin/ld: cannot find -lubsan
> collect2: error: ld returned 1 exit status compiler exited with status 1
> FAIL: gcc.target/i386/pr84508-1.c (test for excess errors) Excess errors:
> /usr/bin/ld: cannot find -lubsan
> 
> The problem is that only *.dg/ubsan/ubsan.exp calls ubsan_init which adds the
> needed search paths to libubsan library.
> So, link/run tests for -fsanitize=undefined need to go into gcc.dg/ubsan/ or
> g++.dg/ubsan/, even when they are target specific.
>

Oh, I get it, thanks.
 
>
> Tested on x86_64-linux with
> make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\}
> i386.exp=pr84508* ubsan.exp=pr84508*'
> and committed to trunk as obvious.
> 
> 2024-05-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/84508
> 	* gcc.target/i386/pr84508-1.c: Move to ...
> 	* gcc.dg/ubsan/pr84508-1.c: ... here.  Restrict to i?86/x86_64
> 	non-ia32 targets.
> 	* gcc.target/i386/pr84508-2.c: Move to ...
> 	* gcc.dg/ubsan/pr84508-2.c: ... here.  Restrict to i?86/x86_64
> 	non-ia32 targets.
> 
> diff --git a/gcc/testsuite/gcc.target/i386/pr84508-1.c
> b/gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
> similarity index 74%
> rename from gcc/testsuite/gcc.target/i386/pr84508-1.c
> rename to gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
> index bb3e28d017e..d78dddd1e01 100644
> --- a/gcc/testsuite/gcc.target/i386/pr84508-1.c
> +++ b/gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
> @@ -1,5 +1,6 @@
> -/* { dg-do run { target { ! ia32 } } } */
> +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } }
> +*/
>  /* { dg-options "-fsanitize=undefined" } */
> +
>  #include <emmintrin.h>
> 
>  int main()
> diff --git a/gcc/testsuite/gcc.target/i386/pr84508-2.c
> b/gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
> similarity index 73%
> rename from gcc/testsuite/gcc.target/i386/pr84508-2.c
> rename to gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
> index 32a8f20a536..cf9c7db1d15 100644
> --- a/gcc/testsuite/gcc.target/i386/pr84508-2.c
> +++ b/gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
> @@ -1,5 +1,6 @@
> -/* { dg-do run { target { ! ia32 } } } */
> +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } }
> +*/
>  /* { dg-options "-fsanitize=undefined" } */
> +
>  #include <emmintrin.h>
> 
>  int main()
> 
> 	Jakub
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/i386/pr84508-1.c b/gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
similarity index 74%
rename from gcc/testsuite/gcc.target/i386/pr84508-1.c
rename to gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
index bb3e28d017e..d78dddd1e01 100644
--- a/gcc/testsuite/gcc.target/i386/pr84508-1.c
+++ b/gcc/testsuite/gcc.dg/ubsan/pr84508-1.c
@@ -1,5 +1,6 @@ 
-/* { dg-do run { target { ! ia32 } } } */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
 /* { dg-options "-fsanitize=undefined" } */
+
 #include <emmintrin.h>
 
 int main()
diff --git a/gcc/testsuite/gcc.target/i386/pr84508-2.c b/gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
similarity index 73%
rename from gcc/testsuite/gcc.target/i386/pr84508-2.c
rename to gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
index 32a8f20a536..cf9c7db1d15 100644
--- a/gcc/testsuite/gcc.target/i386/pr84508-2.c
+++ b/gcc/testsuite/gcc.dg/ubsan/pr84508-2.c
@@ -1,5 +1,6 @@ 
-/* { dg-do run { target { ! ia32 } } } */
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
 /* { dg-options "-fsanitize=undefined" } */
+
 #include <emmintrin.h>
 
 int main()