public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer
@ 2014-09-29  4:20 andi-gcc at firstfloor dot org
  2014-09-29  4:26 ` [Bug middle-end/63404] " andi-gcc at firstfloor dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-29  4:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63404
           Summary: gcc 5 miscompiles linux block layer
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andi-gcc at firstfloor dot org

When I boot a current Linux mainline kernel compiled with mainline gcc 
and the section fix patch applied I always get a crash at boot in the block
layer.

gcc version 5.0.0 20140926 (experimental) (GCC) 

    1.318801] EXT4-fs (sda1): write access will be enabled during recovery
[    1.367592] ------------[ cut here ]------------
[    1.369061] kernel BUG at /home/andi/lsrc/linux/block/blk-flush2.c:80!
[    1.370910] invalid opcode: 0000 [#1] SMP 


I narrowed it down to one function. When only the function is compiled with gcc
4.9 the kernel boots.

Attach is a test case with only the function.
It doesn't quite run by itself yet, so the code has to be examined.


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

* [Bug middle-end/63404] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
@ 2014-09-29  4:26 ` andi-gcc at firstfloor dot org
  2014-09-29  4:57 ` [Bug target/63404] " andi-gcc at firstfloor dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-29  4:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andi Kleen <andi-gcc at firstfloor dot org> ---
Created attachment 33607
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33607&action=edit
not quite yet runnable test case


In the real execution blk_flush_complete_seq always ends up in the default case
in the switch and crashes.


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

* [Bug target/63404] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
  2014-09-29  4:26 ` [Bug middle-end/63404] " andi-gcc at firstfloor dot org
@ 2014-09-29  4:57 ` andi-gcc at firstfloor dot org
  2014-09-29  8:29 ` [Bug target/63404] [5 Regression] " trippels at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-29  4:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andi Kleen <andi-gcc at firstfloor dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |target

--- Comment #2 from Andi Kleen <andi-gcc at firstfloor dot org> ---
The switch is miscompiled and destroys the flags register in the middle of a
comparison:

.LVL2:
        .loc 1 49 0
        cmpl    $2, %eax        #, seq
        je      .L5     #,
        shrb    $2, %r12b       #, D.32130      <-------- BAD1
        andl    $1, %r12d       #, D.32130      <-------- BAD2
        jbe     .L24    #,
        cmpl    $4, %eax        #, seq
        je      .L7     #,
        cmpl    $8, %eax        #, seq
        jne     .L4     #,


gcc 4.9 creates the same code except for BAD1/BAD2. These two
JBE relies on CF/ZF being preserved, but SHR can overwrite ZF/CF,
which breaks the JBE after the CMP

So somehow the backend lost track of these two flag bits.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
  2014-09-29  4:26 ` [Bug middle-end/63404] " andi-gcc at firstfloor dot org
  2014-09-29  4:57 ` [Bug target/63404] " andi-gcc at firstfloor dot org
@ 2014-09-29  8:29 ` trippels at gcc dot gnu.org
  2014-09-29 10:49 ` jiwang at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-29  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2014-09-29
                 CC|                            |jiwang at gcc dot gnu.org,
                   |                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|gcc 5 miscompiles linux     |[5 Regression] gcc 5
                   |block layer                 |miscompiles linux block
                   |                            |layer
   Target Milestone|---                         |5.0

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Started with r215563.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (2 preceding siblings ...)
  2014-09-29  8:29 ` [Bug target/63404] [5 Regression] " trippels at gcc dot gnu.org
@ 2014-09-29 10:49 ` jiwang at gcc dot gnu.org
  2014-09-29 11:14 ` jiwang at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jiwang at gcc dot gnu.org @ 2014-09-29 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jiong Wang <jiwang at gcc dot gnu.org> ---
sorry for causing the trouble.

the reason might be the "flag" is an implified register while it's not take
into account in current shrink-wrap reg read/write analysis.

I will revert my patch temperarily if I couldn't find a proper fix today.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (3 preceding siblings ...)
  2014-09-29 10:49 ` jiwang at gcc dot gnu.org
@ 2014-09-29 11:14 ` jiwang at gcc dot gnu.org
  2014-09-29 18:46 ` pthaugen at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jiwang at gcc dot gnu.org @ 2014-09-29 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jiong Wang <jiwang at gcc dot gnu.org> ---
we need to check the following 

   else if (GET_CODE == CLOBBER
            || GET_CODE (x) == USE
            || GET_CODE (x) == ASM_INPUT)

I will post the fix after pass x86 bootstrap and regression


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (4 preceding siblings ...)
  2014-09-29 11:14 ` jiwang at gcc dot gnu.org
@ 2014-09-29 18:46 ` pthaugen at gcc dot gnu.org
  2014-09-29 18:48 ` jiwang at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2014-09-29 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

Pat Haugen <pthaugen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pthaugen at gcc dot gnu.org

--- Comment #6 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Jiong Wang from comment #5)
> we need to check the following 
> 
>    else if (GET_CODE == CLOBBER
>             || GET_CODE (x) == USE
>             || GET_CODE (x) == ASM_INPUT)
> 
> I will post the fix after pass x86 bootstrap and regression

r215563 also introduced a miscompare on PowerPC for cpu2000 benchmark 254.gap.
Applying your patch proposed on the gcc-patches ml for this bug fixes the
issue.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (5 preceding siblings ...)
  2014-09-29 18:46 ` pthaugen at gcc dot gnu.org
@ 2014-09-29 18:48 ` jiwang at gcc dot gnu.org
  2014-09-29 18:50 ` jiwang at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jiwang at gcc dot gnu.org @ 2014-09-29 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jiong Wang <jiwang at gcc dot gnu.org> ---
