Bug 84442 - FAIL: 30_threads/thread/cons/terminate.cc (test for excess errors)
Summary: FAIL: 30_threads/thread/cons/terminate.cc (test for excess errors)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-18 19:19 UTC by John David Anglin
Modified: 2018-04-18 11:16 UTC (History)
2 users (show)

See Also:
Host: hppa*-*-hpux11*
Target: hppa*-*-hpux11*
Build: hppa*-*-hpux11*
Known to work:
Known to fail:
Last reconfirmed: 2018-02-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2018-02-18 19:19:19 UTC
spawn /test/gnu/gcc/objdir/./gcc/xg++ -shared-libgcc -B/test/gnu/gcc/objdir/./gc
c -nostdinc++ -L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/src -L/t
est/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/src/.libs -L/test/gnu/gcc/
objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/libsupc++/.libs -B/opt/gnu/gcc/gcc-8/h
ppa2.0w-hp-hpux11.11/bin/ -B/opt/gnu/gcc/gcc-8/hppa2.0w-hp-hpux11.11/lib/ -isyst
em /opt/gnu/gcc/gcc-8/hppa2.0w-hp-hpux11.11/include -isystem /opt/gnu/gcc/gcc-8/
hppa2.0w-hp-hpux11.11/sys-include -B/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libstdc++-v3/src/.libs -fmessage-length=0 -fno-show-column -g -O2 -DLOCALEDIR="." -nostdinc++ -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/include/hppa2.0w-hp-hpux11.11 -I/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/include -I/test/gnu/gcc/gcc/libstdc++-v3/libsupc++ -I/test/gnu/gcc/gcc/libstdc++-v3/include/backward -I/test/gnu/gcc/gcc/libstdc++-v3/testsuite/util /test/gnu/gcc/gcc/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc -pthread -fno-diagnostics-show-caret -fdiagnostics-color=never ./libtestc++.a -L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libstdc++-v3/src/filesystem/.libs -lm -o ./terminate.exe
/test/gnu/gcc/gcc/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc: In function 'void handle_terminate()':
/test/gnu/gcc/gcc/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc:31: error: '_Exit' is not a member of 'std'
Comment 1 Jonathan Wakely 2018-02-19 16:17:28 UTC
Does HPUX provide _exit() in <unistd.h> instead?
Comment 2 dave.anglin 2018-02-19 16:19:55 UTC
On 2018-02-19 11:17 AM, redi at gcc dot gnu.org wrote:
> Does HPUX provide _exit() in <unistd.h> instead?

Yes.
Comment 3 Jonathan Wakely 2018-02-19 16:21:05 UTC
OK then this should help:

--- a/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
@@ -25,10 +25,19 @@
 #include <thread>
 #include <exception>
 #include <cstdlib>
+#if !_GLIBCXX_USE_C99_STDLIB && defined _GLIBCXX_HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 void handle_terminate()
 {
+#if _GLIBCXX_USE_C99_STDLIB
   std::_Exit(0);
+#elif defined _GLIBCXX_HAVE_UNISTD_H
+  _exit(0);
+#else
+  std::exit(0);
+#endif
 }
 
 void f() { throw 1; }
Comment 4 Jonathan Wakely 2018-04-17 14:21:38 UTC
Dave, does the patch in comment 3 fix the FAIL?
Comment 5 dave.anglin 2018-04-18 01:32:30 UTC
On 2018-04-17 10:21 AM, redi at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84442
>
> --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Dave, does the patch in comment 3 fix the FAIL?
>
Yes, it fixes the fail.

Thanks,
Dave
Comment 6 Jonathan Wakely 2018-04-18 11:16:12 UTC
Author: redi
Date: Wed Apr 18 11:15:38 2018
New Revision: 259463

URL: https://gcc.gnu.org/viewcvs?rev=259463&root=gcc&view=rev
Log:
PR libstdc++/84442 if _Exit isn't declared then use _exit instead

	PR libstdc++/84442
	* testsuite/30_threads/thread/cons/terminate.cc
	[!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
Comment 7 Jonathan Wakely 2018-04-18 11:16:51 UTC
Thanks, this should be fixed on trunk now.