abort might not flush all open streams before process termination (was: aarch64-suse-linux-gnu: libgomp.oacc-c-c++-common/abort-1.c, libgomp.oacc-c-c++-common/abort-3.c FAILs)
From: Thomas Schwinge <hidden>
Date: 2015-10-07 10:13:41
Hi! Copying glibc for your information/in case anyone has any further comments, and the man-pages maintainer, Michael Kerrisk. The issue is that abort might not flush all open streams before process termination; original thread starting at <http://news.gmane.org/find-root.php?message_id=%3C87twq4p9f4.fsf%40kepler.schwinge.homeip.net%3E>. On Tue, 06 Oct 2015 13:55:00 +0200, Andreas Schwab [off-list ref] wrote:
Thomas Schwinge [off-list ref] writes:quoted
| The two regressed test cases use __builtin_printf instead of fprintf to | stderr, but as far as I know, abort is to flush all open streams before | process termination?It can't, since abort must be async-signal-safe.
It's still surprising to me that the message written to stderr is lost in your aarch64-suse-linux-gnu configuration (only): from a quick look, (current) glibc's stdlib/abort.c tries to actually close/flush all open streams before process termination. This is also what's documented on <http://man7.org/linux/man-pages/man3/abort.3.html>: "all open streams are closed and flushed". <http://pubs.opengroup.org/onlinepubs/9699919799/functions/abort.html> does sound more "conservative": "[abort] may include an attempt to effect fclose() on all open streams". Should the man-page be edited to that effect? And, the following patch be applied to GCC? commit e270bce5dadf61b838706c4cfb824fa9dd22fb93 Author: Thomas Schwinge [off-list ref] Date: Wed Oct 7 11:52:15 2015 +0200 abort might not flush all open streams before process termination libgomp/ * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Print to stderr. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. --- libgomp/testsuite/libgomp.oacc-c-c++-common/abort-1.c | 3 ++- libgomp/testsuite/libgomp.oacc-c-c++-common/abort-3.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/abort-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/abort-1.c
index 6a9b1df..296708f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/abort-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/abort-1.c@@ -1,11 +1,12 @@ /* { dg-do run } */ +#include <stdio.h> #include <stdlib.h> int main (void) { - __builtin_printf ("CheCKpOInT\n"); + fprintf (stderr, "CheCKpOInT\n"); #pragma acc parallel { abort ();
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/abort-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/abort-3.c
index 2c8f347..bca425e 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/abort-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/abort-3.c@@ -1,11 +1,12 @@ /* { dg-do run } */ +#include <stdio.h> #include <stdlib.h> int main (void) { - __builtin_printf ("CheCKpOInT\n"); + fprintf (stderr, "CheCKpOInT\n"); #pragma acc kernels { abort ();
Grüße, Thomas
Attachments
- signature.asc [application/pgp-signature] 472 bytes