Skip to content

ARM64/ARM64EC vectorized minmax_element() family mishandles unsigned elements #6373

Description

In the not-for-review #6371, I encountered a randomized test failure in ARM64EC vectorized min_element(). I hardcoded this seed on top of main and reproduced this failure deterministically in the not-for-review #6372. Then I got the precise input that reproduces this failure, and verified that it fails for plain ARM64 too:

std::min_element() failed for vector<unsigned char> input:
155, 153, 248, 150, 189, 140, 247, 178, 244, 164, 226, 214, 239, 215, 176, 127

Click to expand original log:
name: std.tests/VSO_0000000_vector_algorithms
output: Build setup steps:
Build steps:
Command: "C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.52.36530\bin\HostARM64\ARM64\cl.EXE" "C:\a\_work\1\s\tests\std\tests\VSO_0000000_vector_algorithms\test.cpp" "-IE:\stlBuild\out\inc" "-IC:\a\_work\1\s\llvm-project\libcxx\test\support" "-IC:\a\_work\1\s\tests\std\include" "/nologo" "/Od" "/W4" "/w14061" "/w14242" "/w14265" "/w14582" "/w14583" "/w14587" "/w14588" "/w14749" "/w14841" "/w14842" "/w15038" "/w15214" "/w15215" "/w15216" "/w15217" "/w15262" "/sdl" "/WX" "/D_ENABLE_STL_INTERNAL_CHECK" "/bigobj" "/FIforce_include.hpp" "/w14365" "/w14668" "/w15267" "/D_ENFORCE_FACET_SPECIALIZATIONS=1" "/EHsc" "/MDd" "/D_ITERATOR_DEBUG_LEVEL=2" "/std:c++20" "/permissive-" "/w14640" "/Zc:threadSafeInit-" "/arm64EC" "/wd28301" "-FeE:\stlBuild\tests\std\tests\VSO_0000000_vector_algorithms\Output\054\VSO_0000000_vector_algorithms.exe" "-link" "-LIBPATH:E:\stlBuild\out\lib\arm64ec" "-LIBPATH:C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\MSVC\14.52.36530\lib\arm64" "/MANIFEST:EMBED" "/OPT:REF,NOICF" "/machine:arm64ec"
Exit Code: 0 (0x0)
Standard Output:
--
test.cpp
--

Intellisense response file steps:
Test setup steps:
Test steps:
Test step failed unexpectedly.
Command: "E:\stlBuild\tests\std\tests\VSO_0000000_vector_algorithms\Output\054\VSO_0000000_vector_algorithms.exe"
Exit Code: 3 (0x3)
Standard Output:
--
This is a randomized test.
DO NOT IGNORE/RERUN ANY FAILURES.
You must report them to the STL maintainers.

