public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu
@ 2021-06-09 19:37 qrzhang at gatech dot edu
  2021-06-10  6:50 ` [Bug tree-optimization/101001] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: qrzhang at gatech dot edu @ 2021-06-09 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101001
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qrzhang at gatech dot edu
  Target Milestone: ---

It affects gcc-8 to the trunk. Gcc-7 works fine.



$ gcc-trunk -v
gcc version 12.0.0 20210609 (experimental) [master revision
174e75a2107:3b61ba37fe1:5bfcfe3087eb05b76395c9efbfc1abbf3f9e1a03] (GCC)


$ gcc-trunk abc.c ; ./a.out
0


$ gcc-trunk -O3 abc.c ; ./a.out
Segmentation fault


$ cat abc.c
int a;
volatile char b;
int main() {
  char c;
  int d, f = 5;
  short e;
  e = 0;
  for (; e != -15; e--) {
    d = 0;
    for (; d > -16; d = d - 4) {
      f || b;
      c = 0;
      for (; c != 2; c = c - 3)
        f = 0;
    }
  }
  printf("%X\n", a);
}

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

* [Bug tree-optimization/101001] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu
  2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
@ 2021-06-10  6:50 ` rguenth at gcc dot gnu.org
  2021-06-10  7:26 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-10  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|wrong code at -O3 on        |[9/10/11/12 Regression]
                   |x86_64-linux-gnu            |wrong code at -O3 on
                   |                            |x86_64-linux-gnu
   Target Milestone|---                         |9.5
            Version|unknown                     |12.0
           Keywords|                            |needs-bisection, wrong-code
      Known to work|                            |7.5.0

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

* [Bug tree-optimization/101001] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu
  2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
  2021-06-10  6:50 ` [Bug tree-optimization/101001] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org
@ 2021-06-10  7:26 ` rguenth at gcc dot gnu.org
  2021-06-14  9:43 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-10  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-10
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
         Depends on|                            |100934

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We end up with

  <bb 2> [count: 0]:
  b.1_18 ={v} b;
  b.1_5 ={v} b;
...
  b.1_1 ={v} b;
  __builtin_unreachable ();

}

sounds related to PR100934, "fixed" with -fdisable-tree-cunroll.

Loop 1 iterates at most 15 times.
Loop 1 likely iterates at most 15 times.

-fdisable-tree-thread2 "fixes" it as well.  Likely a duplicate.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100934
[Bug 100934] [9/10/11/12 Regression] wrong code at -O3 during unrolling since
r9-6299

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

* [Bug tree-optimization/101001] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu
  2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
  2021-06-10  6:50 ` [Bug tree-optimization/101001] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org
  2021-06-10  7:26 ` rguenth at gcc dot gnu.org
@ 2021-06-14  9:43 ` jakub at gcc dot gnu.org
  2021-10-13 10:10 ` rguenth at gcc dot gnu.org
  2021-11-09  7:57 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-06-14  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r9-6299-gd7a700e0a701e5164b8c547f76a2d91f657eee97

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

* [Bug tree-optimization/101001] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu
  2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
                   ` (2 preceding siblings ...)
  2021-06-14  9:43 ` jakub at gcc dot gnu.org
@ 2021-10-13 10:10 ` rguenth at gcc dot gnu.org
  2021-11-09  7:57 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-13 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101001
Bug 101001 depends on bug 100934, which changed state.

Bug 100934 Summary: [9 Regression] wrong code at -O3 during unrolling since r9-6299
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100934

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

* [Bug tree-optimization/101001] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu
  2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
                   ` (3 preceding siblings ...)
  2021-10-13 10:10 ` rguenth at gcc dot gnu.org
@ 2021-11-09  7:57 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-09  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.2.0
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 100934.  Fixed in GCC 9.5.0, 10.4.0, 11.2.0 and 12+.

*** This bug has been marked as a duplicate of bug 100934 ***

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

end of thread, other threads:[~2021-11-09  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 19:37 [Bug tree-optimization/101001] New: wrong code at -O3 on x86_64-linux-gnu qrzhang at gatech dot edu
2021-06-10  6:50 ` [Bug tree-optimization/101001] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org
2021-06-10  7:26 ` rguenth at gcc dot gnu.org
2021-06-14  9:43 ` jakub at gcc dot gnu.org
2021-10-13 10:10 ` rguenth at gcc dot gnu.org
2021-11-09  7:57 ` 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).