Repository navigation
Commit e8bc323
Tests: the quiet-bar battery takes one draw per statement, so every compiler builds the same random strategies (R5 lane XPLAT1)
test_adapter_quiet_bar matched 92 of its 272 pins on x86-64 Linux
(GCC 13.4 on the owner's hosts, GCC 13.3 in Docker amd64), in Release and
Debug alike, and 272 of 272 on arm64 (AppleClang, GCC 13 on spark). The
cause is in the test's generator, not in the engine. Three call sites in
random_scenario's script made two to four draws of the battery's Random
inside one call's argument list:
case 4 strategy_entry(... 1.0 + s.below(3), "", s.chance(30) ? "g" : "",
s.chance(30) ? 1 + s.below(2) : 0)
case 7 strategy_exit(kExits[s.below(2)], id, kNa, kNa, 4.0 + s.below(8),
1.0 + s.below(4))
default strategy_order(id, is_long, 1.0 + s.below(2), s.chance(50) ? ...)
C++ leaves the order in which a call's arguments are evaluated unspecified.
GCC on x86-64 evaluates them right to left; Clang, and GCC on aarch64,
evaluate them left to right. A three-argument probe prints 321 with GCC
13.3 and 12.2 on x86-64 (-O0 and -O2), and 123 with AppleClang 17 and
GCC 13.3 on aarch64 (-O2). The pins were harvested on the Mac (arm64,
AppleClang), so on x86-64 45 of the 48 random strategies issued different
commands: 180 runs differed, and the battery booked 66 margin-call rows
instead of 62. Every fixture run matched.
First divergence, Random01 with the magnifier off and recording off: the
bars, the configuration and all 15,925 generator draws of the battery are
bit-identical on both platforms. At bar 1 the script takes case 7. arm64
draws below(2)=1, below(8)=5, below(4)=1 and issues strategy_exit("Y", "L",
trail_points 9 [0x4022000000000000], trail_offset 2 [0x4000000000000000]).
x86-64 draws below(4)=3, below(8)=5, below(2)=1 and issues the same id and
points, but trail_offset 4 [0x4010000000000000]. The source folds agree
through callback 1 and first differ at callback 2 (bar 2).
Each draw is now its own statement, taken left to right: the order the
pins were harvested with. With the draws sequenced, x86-64 reproduces all
272 pins. So on this battery, margin-call regime included, the engine
computes the same values on x86-64 as on arm64.
expectation corrected: harvested with a platform-dependent generator,
because the random strategies drew several values inside one call's
arguments, whose evaluation order C++ leaves unspecified. No pinned row
changes (old -> new: identical). Re-harvested as the provenance note says,
with this TU at -std=c++17 -O2 -ffp-contract=off
-DPINEFORGE_QUIET_BAR_HARVEST against a Release build of f71cd82. The
harvest is byte-identical on Mac arm64 (AppleClang 17), x86-64 (GCC 13.3,
Docker amd64) and aarch64 (GCC 13.3, spark), with sha256 08e90197...4c6d,
equal to the committed test_adapter_quiet_bar_pinned.inc. The previous
TU's harvest on x86-64 differs from it in exactly the 180 failing rows.
No other test in tests/ has this pattern. A scan for full-expressions that
make two or more draws, counting helpers that draw inside, flagged 33
distinct statements. Apart from these three, 29 are sequenced: ?:, &&, an
if-condition before its body, one draw per declarator, or a helper passed
the generator by reference. The last one is a false positive with no
generator. The one implementation-defined distribution
(test_native_point_checks) feeds an on-machine differential, not a pin.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>1 parent 08f1f5f commit e8bc323
1 file changed
Lines changed: 28 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
47 | | - | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
659 | 664 | | |
660 | 665 | | |
661 | 666 | | |
| 667 | + | |
| 668 | + | |
662 | 669 | | |
663 | 670 | | |
664 | 671 | | |
| |||
673 | 680 | | |
674 | 681 | | |
675 | 682 | | |
676 | | - | |
677 | | - | |
678 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
679 | 688 | | |
| 689 | + | |
680 | 690 | | |
681 | 691 | | |
682 | 692 | | |
683 | 693 | | |
684 | 694 | | |
685 | 695 | | |
686 | | - | |
687 | | - | |
688 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
689 | 701 | | |
| 702 | + | |
690 | 703 | | |
691 | 704 | | |
692 | 705 | | |
| |||
699 | 712 | | |
700 | 713 | | |
701 | 714 | | |
702 | | - | |
703 | | - | |
704 | | - | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
705 | 720 | | |
706 | 721 | | |
| 722 | + | |
707 | 723 | | |
708 | 724 | | |
709 | 725 | | |
| |||
0 commit comments