public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45051]  New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
@ 2010-07-24  2:43 hp at gcc dot gnu dot org
  2010-07-24  2:46 ` [Bug rtl-optimization/45051] " hp at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: hp at gcc dot gnu dot org @ 2010-07-24  2:43 UTC (permalink / raw)
  To: gcc-bugs

With revision 162417 this test passed.
>From revision 162418 and on, these tests (or "this test" as abs-3.c is
effectively the same as abs-2.c) has failed as follows:
Running
/tmp/badabs/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp ...
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O2 
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O3
-fomit-frame-pointer 
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -Os 
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O2 -flto 
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O2 -fwhopr 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -O2 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -O3
-fomit-frame-pointer 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -Os 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -O2 -flto 
FAIL: gcc.c-torture/execute/builtins/abs-3.c execution,  -O2 -fwhopr 

With the message in the logfile being:
...
PASS: gcc.c-torture/execute/builtins/abs-2.c compilation,  -O2 
program stopped with signal 6.
FAIL: gcc.c-torture/execute/builtins/abs-2.c execution,  -O2 
...
(i.e. abort being called)

Author of patch in suspect revision range CC:ed.

At a glance, the code change causes a register containing 0 to be used as
containing 0xffffffff for the low-part of 9223372036854775807LL ((1<<63)-1),
i.e. a mis-tracking of a DImode subreg.

I'll attach a smaller test-case and an assembly diff pointing out the wrong
code.


-- 
           Summary: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c
                    and abs-3.c due to "track subwords of DImode allocnos"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hp at gcc dot gnu dot org
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: cris-axis-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
@ 2010-07-24  2:46 ` hp at gcc dot gnu dot org
  2010-07-24  2:51 ` hp at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu dot org @ 2010-07-24  2:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hp at gcc dot gnu dot org  2010-07-24 02:46 -------
Created an attachment (id=21295)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21295&action=view)
Shortened gcc.c-torture/execute/builtins/abs-2.c

Compile with e.g. -O2


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
  2010-07-24  2:46 ` [Bug rtl-optimization/45051] " hp at gcc dot gnu dot org
@ 2010-07-24  2:51 ` hp at gcc dot gnu dot org
  2010-07-24  3:03 ` hp at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu dot org @ 2010-07-24  2:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hp at gcc dot gnu dot org  2010-07-24 02:51 -------
