Bug 463456

Summary: memcheck/tests/origin6-fp fails when building for x86-64-v3 target
Product: [Developer tools] valgrind Reporter: Alexander Kanavin <alex.kanavin>
Component: memcheckAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: mark, sam
Priority: NOR    
Version First Reported In: 3.20.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alexander Kanavin 2022-12-25 14:19:14 UTC
Yocto project is transitioning x86_64 builds to build for x86-64-v3 (e.g. enabling AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE), and one of the regressions is in memcheck/tests/origin6-fp.

Specifically:

Correct output for  x86-64-v2:

root@qemux86-64:~/origin6-test# gcc -march=x86-64-v2 -g -O origin6-fp.c 
root@qemux86-64:~/origin6-test# valgrind   -q --track-origins=yes ./a.out 
==19942== Conditional jump or move depends on uninitialised value(s)
==19942==    at 0x1094A0: main (origin6-fp.c:97)
==19942==  Uninitialised value was created by a client request
==19942==    at 0x109409: setup_arr (origin6-fp.c:75)
==19942==    by 0x109467: main (origin6-fp.c:87)
==19942== 
Test succeeded.

Incorrect output for v3 (missing the uninitialized value bit):

root@qemux86-64:~/origin6-test# gcc -march=x86-64-v3 -g -O origin6-fp.c 
root@qemux86-64:~/origin6-test# valgrind   -q --track-origins=yes ./a.out 
==19948== Conditional jump or move depends on uninitialised value(s)
==19948==    at 0x1094A0: main (origin6-fp.c:97)
==19948== 
Test succeeded.

The more detailed information about the levels is here:
https://www.phoronix.com/news/GCC-11-x86-64-Feature-Levels
Comment 1 Mark Wielaard 2024-04-12 14:42:13 UTC
Confirmed. With gcc -march=x86-64-v3 memcheck is unable to track the origin. Even when build with -O0 (instead of -O).