public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115697] New: Miscompilation with -fgraphite-identity at -O2
@ 2024-06-28 10:14 michael at orlitzky dot com
  2024-06-28 11:47 ` [Bug tree-optimization/115697] [11/12/13/14/15 Regression] " xry111 at gcc dot gnu.org
  2024-06-28 21:01 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: michael at orlitzky dot com @ 2024-06-28 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115697
           Summary: Miscompilation with -fgraphite-identity at -O2
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael at orlitzky dot com
  Target Milestone: ---

While debugging a test failure in the flint library
(https://github.com/flintlib/flint/issues/2029), we seem to have discovered a
miscompilation. Fredrik Johansson was able to come up with a minimal
reproducer. This may be a duplicate of bug 47048, but having more reproducible
test cases never hurts.

$ gcc-15 -O2 -Wall -Wextra main.c 
$ ./a.out 
6 4 1

$ gcc-15 -O2 -fgraphite-identity -Wall -Wextra main.c 
$ ./a.out 
3 2 1

$ cat main.c 
#include <stdio.h>

void
shift(long * c, long n)
{
    long i, j;

    if (n <= 62)
    {
        for (i = n - 2; i >= 0; i--)
            for (j = i; j < n - 1; j++)
                c[j] += c[j + 1];
    }
}

int main(void)
{
    long c[3];
    volatile long n = 3;
    c[0] = 3;
    c[1] = 2;
    c[2] = 1;
    shift(c, n);
    printf("%ld %ld %ld\n", c[0], c[1], c[2]);
}

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

* [Bug tree-optimization/115697] [11/12/13/14/15 Regression] Miscompilation with -fgraphite-identity at -O2
  2024-06-28 10:14 [Bug tree-optimization/115697] New: Miscompilation with -fgraphite-identity at -O2 michael at orlitzky dot com
@ 2024-06-28 11:47 ` xry111 at gcc dot gnu.org
  2024-06-28 21:01 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-06-28 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xry111 at gcc dot gnu.org
      Known to fail|                            |11.1.0
            Summary|Miscompilation with         |[11/12/13/14/15 Regression]
                   |-fgraphite-identity at -O2  |Miscompilation with
                   |                            |-fgraphite-identity at -O2
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-28
           Keywords|                            |needs-bisection
      Known to work|                            |10.5.0

--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Confirmed.

- Code from GCC 6 - 10 outputs "6 4 1" correctly.
- Code from GCC 11 - 14 outputs "3 2 1".
- Code from GCC 5 crashes with SIGFPE.

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

* [Bug tree-optimization/115697] [11/12/13/14/15 Regression] Miscompilation with -fgraphite-identity at -O2
  2024-06-28 10:14 [Bug tree-optimization/115697] New: Miscompilation with -fgraphite-identity at -O2 michael at orlitzky dot com
  2024-06-28 11:47 ` [Bug tree-optimization/115697] [11/12/13/14/15 Regression] " xry111 at gcc dot gnu.org
@ 2024-06-28 21:01 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-28 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5

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

end of thread, other threads:[~2024-06-28 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-28 10:14 [Bug tree-optimization/115697] New: Miscompilation with -fgraphite-identity at -O2 michael at orlitzky dot com
2024-06-28 11:47 ` [Bug tree-optimization/115697] [11/12/13/14/15 Regression] " xry111 at gcc dot gnu.org
2024-06-28 21:01 ` pinskia at gcc dot gnu.org

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).