(In reply to comment #0)
Oops; replace:
> containing 0xffffffff for the low-part of 9223372036854775807LL ((1<<63)-1),
with:
> containing 0x7fffffff for the high-part of 9223372036854775807LL ((1<<63)-1),


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
  2010-07-24  2:46 ` [Bug rtl-optimization/45051] " hp at gcc dot gnu dot org
  2010-07-24  2:51 ` hp at gcc dot gnu dot org
@ 2010-07-24  3:03 ` hp at gcc dot gnu dot org
  2010-07-27  9:35 ` bernds at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu dot org @ 2010-07-24  3:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hp at gcc dot gnu dot org  2010-07-24 03:02 -------
--- good:r162417/abs-2.s        Sat Jul 24 03:13:36 2010
+++ bad:r162418/abs-2.s Sat Jul 24 03:15:53 2010
@@ -9,27 +9,27 @@ _main_test:
        move $srp,[$sp]
        subu.b 84,$sp
        movem $r8,[$sp]
-       clear.d $r4
-       clear.d $r5
-       move.b 1,$r4
-       move.d $r4,[$sp+76]
-       move.d $r5,[$sp+80]
+       clear.d $r0      ; (set (reg:SI r0) (const_int 0))
+       clear.d $r1
+       move.b 1,$r0     ; (set (strict_low_part:QI (reg:SI r0)) (const_int 1))
+       move.d $r0,[$sp+76]
+       move.d $r1,[$sp+80]
        moveq -1,$r12
        move.d $r12,[$sp+68]
        move.d $r12,[$sp+72]
-       clear.d $r10
-       move.d $r4,$r11
-       move.d $r11,$r8
-       move.d -2147483648,$r0
-       move.d $r11,[$sp+60]
-       move.d $r10,[$sp+64]
-       move.d 2147483647,$r11
+       move.d $r0,$r10
+       move.d -2147483648,$r11
+       move.d $r10,[$sp+60]
+       move.d $r11,[$sp+64]
+       clear.b $r0     ; (set (strict_low_part:QI (reg:SI r9)) (const_int 0))
+       move.d $r0,$r9  ; (set (reg:SI r9) (reg:SI r0))
+       move.d 2147483647,$r0
        move.d $r12,[$sp+52]
-       move.d $r11,[$sp+56]
-       move.d $r8,[$sp+44]
-       move.d $r0,[$sp+48]
+       move.d $r9,[$sp+56]     ; stored here
+       move.d $r10,[$sp+44]
+       move.d $r11,[$sp+48]
        move.d $r12,[$sp+36]
-       move.d $r11,[$sp+40]
+       move.d $r0,[$sp+40]
        move.d [$sp+52],$r12
        move.d [$sp+56],$r13    ; loaded here
        test.d $r12 ; fatally tested below; containing 0, expected 0x7fffffff


-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-24 03:02:58
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-24  3:03 ` hp at gcc dot gnu dot org
@ 2010-07-27  9:35 ` bernds at gcc dot gnu dot org
  2010-07-27 21:49 ` bernds at gcc dot gnu dot org
  2010-09-21 21:26 ` hp at gcc dot gnu dot org
  5 siblings, 0 replies; 12+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-07-27  9:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bernds at gcc dot gnu dot org  2010-07-27 09:35 -------
Subject: Bug 45051

Author: bernds
Date: Tue Jul 27 09:34:51 2010
New Revision: 162558

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162558
Log:
        PR rtl-optimization/45051
        * reload1.c (delete_output_reload): Use refers_to_regno_p rather
        than reg_mentioned_p.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reload1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-27  9:35 ` bernds at gcc dot gnu dot org
@ 2010-07-27 21:49 ` bernds at gcc dot gnu dot org
  2010-09-21 21:26 ` hp at gcc dot gnu dot org
  5 siblings, 0 replies; 12+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-07-27 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from bernds at gcc dot gnu dot org  2010-07-27 21:49 -------
Assuming fixed and closing.  Please reopen if you still have a problem.


-- 

bernds at gcc dot gnu dot org changed:

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
  2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-27 21:49 ` bernds at gcc dot gnu dot org
@ 2010-09-21 21:26 ` hp at gcc dot gnu dot org
  5 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu dot org @ 2010-09-21 21:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hp at gcc dot gnu dot org  2010-09-21 21:26 -------
Subject: Bug 45051

Author: hp
Date: Tue Sep 21 21:25:57 2010
New Revision: 164498

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164498
Log:
        PR rtl-optimization/41085
        Backport from mainline
        2010-07-27  Bernd Schmidt  <bernds@codesourcery.com>

        PR rtl-optimization/45051
        * reload1.c (delete_output_reload): Use refers_to_regno_p rather
        than reg_mentioned_p.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/reload1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
       [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-01-03 19:58 ` rguenth at gcc dot gnu.org
@ 2011-01-03 20:01 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-03 20:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051

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

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

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-03 20:01:41 UTC ---
Original problem was fixed.  Please open a new bug for any other issues.


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
       [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-12-23 14:29 ` hp at gcc dot gnu.org
@ 2011-01-03 19:58 ` rguenth at gcc dot gnu.org
  2011-01-03 20:01 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-03 19:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
       [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
  2010-12-22 16:23 ` ibolton at gcc dot gnu.org
  2010-12-23  1:56 ` hp at gcc dot gnu.org
@ 2010-12-23 14:29 ` hp at gcc dot gnu.org
  2011-01-03 19:58 ` rguenth at gcc dot gnu.org
  2011-01-03 20:01 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu.org @ 2010-12-23 14:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051

--- Comment #9 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2010-12-23 14:29:13 UTC ---
(In reply to comment #8)
> Nevertheless, I'm testing r162418 with your patch.

FWIW, no regressions for cris-elf, with your patch (manually) applied on top of
Bernds's patch applied to r162418.


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
       [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
  2010-12-22 16:23 ` ibolton at gcc dot gnu.org
@ 2010-12-23  1:56 ` hp at gcc dot gnu.org
  2010-12-23 14:29 ` hp at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: hp at gcc dot gnu.org @ 2010-12-23  1:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051

--- Comment #8 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2010-12-23 01:56:08 UTC ---
(In reply to comment #7)
>  (insn 3163 3161 3164 107 rectmm.c:1041 (set (reg:SI 1 r1) 
>     (plus:SI (reg:SI 1 r1) 
>        (const_int 280 [0x118]))) 4 {*arm_addsi3} (nil))

> I think the issue might be that reg_mentioned_p() considers output registers to
> have been "mentioned", whereas the refers_to_regno_p() does not consider an
> output register to have been "referred to".

But r1 is an input as well as an output , i.e. "referred to", so insn 3163
should have matched without your patch.  I'm missing analysis on why that
didn't happen.  Nevertheless, I'm testing r162418 with your patch.

Also, you should open a separate PR for the regression you see, not just reuse
this one. Use the depends-on features for the dependency.


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

* [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
       [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
@ 2010-12-22 16:23 ` ibolton at gcc dot gnu.org
  2010-12-23  1:56 ` hp at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: ibolton at gcc dot gnu.org @ 2010-12-22 16:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45051

Ian Bolton <ibolton at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |ibolton at gcc dot gnu.org
         Resolution|FIXED                       |

--- Comment #7 from Ian Bolton <ibolton at gcc dot gnu.org> 2010-12-22 16:23:21 UTC ---
(In reply to comment #5)
> Assuming fixed and closing.  Please reopen if you still have a problem.

This patch has caused SpecCPU2000 Ammp to fail for ARM -O3 thumb.

I assume the patch was meant to prevent deletions that shouldn't occur.  This
might be what happens for the original symptomatic test, but I am now seeing
extra deletions that shouldn't happen for Ammp.

For example, without this patch, you get these insns somewhere in the ira dump
for mm_fv_update_nonbon() from rectmm.c:

 (insn 3163 3161 3164 107 rectmm.c:1041 (set (reg:SI 1 r1) 
    (plus:SI (reg:SI 1 r1) 
       (const_int 280 [0x118]))) 4 {*arm_addsi3} (nil))

 (insn 3164 3163 1730 107 rectmm.c:1041 (set (reg:SI 3 r3) 
    (reg:SI 1 r1)) 586 {*thumb2_movsi_vfp} (nil))

With the patch, you lose the add and just get this:

 (insn 3164 3161 1730 107 rectmm.c:1041 (set (reg:SI 3 r3)
    (reg:SI 1 r1)) 586 {*thumb2_movsi_vfp} (nil)) 

The incrementing of r1 is perfectly legitimate and useful and removing it is a
bug.  Other increments of r9, ip, r0 and r3 are also lost.

I think the issue might be that reg_mentioned_p() considers output registers to
have been "mentioned", whereas the refers_to_regno_p() does not consider an
output register to have been "referred to".  I can see the problem with only
using reg_mentioned_p() because it doesn't handle subregs, but there is also a
problem with only using refers_to_regno_p(), as we can see with this segfault
in Ammp.

I therefore wonder if the fix might be this:

Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c       (revision 168082)
+++ gcc/reload1.c       (working copy)
@@ -8395,7 +8395,8 @@ delete_output_reload (rtx insn, int j, i
       if (NOTE_INSN_BASIC_BLOCK_P (i1))
        return;
       if ((NONJUMP_INSN_P (i1) || CALL_P (i1))
-         && refers_to_regno_p (regno, regno + nregs, PATTERN (i1), NULL))
+         && (refers_to_regno_p (regno, regno + nregs, PATTERN (i1), NULL)
+             || reg_mentioned_p (reg, PATTERN (i1))))
        {
          /* If this is USE in front of INSN, we only have to check that
             there are no more references than accounted for by inheritance. 
*/

I am heading off for Christmas vacation shortly, so cannot look into this any
further, but I wanted to record my findings so far publicly.  Apologies if
there is missing information.  I return to work Jan 4th.


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

end of thread, other threads:[~2011-01-03 20:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-24  2:43 [Bug rtl-optimization/45051] New: [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos" hp at gcc dot gnu dot org
2010-07-24  2:46 ` [Bug rtl-optimization/45051] " hp at gcc dot gnu dot org
2010-07-24  2:51 ` hp at gcc dot gnu dot org
2010-07-24  3:03 ` hp at gcc dot gnu dot org
2010-07-27  9:35 ` bernds at gcc dot gnu dot org
2010-07-27 21:49 ` bernds at gcc dot gnu dot org
2010-09-21 21:26 ` hp at gcc dot gnu dot org
     [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
2010-12-22 16:23 ` ibolton at gcc dot gnu.org
2010-12-23  1:56 ` hp at gcc dot gnu.org
2010-12-23 14:29 ` hp at gcc dot gnu.org
2011-01-03 19:58 ` rguenth at gcc dot gnu.org
2011-01-03 20:01 ` rguenth 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).