https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105771
Bug ID: 105771
Summary: matrix partial transposition with -O3
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: franckbehaghel_gcc at protonmail dot com
Target Milestone: ---
Created attachment 53051
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53051&action=edit
source
Hello,
The attached code does not produce the same result with -O3 flag enabled.
It seems that gcc reorders operations that should not be in the matrix
transposition operation. The trick here is that the attached code does inplace
partial transposition.
To reproduce :
gcc main0.c && ./a.out > O0.txt ; gcc main0.c -O3 && ./a.out > O3.txt ;
md5sum O0.txt O3.txt
0b513fb110f11f0e9b143c53d5b7a634 O0.txt
12be7305e8e96decd579a1e42d45bc46 O3.txt
This behavior is weird as matrix size lower than 16 do not trigger the
suspected bug.
My gcc version is 10.3.1.
I tested with https://godbolt.org/ : It seems to be introduce in Gcc 8.1 as Gcc
7.5 give the correct output. The last gcc 12.1 seems also affected.
Clang is fine and give the right output.
Can someone confirmed ?
Best regards,
Franck