(In reply to Pat Haugen from comment #6)
> (In reply to Jiong Wang from comment #5)
> > we need to check the following 
> > 
> 
> r215563 also introduced a miscompare on PowerPC for cpu2000 benchmark
> 254.gap. Applying your patch proposed on the gcc-patches ml for this bug
> fixes the issue.

thanks for reporting this, sorry for causing trouble.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (6 preceding siblings ...)
  2014-09-29 18:48 ` jiwang at gcc dot gnu.org
@ 2014-09-29 18:50 ` jiwang at gcc dot gnu.org
  2014-09-29 21:03 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jiwang at gcc dot gnu.org @ 2014-09-29 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jiong Wang <jiwang at gcc dot gnu.org> ---
(In reply to Pat Haugen from comment #6)
> (In reply to Jiong Wang from comment #5)
> > we need to check the following 
> > 
> >    else if (GET_CODE == CLOBBER
> >             || GET_CODE (x) == USE
> >             || GET_CODE (x) == ASM_INPUT)
> > 
> > I will post the fix after pass x86 bootstrap and regression
> 
> r215563 also introduced a miscompare on PowerPC for cpu2000 benchmark
> 254.gap. Applying your patch proposed on the gcc-patches ml for this bug
> fixes the issue.

and I am curious about whether there are any performance change since this insn
sink change.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (7 preceding siblings ...)
  2014-09-29 18:50 ` jiwang at gcc dot gnu.org
@ 2014-09-29 21:03 ` dominiq at lps dot ens.fr
  2014-10-01 20:45 ` pthaugen at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-09-29 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
For the record the test gfortran.dg/typebound_operator_3.f03 also failed with
-O1 and -m64 (see https://gcc.gnu.org/ml/gcc-regression/2014-09/msg00226.html).
This is fixed by the patch at
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02568.html.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (8 preceding siblings ...)
  2014-09-29 21:03 ` dominiq at lps dot ens.fr
@ 2014-10-01 20:45 ` pthaugen at gcc dot gnu.org
  2014-10-08  4:42 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2014-10-01 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Jiong Wang from comment #8)
> and I am curious about whether there are any performance change since this
> insn sink change.

I built/ran cpu2000 and didn't see any difference outside the noise range. The
number of shrink-wrapped procedures over the entire benchmark suite build went
from 558 to 567.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (9 preceding siblings ...)
  2014-10-01 20:45 ` pthaugen at gcc dot gnu.org
@ 2014-10-08  4:42 ` pinskia at gcc dot gnu.org
  2014-10-10 15:56 ` rth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-08  4:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sasha.levin at oracle dot com

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 63481 has been marked as a duplicate of this bug. ***


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (10 preceding siblings ...)
  2014-10-08  4:42 ` pinskia at gcc dot gnu.org
@ 2014-10-10 15:56 ` rth at gcc dot gnu.org
  2014-10-17 12:14 ` trippels at gcc dot gnu.org
  2014-11-07 15:55 ` jiwang at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: rth at gcc dot gnu.org @ 2014-10-10 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Richard Henderson <rth at gcc dot gnu.org> ---
Author: rth
Date: Fri Oct 10 15:56:07 2014
New Revision: 216096

URL: https://gcc.gnu.org/viewcvs?rev=216096&root=gcc&view=rev
Log:
PR target/63404

  * shrink-wrap.c (move_insn_for_shrink_wrap): Don't use single_set.
  Restrict the set of expressions we're willing to move.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/shrink-wrap.c


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (11 preceding siblings ...)
  2014-10-10 15:56 ` rth at gcc dot gnu.org
@ 2014-10-17 12:14 ` trippels at gcc dot gnu.org
  2014-11-07 15:55 ` jiwang at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-17 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

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

--- Comment #13 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Fixed.


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

* [Bug target/63404] [5 Regression] gcc 5 miscompiles linux block layer
  2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
                   ` (12 preceding siblings ...)
  2014-10-17 12:14 ` trippels at gcc dot gnu.org
@ 2014-11-07 15:55 ` jiwang at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jiwang at gcc dot gnu.org @ 2014-11-07 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jiong Wang <jiwang at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schwab@linux-m68k.org

--- Comment #14 from Jiong Wang <jiwang at gcc dot gnu.org> ---
*** Bug 63463 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2014-11-07 15:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29  4:20 [Bug middle-end/63404] New: gcc 5 miscompiles linux block layer andi-gcc at firstfloor dot org
2014-09-29  4:26 ` [Bug middle-end/63404] " andi-gcc at firstfloor dot org
2014-09-29  4:57 ` [Bug target/63404] " andi-gcc at firstfloor dot org
2014-09-29  8:29 ` [Bug target/63404] [5 Regression] " trippels at gcc dot gnu.org
2014-09-29 10:49 ` jiwang at gcc dot gnu.org
2014-09-29 11:14 ` jiwang at gcc dot gnu.org
2014-09-29 18:46 ` pthaugen at gcc dot gnu.org
2014-09-29 18:48 ` jiwang at gcc dot gnu.org
2014-09-29 18:50 ` jiwang at gcc dot gnu.org
2014-09-29 21:03 ` dominiq at lps dot ens.fr
2014-10-01 20:45 ` pthaugen at gcc dot gnu.org
2014-10-08  4:42 ` pinskia at gcc dot gnu.org
2014-10-10 15:56 ` rth at gcc dot gnu.org
2014-10-17 12:14 ` trippels at gcc dot gnu.org
2014-11-07 15:55 ` jiwang 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).