Bug 81266 - FAIL: 30_threads/thread/native_handle/typesizes.cc execution test on darwin
Summary: FAIL: 30_threads/thread/native_handle/typesizes.cc execution test on darwin
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.4
Assignee: Jonathan Wakely
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-30 15:06 UTC by Dominique d'Humieres
Modified: 2019-05-11 11:39 UTC (History)
4 users (show)

See Also:
Host: x86_64-apple-darwin16
Target: x86_64-apple-darwin16
Build: x86_64-apple-darwin16
Known to work:
Known to fail:
Last reconfirmed: 2018-12-03 00:00:00


Attachments
updated patch (406 bytes, patch)
2019-05-10 16:15 UTC, Iain Sandoe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2017-06-30 15:06:35 UTC
After revision r249217 the test 30_threads/thread/native_handle/typesizes.cc fails at run time on darwin with (it was UNSUPPORTED before this revision)

terminate called after throwing an instance of 'std::runtime_error'
  what():
size of _Tp: 4
alignment of _Tp: 4
size of *(_Tp::native_handle_type): 4096
alignment of *(_Tp::native_handle_type): 4096
Comment 1 Jonathan Wakely 2017-06-30 15:52:16 UTC
This was previously only run for GNU/Linux, Solaris and AIX, but is now enabled for all pthreads targets. I don't think this particular test will ever pass for targets where is_pointer<pthread_t> is true.
Comment 2 Iain Sandoe 2018-12-03 16:44:22 UTC
(In reply to Jonathan Wakely from comment #1)
> This was previously only run for GNU/Linux, Solaris and AIX, but is now
> enabled for all pthreads targets. I don't think this particular test will
> ever pass for targets where is_pointer<pthread_t> is true.

So - just skip this on Darwin, or invent some new target supports test for pthread-non-pointer? (not entirely sure that would be unequivocally trivial)
Comment 3 Alexandre Oliva 2019-05-10 16:00:31 UTC
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00493.html has a patch
Comment 4 Iain Sandoe 2019-05-10 16:15:04 UTC
Created attachment 46341 [details]
updated patch

I'm testing this - the posted one didn't build on Darwin.
Comment 5 Jonathan Wakely 2019-05-10 21:41:59 UTC
Author: redi
Date: Fri May 10 21:41:23 2019
New Revision: 271080

URL: https://gcc.gnu.org/viewcvs?rev=271080&root=gcc&view=rev
Log:
PR libstdc++/81266 fix std::thread::native_handle_type test

The test uses remove_pointer because in most cases native_handle_type is
a pointer to the actual type that the C++ class contains. However, for
std::thread, native_handle_type is the same type as the type contained
in std::thread, and so remove_pointer is not needed. On targets where
pthread_t is a pointer type remove_pointer<native_handle_type> is not a
no-op, instead it transforms pthread_t and causes the test to fail.

The fix is to not apply remove_pointer when testing std::thread.

	PR libstdc++/81266
	* testsuite/util/thread/all.h: Do not use remove_pointer for
	std::thread::native_handle_type.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/testsuite/util/thread/all.h
Comment 6 Iain Sandoe 2019-05-11 07:51:13 UTC
Fixed on trunk, needed on 9 and 8.
Comment 7 Jonathan Wakely 2019-05-11 11:36:32 UTC
Author: redi
Date: Sat May 11 11:35:59 2019
New Revision: 271094

URL: https://gcc.gnu.org/viewcvs?rev=271094&root=gcc&view=rev
Log:
PR libstdc++/81266 fix std::thread::native_handle_type test

The test uses remove_pointer because in most cases native_handle_type is
a pointer to the actual type that the C++ class contains. However, for
std::thread, native_handle_type is the same type as the type contained
in std::thread, and so remove_pointer is not needed. On targets where
pthread_t is a pointer type remove_pointer<native_handle_type> is not a
no-op, instead it transforms pthread_t and causes the test to fail.

The fix is to not apply remove_pointer when testing std::thread.

Backport from mainline
2019-05-10  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/81266
	* testsuite/util/thread/all.h: Do not use remove_pointer for
	std::thread::native_handle_type.

Modified:
    branches/gcc-9-branch/libstdc++-v3/ChangeLog
    branches/gcc-9-branch/libstdc++-v3/testsuite/util/thread/all.h
Comment 8 Jonathan Wakely 2019-05-11 11:39:22 UTC
Author: redi
Date: Sat May 11 11:38:51 2019
New Revision: 271095

URL: https://gcc.gnu.org/viewcvs?rev=271095&root=gcc&view=rev
Log:
PR libstdc++/81266 fix std::thread::native_handle_type test

The test uses remove_pointer because in most cases native_handle_type is
a pointer to the actual type that the C++ class contains. However, for
std::thread, native_handle_type is the same type as the type contained
in std::thread, and so remove_pointer is not needed. On targets where
pthread_t is a pointer type remove_pointer<native_handle_type> is not a
no-op, instead it transforms pthread_t and causes the test to fail.

The fix is to not apply remove_pointer when testing std::thread.

Backport from mainline
2019-05-10  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/81266
	* testsuite/util/thread/all.h: Do not use remove_pointer for
	std::thread::native_handle_type.

Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/testsuite/util/thread/all.h
Comment 9 Jonathan Wakely 2019-05-11 11:39:40 UTC
Fixed for 8.4 and 9.2