public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results
@ 2022-06-22  9:03 dizhao at os dot amperecomputing.com
  2022-06-22 11:52 ` [Bug tree-optimization/106054] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dizhao at os dot amperecomputing.com @ 2022-06-22  9:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106054

            Bug ID: 106054
           Summary: Tree optimizations cause mcf generates incorrect
                    results
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dizhao at os dot amperecomputing.com
  Target Milestone: ---

Created attachment 53189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53189&action=edit
test code in C

Some tree optimization caused verification error on the spec2017 505.mcf test
case.

Attached is a small example I extracted, to help debugging the problem.
When compiled with "-std=c99 -O2 -funroll-loops -fdisable-tree-slp1" the result
is different with "-std=c99 -O2 -funroll-loops", the latter result is
incorrect. (It is possible the problem is not slp itself. I haven't figured out
the root cause by now.)

Tested on trunk commit: 98b6e62cf5e7d477b5797084da59561f6d018668 . And the
error seems to exist at least since trunk commit
a1c9f779f75283427316b5c670c1e01ff8ce9ced.

Thanks.

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

* [Bug tree-optimization/106054] Tree optimizations cause mcf generates incorrect results
  2022-06-22  9:03 [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results dizhao at os dot amperecomputing.com
@ 2022-06-22 11:52 ` pinskia at gcc dot gnu.org
  2022-06-22 11:54 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-22 11:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106054

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Aliasing violations are present.
Use -fno-strict-aliasing.

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

* [Bug tree-optimization/106054] Tree optimizations cause mcf generates incorrect results
  2022-06-22  9:03 [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results dizhao at os dot amperecomputing.com
  2022-06-22 11:52 ` [Bug tree-optimization/106054] " pinskia at gcc dot gnu.org
@ 2022-06-22 11:54 ` pinskia at gcc dot gnu.org
  2022-06-22 19:48 ` pinskia at gcc dot gnu.org
  2022-06-23  3:38 ` dizhao at os dot amperecomputing.com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-22 11:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106054

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is the access via different pointer types. That is the issue.

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

* [Bug tree-optimization/106054] Tree optimizations cause mcf generates incorrect results
  2022-06-22  9:03 [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results dizhao at os dot amperecomputing.com
  2022-06-22 11:52 ` [Bug tree-optimization/106054] " pinskia at gcc dot gnu.org
  2022-06-22 11:54 ` pinskia at gcc dot gnu.org
@ 2022-06-22 19:48 ` pinskia at gcc dot gnu.org
  2022-06-23  3:38 ` dizhao at os dot amperecomputing.com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-06-22 19:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106054

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>From https://www.spec.org/cpu2017/Docs/benchmarks/505.mcf_r.html:
>The module spec_qsort.c does not obey strict ANSI aliasing rules. You may need to add your compiler's flag that informs it not to assume strict ANSI compliance.

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

* [Bug tree-optimization/106054] Tree optimizations cause mcf generates incorrect results
  2022-06-22  9:03 [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results dizhao at os dot amperecomputing.com
                   ` (2 preceding siblings ...)
  2022-06-22 19:48 ` pinskia at gcc dot gnu.org
@ 2022-06-23  3:38 ` dizhao at os dot amperecomputing.com
  3 siblings, 0 replies; 5+ messages in thread
From: dizhao at os dot amperecomputing.com @ 2022-06-23  3:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106054

--- Comment #4 from Di Zhao <dizhao at os dot amperecomputing.com> ---
(In reply to Andrew Pinski from comment #3)
> From https://www.spec.org/cpu2017/Docs/benchmarks/505.mcf_r.html:
> >The module spec_qsort.c does not obey strict ANSI aliasing rules. You may need to add your compiler's flag that informs it not to assume strict ANSI compliance.

I tried the "-fno-strict-aliasing" option and it works. Apologize for not
noticing this. Thanks a lot!

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

end of thread, other threads:[~2022-06-23  3:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  9:03 [Bug tree-optimization/106054] New: Tree optimizations cause mcf generates incorrect results dizhao at os dot amperecomputing.com
2022-06-22 11:52 ` [Bug tree-optimization/106054] " pinskia at gcc dot gnu.org
2022-06-22 11:54 ` pinskia at gcc dot gnu.org
2022-06-22 19:48 ` pinskia at gcc dot gnu.org
2022-06-23  3:38 ` dizhao at os dot amperecomputing.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).