[PATCH] Add experimental::sample and experimental::shuffle from N4531
Jonathan Wakely
jwakely@redhat.com
Wed Jul 4 16:56:00 GMT 2018
On 29/06/18 10:45 +0100, Jonathan Wakely wrote:
>On 29/06/18 09:39 +0200, Christophe Lyon wrote:
>>On Fri, 29 Jun 2018 at 09:21, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>
>>>On 29/06/18 08:55 +0200, Christophe Lyon wrote:
>>>>On Mon, 25 Jun 2018 at 18:23, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>>>
>>>>> The additions to <experimental/random> were added in 2015 but the new
>>>>> algorithms in <experimental/algorithm> were not. This adds them.
>>>>>
>>>>> * include/experimental/algorithm (sample, shuffle): Add new overloads
>>>>> using per-thread random number engine.
>>>>> * testsuite/experimental/algorithm/sample.cc: Simpify and reduce
>>>>> dependencies by using __gnu_test::test_container.
>>>>> * testsuite/experimental/algorithm/sample-2.cc: New.
>>>>> * testsuite/experimental/algorithm/shuffle.cc: New.
>>>>>
>>>>> Tested x86_64-linux, committed to trunk.
>>>>>
>>>>> This would be safe to backport, but nobody has noticed the algos are
>>>>> missing or complained, so it doesn't seem very important to backport.
>>>>>
>>>>>
>>>>
>>>>Hi,
>>>>
>>>>On bare-metal targets (aarch64 and arm + newlib), I've noticed that
>>>>the two new tests fail:
>>>>PASS: experimental/algorithm/shuffle.cc (test for excess errors)
>>>>spawn /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc3/utils/bin/qemu-wrapper.sh
>>>>./shuffle.exe
>>>>terminate called after throwing an instance of 'std::runtime_error'
>>>> what(): random_device::random_device(const std::string&)
>>>>
>>>>*** EXIT code 4242
>>>>FAIL: experimental/algorithm/shuffle.cc execution test
>>>>
>>>>PASS: experimental/algorithm/sample-2.cc (test for excess errors)
>>>>spawn /aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc3/utils/bin/qemu-wrapper.sh
>>>>./sample-2.exe
>>>>terminate called after throwing an instance of 'std::runtime_error'
>>>> what(): random_device::random_device(const std::string&)
>>>>
>>>>*** EXIT code 4242
>>>>FAIL: experimental/algorithm/sample-2.cc execution test
>>>>
>>>>Does this ring a bell?
>>>
>>>Does the existing testsuite/experimental/random/randint.cc file fail
>>>in the same way?
>>>
>>
>>Yes it does.
>>
>>And so do:
>>25_algorithms/make_heap/complexity.cc
>
>This one also uses std::random_device.
>
>>23_containers/array/element_access/at_neg.cc
>
>Hmm,
>
> // Expected behavior is to either throw and have the uncaught
> // exception end up in a terminate handler which eventually exits,
> // or abort. (Depending on -fno-exceptions.)
>
>So this is expected to XFAIL.
>
>>26_numerics/random/random_device/cons/default.cc
>
>We should XFAIL the ones that use std::random_device, if we can
>identify an effective target to describe them.
This adds a new "random_device" effective-target, so the tests are
disabled when the random_device isn't usable.
Tested powerpc64le-linux, committed to trunk. If this works for
Christophe's bare metal targets I'll backport it to gcc-8-branch too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 4547 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180704/41699afe/attachment.bin>
More information about the Libstdc++
mailing list