[gcc r15-1065] Clean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]"
Thomas Schwinge
tschwinge@gcc.gnu.org
Thu Jun 6 11:47:50 GMT 2024
https://gcc.gnu.org/g:395ac0417a17ba6405873f891f895417d696b603
commit r15-1065-g395ac0417a17ba6405873f891f895417d696b603
Author: Thomas Schwinge <tschwinge@baylibre.com>
Date: Wed Jun 5 14:34:06 2024 +0200
Clean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]"
PR target/85463
libgfortran/
* runtime/minimal.c [__nvptx__] (exit): Don't override.
libgomp/
* config/nvptx/error.c (exit): Don't override.
* testsuite/libgomp.oacc-fortran/error_stop-1.f: Update.
* testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-3.f: Likewise.
Diff:
---
libgfortran/runtime/minimal.c | 8 --------
libgomp/config/nvptx/error.c | 7 -------
libgomp/testsuite/libgomp.oacc-fortran/error_stop-1.f | 8 +++++---
libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f | 8 +++++---
libgomp/testsuite/libgomp.oacc-fortran/error_stop-3.f | 8 +++++---
libgomp/testsuite/libgomp.oacc-fortran/stop-1.f | 13 +++++++++----
libgomp/testsuite/libgomp.oacc-fortran/stop-2.f | 6 +++++-
libgomp/testsuite/libgomp.oacc-fortran/stop-3.f | 12 ++++++++----
8 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/libgfortran/runtime/minimal.c b/libgfortran/runtime/minimal.c
index f13b3a4bf90..619f818c844 100644
--- a/libgfortran/runtime/minimal.c
+++ b/libgfortran/runtime/minimal.c
@@ -31,14 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
-#if __nvptx__
-/* Map "exit" to "abort"; see PR85463 '[nvptx] "exit" in offloaded region
- doesn't terminate process'. */
-# undef exit
-# define exit(status) do { (void) (status); abort (); } while (0)
-#endif
-
-
#if __nvptx__
/* 'printf' is all we have. */
# undef estr_vprintf
diff --git a/libgomp/config/nvptx/error.c b/libgomp/config/nvptx/error.c
index 7e668276004..f7a2536c29b 100644
--- a/libgomp/config/nvptx/error.c
+++ b/libgomp/config/nvptx/error.c
@@ -58,11 +58,4 @@
#endif
-/* The 'exit (EXIT_FAILURE);' of an Fortran (only, huh?) OpenMP 'error'
- directive with 'severity (fatal)' causes a hang, so 'abort' instead of
- 'exit'. */
-#undef exit
-#define exit(status) abort ()
-
-
#include "../../error.c"
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-1.f b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-1.f
index de727749a53..3918d6853f6 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-1.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-1.f
@@ -16,14 +16,16 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
+
! { dg-output "ERROR STOP (\n|\r\n|\r)+" }
!
! In gfortran's main program, libfortran's set_options is called - which sets
! compiler_options.backtrace = 1 by default. For an offload libgfortran, this
! is never called and, hence, "Error termination." is never printed. Thus:
! { dg-output "Error termination.*" { target { ! { openacc_nvidia_accel_selected || openacc_radeon_accel_selected } } } }
-!
-! PR85463:
+
+! PR85463. The 'exit' implementation used with nvptx
+! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
-!
+
! { dg-shouldfail "" }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f
index 475c9cb5850..5951e8cbe64 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-2.f
@@ -16,14 +16,16 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
+
! { dg-output "ERROR STOP 35(\n|\r\n|\r)+" }
!
! In gfortran's main program, libfortran's set_options is called - which sets
! compiler_options.backtrace = 1 by default. For an offload libgfortran, this
! is never called and, hence, "Error termination." is never printed. Thus:
! { dg-output "Error termination.*" { target { ! { openacc_nvidia_accel_selected || openacc_radeon_accel_selected } } } }
-!
-! PR85463:
+
+! PR85463. The 'exit' implementation used with nvptx
+! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
-!
+
! { dg-shouldfail "" }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-3.f b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-3.f
index ab63444ce34..15e02d8b744 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/error_stop-3.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/error_stop-3.f
@@ -16,14 +16,16 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
+
! { dg-output "ERROR STOP SiGN(\n|\r\n|\r)+" }
!
! In gfortran's main program, libfortran's set_options is called - which sets
! compiler_options.backtrace = 1 by default. For an offload libgfortran, this
! is never called and, hence, "Error termination." is never printed. Thus:
! { dg-output "Error termination.*" { target { ! { openacc_nvidia_accel_selected || openacc_radeon_accel_selected } } } }
-!
-! PR85463:
+
+! PR85463. The 'exit' implementation used with nvptx
+! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
-!
+
! { dg-shouldfail "" }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/stop-1.f b/libgomp/testsuite/libgomp.oacc-fortran/stop-1.f
index 2c00d2e5bf8..590b3c97da4 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/stop-1.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/stop-1.f
@@ -16,11 +16,16 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
-! PR85463. The "minimal" libgfortran implementation used with nvptx
+
+! { dg-output "" }
+!
+! PR85463. The 'exit' implementation used with nvptx
! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
+
! { dg-output "$" }
+
! PR85463. STOP with code zero (as implied here) should actually
-! terminate the process normally, but doesn't in the "minimal"
-! libgfortran implementation used with nvptx offloading.
-! { dg-shouldfail "" { openacc_nvidia_accel_selected } }
+! terminate the process normally, but doesn't with the 'exit'
+! implementation used with nvptx offloading.
+! { dg-shouldfail PR85463 { openacc_nvidia_accel_selected } }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f b/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f
index adade54557c..fe7ee37813a 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/stop-2.f
@@ -16,9 +16,13 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
+
! { dg-output "STOP 35(\n|\r\n|\r)+" }
-! PR85463. The "minimal" libgfortran implementation used with nvptx
+!
+! PR85463. The 'exit' implementation used with nvptx
! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
+
! { dg-output "$" }
+
! { dg-shouldfail "" }
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/stop-3.f b/libgomp/testsuite/libgomp.oacc-fortran/stop-3.f
index 157e369d4e7..b28989895b5 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/stop-3.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/stop-3.f
@@ -16,12 +16,16 @@
END PROGRAM MAIN
! { dg-output "CheCKpOInT(\n|\r\n|\r)+" }
+
! { dg-output "STOP SiGN(\n|\r\n|\r)+" }
-! PR85463. The "minimal" libgfortran implementation used with nvptx
+!
+! PR85463. The 'exit' implementation used with nvptx
! offloading is a little bit different.
! { dg-output "libgomp: cuStreamSynchronize error.*" { target openacc_nvidia_accel_selected } }
+
! { dg-output "$" }
+
! PR85463. STOP with code zero (as implied here) should actually
-! terminate the process normally, but doesn't in the "minimal"
-! libgfortran implementation used with nvptx offloading.
-! { dg-shouldfail "" { openacc_nvidia_accel_selected } }
+! terminate the process normally, but doesn't with the 'exit'
+! implementation used with nvptx offloading.
+! { dg-shouldfail PR85463 { openacc_nvidia_accel_selected } }
More information about the Gcc-cvs
mailing list