public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45652]  New: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2
@ 2010-09-12 15:42 zsojka at seznam dot cz
  2010-09-12 15:44 ` [Bug rtl-optimization/45652] " zsojka at seznam dot cz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zsojka at seznam dot cz @ 2010-09-12 15:42 UTC (permalink / raw)
  To: gcc-bugs

I don't know how much is this related to PR43494. This one is failing with
-fselective-scheduling2 and with different target. Also it started failing just
few revisions ago.

Compiler output:
$ cd gcc/testsuite/gcc.dg/compat
$ gcc -O2 -fselective-scheduling2 scalar-by-value-3_main.c
scalar-by-value-3_x.c scalar-by-value-3_y.c
$ ./a.out 
Aborted

(fails with -O[23s])

Tested revisions:
r164228 - fail
r163636 - fail
r161659 - OK

Reduced testcase to follow.


-- 
           Summary: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs
                    with -O2 -fselective-scheduling2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug rtl-optimization/45652] [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2
  2010-09-12 15:42 [Bug rtl-optimization/45652] New: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2 zsojka at seznam dot cz
@ 2010-09-12 15:44 ` zsojka at seznam dot cz
  2010-09-12 17:57 ` rguenth at gcc dot gnu dot org
  2010-09-13 16:54 ` amonakov at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: zsojka at seznam dot cz @ 2010-09-12 15:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-09-12 15:44 -------
Created an attachment (id=21781)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21781&action=view)
reduced testcase

$ /mnt/svn/gcc-trunk/binary-163636-lto-fortran-checking-yes-rtl-df/bin/gcc -O2
-fselective-scheduling2 pr45652.c 
$ ./a.out 
Aborted


-- 


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


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

* [Bug rtl-optimization/45652] [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2
  2010-09-12 15:42 [Bug rtl-optimization/45652] New: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2 zsojka at seznam dot cz
  2010-09-12 15:44 ` [Bug rtl-optimization/45652] " zsojka at seznam dot cz
@ 2010-09-12 17:57 ` rguenth at gcc dot gnu dot org
  2010-09-13 16:54 ` amonakov at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-12 17:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug rtl-optimization/45652] [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2
  2010-09-12 15:42 [Bug rtl-optimization/45652] New: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2 zsojka at seznam dot cz
  2010-09-12 15:44 ` [Bug rtl-optimization/45652] " zsojka at seznam dot cz
  2010-09-12 17:57 ` rguenth at gcc dot gnu dot org
@ 2010-09-13 16:54 ` amonakov at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amonakov at gcc dot gnu dot org @ 2010-09-13 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amonakov at gcc dot gnu dot org  2010-09-13 16:53 -------
Confirmed.  Not related to PR43949 since selective scheduling does not use
cselib.  The miscompilation seems to come from RTL aliasing: sel-sched lifts a
load that references stack via a general-purpose register above a store via
%rsp.

"bad"  cmdline: cc1 -O2 -fselective-scheduling2 -fdbg-cnt=sel_sched_insn_cnt:31
"good" cmdline: cc1 -O2 -fselective-scheduling2 -fdbg-cnt=sel_sched_insn_cnt:30

The no-aliasing decision comes from (base_alias_check):
1742      /* If one address is a stack reference there can be no alias:
1743         stack references using different base registers do not alias,
1744         a stack reference can not alias a parameter, and a stack reference
1745         can not alias a global.  */
1746      if ((GET_CODE (x_base) == ADDRESS && GET_MODE (x_base) == Pmode)
1747          || (GET_CODE (y_base) == ADDRESS && GET_MODE (y_base) == Pmode))
1748        return 0;

Related GDB session:
Breakpoint 4, base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018,
x_mode=DImode, y_mode=SImode) at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1687
1687      rtx x_base = find_base_term (x);
(gdb) up
#1  0x000000000076da1d in true_dependence_1 (mem=0x7ffff6f2d030,
mem_mode=SImode, mem_addr=0x7ffff6f2d018, x=0x7ffff6f30870,
x_addr=0x7ffff6f20920, 
    varies=0x14041f2 <rtx_varies_p>, mem_canonicalized=0 '\000') at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:2440
2440      if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
(gdb) call debug_rtx(mem)
(mem/s/c:SI (plus:DI (reg/f:DI 7 sp)
        (const_int 12 [0xc])) [5 ap.fp_offset+0 S4 A32])
(gdb) call debug_rtx(x)
(mem/s:DI (reg:DI 4 si) [0 MEM[(struct S * {ref-all})addr.0_2]+0 S8 A64])
(gdb) down
#0  base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018, x_mode=DImode,
y_mode=SImode) at /home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1687
1687      rtx x_base = find_base_term (x);
(gdb) n
...
(gdb) list
1741    
1742      /* If one address is a stack reference there can be no alias:
1743         stack references using different base registers do not alias,
1744         a stack reference can not alias a parameter, and a stack reference
1745         can not alias a global.  */
1746      if ((GET_CODE (x_base) == ADDRESS && GET_MODE (x_base) == Pmode)
1747          || (GET_CODE (y_base) == ADDRESS && GET_MODE (y_base) == Pmode))
1748        return 0;
1749    
1750      return 1;
(gdb) call debug_rtx(x_base)
(address (reg:DI 4 si))
(gdb) call debug_rtx(y_base)
(address:DI (reg/f:DI 7 sp))
(gdb) fin
Run till exit from #0  base_alias_check (x=0x7ffff6f20920, y=0x7ffff6f2d018,
x_mode=DImode, y_mode=SImode)
    at /home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:1746
0x000000000076da1d in true_dependence_1 (mem=0x7ffff6f2d030, mem_mode=SImode,
mem_addr=0x7ffff6f2d018, x=0x7ffff6f30870, x_addr=0x7ffff6f20920, 
    varies=0x14041f2 <rtx_varies_p>, mem_canonicalized=0 '\000') at
/home/monoid/checkout/git/gcc-selfixes/gcc/alias.c:2440
2440      if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
Value returned is $58 = 0


-- 

amonakov at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-13 16:53:59
               date|                            |


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


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

end of thread, other threads:[~2010-09-13 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-12 15:42 [Bug rtl-optimization/45652] New: [4.6 Regression] gcc.dg/compat/scalar-by-value-3 FAILs with -O2 -fselective-scheduling2 zsojka at seznam dot cz
2010-09-12 15:44 ` [Bug rtl-optimization/45652] " zsojka at seznam dot cz
2010-09-12 17:57 ` rguenth at gcc dot gnu dot org
2010-09-13 16:54 ` amonakov at gcc dot gnu dot 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).