public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105771] New: matrix partial transposition with -O3
@ 2022-05-30  8:41 franckbehaghel_gcc at protonmail dot com
  2022-05-30  9:14 ` [Bug c/105771] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: franckbehaghel_gcc at protonmail dot com @ 2022-05-30  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-30 11:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30  8:41 [Bug c/105771] New: matrix partial transposition with -O3 franckbehaghel_gcc at protonmail dot com
2022-05-30  9:14 ` [Bug c/105771] " pinskia at gcc dot gnu.org
2022-05-30  9:16 ` pinskia at gcc dot gnu.org
2022-05-30  9:38 ` rguenth at gcc dot gnu.org
2022-05-30  9:55 ` rguenth at gcc dot gnu.org
2022-05-30 10:18 ` [Bug c/105771] matrix partial transposition with -O3 since r8-5159-g1cc521f1a824b591 marxin at gcc dot gnu.org
2022-05-30 11:04 ` franckbehaghel_gcc at protonmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).