• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

GCC with patches for OS216


Commit MetaInfo

Revision14d4e7bc303a92f620eddcba9cef88da7e91514c (tree)
Zeit2020-07-03 03:14:21
AutorJonathan Wakely <jwakely.gcc@gmai...>
CommiterJonathan Wakely

Log Message

libstdc++: Fix atomic<long double> tests (PR 91153, PR 93224)

These tests fail with AIX double double. Use different floating point
values that behave less surprisingly.

libstdc++-v3/ChangeLog:

PR libstdc++/91153
PR target/93224
* testsuite/29_atomics/atomic_float/1.cc: Use different values
for tests.
* testsuite/29_atomics/atomic_ref/float.cc: Likewise.

(cherry picked from commit c6f431bba531bac3212b66069cf0f9718edf0132)

Ändern Zusammenfassung

Diff

--- a/libstdc++-v3/testsuite/29_atomics/atomic_float/1.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/1.cc
@@ -453,27 +453,28 @@ test03()
453453 ok = a1.compare_exchange_strong(expected, 3.2l, mo);
454454 VERIFY( !ok && a1.load() == 2.56l && expected == 2.56l );
455455
456- f0 = a0.fetch_add(1.2l);
457- VERIFY( f0 == 12.8l );
458- VERIFY( a0 == 14.0l );
459- f1 = a1.fetch_add(2.4l, mo);
460- VERIFY( f1 == 2.56l );
461- VERIFY( a1 == 4.96l );
462-
463- f0 = a0.fetch_sub(1.2l);
464- VERIFY( f0 == 14.0l );
465- VERIFY( a0 == 12.8l );
466- f1 = a1.fetch_sub(3.5l, mo);
467- VERIFY( f1 == 4.96l );
468- VERIFY( a1 == 1.46l );
469-
470- f0 = a0 += 1.2l;
471- VERIFY( f0 == 14.0l );
472- VERIFY( a0 == 14.0l );
473-
474- f0 = a0 -= 0.8l;
475- VERIFY( f0 == 13.2l );
476- VERIFY( a0 == 13.2l );
456+ a1 = a0 = 0.5l;
457+ f0 = a0.fetch_add(0.25l);
458+ VERIFY( f0 == 0.5l );
459+ VERIFY( a0 == 0.75l );
460+ f1 = a1.fetch_add(0.25l, mo);
461+ VERIFY( f1 == 0.5l );
462+ VERIFY( a1 == 0.75l );
463+
464+ f0 = a0.fetch_sub(0.5l);
465+ VERIFY( f0 == 0.75l );
466+ VERIFY( a0 == 0.25l );
467+ f1 = a1.fetch_sub(0.5l, mo);
468+ VERIFY( f1 == 0.75l );
469+ VERIFY( a1 == 0.25l );
470+
471+ f0 = a0 += 0.75l;
472+ VERIFY( f0 == 1.0l );
473+ VERIFY( a0 == 1.0l );
474+
475+ f0 = a0 -= 0.5l;
476+ VERIFY( f0 == 0.5l );
477+ VERIFY( a0 == 0.5l );
477478 }
478479
479480 // Repeat for volatile std::atomic<long double>
@@ -540,27 +541,28 @@ test03()
540541 ok = a1.compare_exchange_strong(expected, 3.2l, mo);
541542 VERIFY( !ok && a1.load() == 2.56l && expected == 2.56l );
542543
543- f0 = a0.fetch_add(1.2l);
544- VERIFY( f0 == 12.8l );
545- VERIFY( a0 == 14.0l );
546- f1 = a1.fetch_add(2.4l, mo);
547- VERIFY( f1 == 2.56l );
548- VERIFY( a1 == 4.96l );
549-
550- f0 = a0.fetch_sub(1.2l);
551- VERIFY( f0 == 14.0l );
552- VERIFY( a0 == 12.8l );
553- f1 = a1.fetch_sub(3.5l, mo);
554- VERIFY( f1 == 4.96l );
555- VERIFY( a1 == 1.46l );
556-
557- f0 = a0 += 1.2l;
558- VERIFY( f0 == 14.0l );
559- VERIFY( a0 == 14.0l );
560-
561- f0 = a0 -= 0.8l;
562- VERIFY( f0 == 13.2l );
563- VERIFY( a0 == 13.2l );
544+ a1 = a0 = 0.5l;
545+ f0 = a0.fetch_add(0.25l);
546+ VERIFY( f0 == 0.5l );
547+ VERIFY( a0 == 0.75l );
548+ f1 = a1.fetch_add(0.25l, mo);
549+ VERIFY( f1 == 0.5l );
550+ VERIFY( a1 == 0.75l );
551+
552+ f0 = a0.fetch_sub(0.5l);
553+ VERIFY( f0 == 0.75l );
554+ VERIFY( a0 == 0.25l );
555+ f1 = a1.fetch_sub(0.5l, mo);
556+ VERIFY( f1 == 0.75l );
557+ VERIFY( a1 == 0.25l );
558+
559+ f0 = a0 += 0.75l;
560+ VERIFY( f0 == 1.0l );
561+ VERIFY( a0 == 1.0l );
562+
563+ f0 = a0 -= 0.5l;
564+ VERIFY( f0 == 0.5l );
565+ VERIFY( a0 == 0.5l );
564566 }
565567 }
566568
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/float.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/float.cc
@@ -267,31 +267,32 @@ test03()
267267 ok = a.compare_exchange_strong(expected, 6.4l, mo);
268268 VERIFY( !ok && a.load() == 204.8l && expected == 204.8l );
269269
270- v = a.fetch_add(3.2l);
271- VERIFY( v == 204.8l );
272- VERIFY( a == 208.0l );
273- v = a.fetch_add(-8.5l, mo);
274- VERIFY( v == 208.0l );
275- VERIFY( a == 199.5l );
276-
277- v = a.fetch_sub(109.5l);
278- VERIFY( v == 199.5l );
279- VERIFY( a == 90.0l );
280- v = a.fetch_sub(2, mo);
281- VERIFY( v == 90.0l );
282- VERIFY( a == 88.0l );
283-
284- v = a += 5.0l;
285- VERIFY( v == 93.0l );
286- VERIFY( a == 93.0l );
287-
288- v = a -= 6.5l;
289- VERIFY( v == 86.5l );
290- VERIFY( a == 86.5l );
270+ a = 0.5l;
271+ v = a.fetch_add(0.5l);
272+ VERIFY( v == 0.5l );
273+ VERIFY( a == 1.0l );
274+ v = a.fetch_add(-0.2l, mo);
275+ VERIFY( v == 1.0l );
276+ VERIFY( a == 0.8l );
277+
278+ v = a.fetch_sub(0.4l);
279+ VERIFY( v == 0.8l );
280+ VERIFY( a == 0.4l );
281+ v = a.fetch_sub(-0.4l, mo);
282+ VERIFY( v == 0.4l );
283+ VERIFY( a == 0.8l );
284+
285+ v = a += .8l;
286+ VERIFY( v == 1.6l );
287+ VERIFY( a == 1.6l );
288+
289+ v = a -= 0.6l;
290+ VERIFY( v == 1.0l );
291+ VERIFY( a == 1.0l );
291292 }
292293
293294 if constexpr (std::atomic_ref<long double>::is_always_lock_free)
294- VERIFY( value == 86.5l );
295+ VERIFY( value == 1.0l );
295296 }
296297
297298 void