Seed vector: 3356369755,3848971058,1259264218,2402281943,3053744863,1434038012,1370400208,942575957,1162353574,2229769496,2914173799,1559606643,2181804207,141501947,362047169,3202026107,135169558,1923025753,2657321462,529087294,1948307924,1646602262,1256472567,3928544273,808722250,153798203,3086794346,3551505781,3937367038,4248187415,1832215151,911851231,2712842899,2842349105,1062391024,2873581491,3066738274,2991669960,3114333273,1587900168,1272089752,411424740,92810746,3867161257,1659049079,960853619,3026519663,3827007609,3718533934,1445912890,70617560,379462789,2546239587,2082446646,1947649241,3962379562,463764735,2953308329,1055612931,2907965664,844871964,3717101277,3093970926,3898354009,1558082261,3131388974,2658399524,2099000452,1542236179,55900861,2858587320,891703103,2962117772,80107642,204416291,794586963,605083623,807237438,2290023941,2253562912,4202905403,1767359583,3861728986,1490343746,1037127564,1342130107,917587045,2123642814,732727921,1666696914,3512198135,3088071480,12535932,1355722938,1614954222,2816496323,1509261921,3095483927,4025258325,3737754445,3552783602,708549790,1367623855,1850288331,3209478397,429864036,2889880328,2519052311,1937036081,3820528648,4094538420,3087427709,2429115697,4285227434,4045490667,1035752091,2587375556,3620701450,3601667906,2124515128,610284770,2111878862,2101950416,1073201438,914456354,3850466530,2300168682,2125836691,439423149,1005240327,2863985002,1741843053,1974435050,2037694121,607455708,2418510279,3547401786,506333459,220487911,2964227520,3778831470,4018649171,4116487176,1278429181,3617142449,2898791326,495442403,1868165690,1162683806,2331721049,576884234,395506800,1044606013,3970134337,2044067483,607966642,2783059238,2609850724,3303046362,1132529737,1559784530,1825239780,2284346580,1458632731,1763931480,4060951630,2826275853,634331608,1444406349,893150402,2751652575,2345554950,2260030336,560102889,1998229620,820022135,4213805721,2283042431,52686058,3427838800,3882981202,2139056759,104953453,1852273611,2580233003,1307590897,674813102,1336310300,3282289672,681617294,2996556094,3418896200,3923309687,4292700019,563509089,706166904,4139972301,2460527069,217057057,2898004837,2299881379,3778410384,3318187754,143681192,2996761381,2540904366,1293920608,1201285332,1490723386,3691161293,2738019671,2268779047,1775018477,1878391245,2362534121,3737730944,3171948230,711401952,3122073782,1105897327,4222941132,3357595933,3033816911,784967652,553042647,3525850925,1204197706,1709411258,1831376986,1025133928,1095042275,2065227917,2965894916,672023683,467454179,3539266189,317452084,3088769003,2855133613,2736957358,734446004,2476300736,4072974775,1391327770,3210628290,4022971092,1528459190,1311300225,3196246445,2067269631,3534164852,2549792670,497061368,139004917,1177268294,3388218231,1596912311,3762516210,1703801558,2696493320,1026357734,2541060009,2847978756,1913813582,3034729324,1353437905,2296195417,776900446,457394557,1683903247,3632294448,3165117828,2021469897,1574939510,2518540484,3726484384,3327802471,3246281419,3182634912,3960501144,3772861322,2601490194,2415977375,2245355564,2765915561,2884449533,2665012041,3932208016,3354079637,3295088945,2739856147,567286549,1144812561,3666618847,692304243,3119402505,745309817,3159135416,2704378452,1126493547,3405142975,2767607822,3081749123,4137288733,1140102660,3571062893,190570016,2089343369,3195552555,2213389894,3362820739,955151449,2474309873,3641989752,2053636773,2696357607,4151368762,2044296957,614494746,3230827872,1984843437,660783258,1666491793,3330484273,2609451166,1687123480,539761524,1846248369,2189300796,3617547411,4236193427,607307416,379545226,3739900040,2891179612,1201152717,751628666,2444274515,1505717683,716859871,3187819282,362229246,2376762324,3265395497,3865421298,1718933283,757405823,3868866125,3927619024,3717105204,4049730279,3772286259,3888400991,1480129015,4074920807,2385602439,360018923,769865002,3603426055,1683881311,293887490,94607185,1684563041,4228043625,1547624110,1067987678,3909692167,3831076524,2375797938,3027616964,2973545811,1529221750,181117984,1046812220,763548270,1317384548,1254318272,1034739732,3472275787,2894051461,3196371142,2187627793,20640647,2625934759,1974688238,3390060743,640393585,2096375305,210609970,2088757633,4101425581,1909459835,1480988936,2922461172,3120736628,3743094457,4021799272,1700205119,59175518,1740664023,3565992953,3318784316,2824602357,2467851514,90544403,1696979373,784588894,1768610360,3384644717,2795670093,2964178894,234099163,3116922059,1674389962,266005074,2337720195,818405464,3076354369,1596195364,1662868987,1644848768,3706976223,2070523517,477360744,646490681,395676292,2649814891,2503770250,581533669,3537710675,868771147,2591463605,1366809229,4270921544,1471749337,1303961927,252810515,400599123,1305901041,338644684,520183201,2106276135,2646864142,1106668979,21744225,1825268152,3274756622,4183226506,1092947171,3762422968,3008443919,1724755533,2714409633,879342143,4261818063,2477555343,3066983876,209896238,3456661954,3274329276,2724323716,4035563084,3029478406,4022620770,1770906857,386682891,3709822281,1170319213,1400197482,518862093,3618446543,1064148,2792374131,2681661268,2107332120,1898411153,1466856936,394127314,3932606395,3850590550,3827703992,81510703,944898123,876216135,4017889614,4161185399,2195633004,1963079411,2828019635,719683654,1704964690,3818451636,1394082391,3942985857,3479162783,709817498,2614692369,1334849422,3394161710,26202270,1496155699,2038592208,3468184662,3810702140,2972990083,3969213650,1374826021,2761274084,1140943402,2640682390,1918750338,1289019516,3290357103,728343248,2833248432,1157983172,695587030,1192643840,1936700887,3731597501,1332117766,1490060985,3554841166,982074170,3917814131,2101332498,1830548604,2048091080,765247295,1086499187,2199190394,1923000910,2465544250,2143519743,1464797581,18647861,3630070151,3379553763,2941211120,597912355,3058116940,706636045,586613594,1357092338,1126446496,2647389264,1724423473,1782156499,3776359377,162132008,1278151424,565245801,2713827458,4241586937,8536646,2893208457,3154951465,1678317331,2280581546,237407213,951360259,391387138,3563562743,894671451,1314422376,10435031,10012198,1163209055,1060018852,1646737455,3885592153,2383583395,1917793720,4096269264,4266563100,3874020386,1708736985,1148583700,2791120746,466689410,3534891361,2495702471,2083024555,2964567882,3335795557,1919406374,3884090093,3643663854,3375696054,319502955,3350589177,2624168465,2733197925,1983334309,4117566127,2459509637,1169355517,2298939599,477522073,456999242,1918053405,2848389351,599288127,2004313879,464108939,3830164643,176360879,3804113826,3109671610,378565176,2713118756,2756916283,1724792116,3646801781,671174290,999194508,463334982,3665359389,3046058065,659149872,3834742597,75330490,3823208797,2566394529,
--
Standard Error:
--
Assertion failed: expected_min == actual_min, file C:\a\_work\1\s\tests\std\include\test_min_max_element_support.hpp, line 92
abort() has been called--

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARM64Related to the ARM64 architectureARM64ECI can't believe it's not x64!bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions