public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: adjust call to abort in excess-precision-12
@ 2023-12-07 16:27 Marc Poulhiès
  2023-12-07 16:44 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Poulhiès @ 2023-12-07 16:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Marc Poulhiès

abort() is not always available, using the builtin as done in other
tests.

gcc/testsuite/ChangeLog:

	* g++.target/i386/excess-precision-12.C: call builtin_abort instead of abort.
---
Tested on x86_64-linux and x86_64-elf.

Ok for master?

 gcc/testsuite/g++.target/i386/excess-precision-12.C | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.target/i386/excess-precision-12.C b/gcc/testsuite/g++.target/i386/excess-precision-12.C
index dff48c07c8b..e59f7c3b1fb 100644
--- a/gcc/testsuite/g++.target/i386/excess-precision-12.C
+++ b/gcc/testsuite/g++.target/i386/excess-precision-12.C
@@ -13,8 +13,8 @@ main (void)
   unsigned long long int u = (1ULL << 63) + 1;
 
   if ((f <=> u) >= 0)
-    abort ();
+    __builtin_abort ();
 
   if ((u <=> f) <= 0)
-    abort ();
+    __builtin_abort ();
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] testsuite: adjust call to abort in excess-precision-12
  2023-12-07 16:27 [PATCH] testsuite: adjust call to abort in excess-precision-12 Marc Poulhiès
@ 2023-12-07 16:44 ` Jakub Jelinek
  2023-12-11 13:35   ` [PATCH v2] " Marc Poulhiès
  2023-12-11 13:36   ` [PATCH] " Marc Poulhiès
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2023-12-07 16:44 UTC (permalink / raw)
  To: Marc Poulhiès; +Cc: gcc-patches

On Thu, Dec 07, 2023 at 05:27:28PM +0100, Marc Poulhiès wrote:
> abort() is not always available, using the builtin as done in other
> tests.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.target/i386/excess-precision-12.C: call builtin_abort instead of abort.
> ---
> Tested on x86_64-linux and x86_64-elf.
> 
> Ok for master?
> 
>  gcc/testsuite/g++.target/i386/excess-precision-12.C | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/g++.target/i386/excess-precision-12.C b/gcc/testsuite/g++.target/i386/excess-precision-12.C
> index dff48c07c8b..e59f7c3b1fb 100644
> --- a/gcc/testsuite/g++.target/i386/excess-precision-12.C
> +++ b/gcc/testsuite/g++.target/i386/excess-precision-12.C
> @@ -13,8 +13,8 @@ main (void)
>    unsigned long long int u = (1ULL << 63) + 1;
>  
>    if ((f <=> u) >= 0)
> -    abort ();
> +    __builtin_abort ();
>  
>    if ((u <=> f) <= 0)
> -    abort ();
> +    __builtin_abort ();

Why wouldn't they have abort and what else does __builtin_abort () expand
to?
There are 2000+ other tests in gcc.target/i386/ which call abort (),
not __builtin_abort (), after including <stdlib.h> directly or indirectly
or declaring it themselves.  This test in particular includes <cstdlib>

Does whatever target you are running this into provide just std::abort ()
and not abort (); from <cstdlib>?  If so, perhaps it should call
std::abort (); instead of abort ().

	Jakub


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] testsuite: adjust call to abort in excess-precision-12
  2023-12-07 16:44 ` Jakub Jelinek
@ 2023-12-11 13:35   ` Marc Poulhiès
  2023-12-11 13:57     ` Jakub Jelinek
  2023-12-11 13:36   ` [PATCH] " Marc Poulhiès
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Poulhiès @ 2023-12-11 13:35 UTC (permalink / raw)
  To: jakub; +Cc: gcc-patches, poulhies

On non-hosted targets, cstdlib may not be sufficient to have abort
defined, but it should be for std::abort.

gcc/testsuite/ChangeLog:

	* g++.target/i386/excess-precision-12.C: call std::abort instead of abort.
---
Changed from calling __builtin_abort to std::abort, as advised.

Ok for master?

Thanks,
Marc

 gcc/testsuite/g++.target/i386/excess-precision-12.C | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.target/i386/excess-precision-12.C b/gcc/testsuite/g++.target/i386/excess-precision-12.C
index dff48c07c8b..7cfd15d6136 100644
--- a/gcc/testsuite/g++.target/i386/excess-precision-12.C
+++ b/gcc/testsuite/g++.target/i386/excess-precision-12.C
@@ -13,8 +13,8 @@ main (void)
   unsigned long long int u = (1ULL << 63) + 1;
 
   if ((f <=> u) >= 0)
-    abort ();
+    std::abort ();
 
   if ((u <=> f) <= 0)
-    abort ();
+    std::abort ();
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] testsuite: adjust call to abort in excess-precision-12
  2023-12-07 16:44 ` Jakub Jelinek
  2023-12-11 13:35   ` [PATCH v2] " Marc Poulhiès
@ 2023-12-11 13:36   ` Marc Poulhiès
  1 sibling, 0 replies; 5+ messages in thread
From: Marc Poulhiès @ 2023-12-11 13:36 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hello,

> Why wouldn't they have abort and what else does __builtin_abort () expand
> to?

It expands to abort but works around the "abort is undeclared" error.

> There are 2000+ other tests in gcc.target/i386/ which call abort (),
> not __builtin_abort (), after including <stdlib.h> directly or indirectly
> or declaring it themselves.  This test in particular includes <cstdlib>
>
> Does whatever target you are running this into provide just std::abort ()
> and not abort (); from <cstdlib>?  If so, perhaps it should call
> std::abort (); instead of abort ().

You are correct, std::abort() is a better solution. cstdlib does not
include stdlib.h because I'm on a non-hosted target. I'll send a
refreshed patch.

Thanks,
Marc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] testsuite: adjust call to abort in excess-precision-12
  2023-12-11 13:35   ` [PATCH v2] " Marc Poulhiès
@ 2023-12-11 13:57     ` Jakub Jelinek
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2023-12-11 13:57 UTC (permalink / raw)
  To: Marc Poulhiès; +Cc: gcc-patches

On Mon, Dec 11, 2023 at 02:35:52PM +0100, Marc Poulhiès wrote:
> On non-hosted targets, cstdlib may not be sufficient to have abort
> defined, but it should be for std::abort.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.target/i386/excess-precision-12.C: call std::abort instead of abort.
> ---
> Changed from calling __builtin_abort to std::abort, as advised.
> 
> Ok for master?

Ok.

	Jakub


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-11 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07 16:27 [PATCH] testsuite: adjust call to abort in excess-precision-12 Marc Poulhiès
2023-12-07 16:44 ` Jakub Jelinek
2023-12-11 13:35   ` [PATCH v2] " Marc Poulhiès
2023-12-11 13:57     ` Jakub Jelinek
2023-12-11 13:36   ` [PATCH] " Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).