[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-12-10 Thread rguenth at gcc dot gnu dot org


--- Comment #16 from rguenth at gcc dot gnu dot org  2008-12-10 18:43 
---
*** Bug 38478 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||bjg at gnu dot org


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-20 Thread rguenth at gcc dot gnu dot org


--- Comment #15 from rguenth at gcc dot gnu dot org  2008-11-20 12:15 
---
*** Bug 38169 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||holger dot hopp at sap dot
   ||com


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-18 Thread dominiq at lps dot ens dot fr


--- Comment #11 from dominiq at lps dot ens dot fr  2008-11-18 13:38 ---
The test fails on powerpc-apple-darwin9 (revision 141945, 32 and 64 bit modes):

FAIL: gcc.c-torture/execute/pr38051.c execution,  -O0 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O1 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O2 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O3 -fomit-frame-pointer
-funroll-loops 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/pr38051.c execution,  -Os 


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-18 Thread sje at cup dot hp dot com


--- Comment #12 from sje at cup dot hp dot com  2008-11-18 17:31 ---
The new test is also failing on IA64 HP-UX and PA HP-UX (32 and 64 bits).  It
is not failing on IA64 Linux.  Could the test have a big-endian/little-endian
issue?


-- 

sje at cup dot hp dot com changed:

   What|Removed |Added

 CC||sje at cup dot hp dot com


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-18 Thread jakub at gcc dot gnu dot org


--- Comment #13 from jakub at gcc dot gnu dot org  2008-11-18 18:19 ---
See http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00905.html


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-18 Thread jakub at gcc dot gnu dot org


--- Comment #14 from jakub at gcc dot gnu dot org  2008-11-18 23:03 ---
Subject: Bug 38051

Author: jakub
Date: Tue Nov 18 23:01:35 2008
New Revision: 141983

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=141983
Log:
PR tree-optimization/38051
* gcc.c-torture/execute/pr38051.c (buf): Remove aligned attribute.
(buf2): Removed.
(main): Only run on little endian targets with
sizeof (long) == sizeof (void *).  Use just one buffer, align the
pointers at runtime.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.c-torture/execute/pr38051.c


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-15 Thread jakub at gcc dot gnu dot org


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P1


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-15 Thread rguenth at gcc dot gnu dot org


--- Comment #9 from rguenth at gcc dot gnu dot org  2008-11-15 15:39 ---
Subject: Bug 38051

Author: rguenth
Date: Sat Nov 15 15:37:57 2008
New Revision: 141887

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=141887
Log:
2008-11-15  Richard Guenther  [EMAIL PROTECTED]

PR tree-optimization/38051
* tree-ssa-alias.c (update_alias_info_1): Manually find
written variables.

* gcc.c-torture/execute/pr38051.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr38051.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-alias.c


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-15 Thread rguenth at gcc dot gnu dot org


--- Comment #10 from rguenth at gcc dot gnu dot org  2008-11-15 15:42 
---
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread jakub at gcc dot gnu dot org


--- Comment #1 from jakub at gcc dot gnu dot org  2008-11-07 14:57 ---
-fno-tree-pre fixes this.


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2008-11-07 15:29 ---
Confirmed.  PRE doesn't do anything interesting though, neither are the
differences in the optimized dump interesting from a first look.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-11-07 15:29:03
   date||


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread jakub at gcc dot gnu dot org


--- Comment #4 from jakub at gcc dot gnu dot org  2008-11-07 16:32 ---
*.copyprop4 still contains the needed stores:
  [gg5.c : 151] D.2147_293 = a3D.2068_292  shlD.2074_195;
  [gg5.c : 151] D.2148_295 = a0D.2065_294  shrD.2075_198;
  [gg5.c : 151] xD.2073_296 = D.2148_295 | D.2147_293;
  [gg5.c : 152] if (xD.2073_296 != b0D.2069_297)
goto bb 51;
  else
goto bb 55 (do2);
  # SUCC: 51 [72.0%]  (true,exec) 55 [28.0%]  (irreducible,false,exec)

  # BLOCK 51 freq:370, starting at line 0
  # PRED: 50 [72.0%]  (true,exec)
  # aD.2099_621 = VDEF aD.2099_620(D) { aD.2099 }
  aD.2099 = xD.2073_296;
  # bD.2098_623 = VDEF bD.2098_622(D) { bD.2098 }
  bD.2098 = b0D.2069_297;
  [gg5.c : 8] srcp1D.2100_298 = (long intD.2) [gg5.c : 8] aD.2099;
  [gg5.c : 9] srcp2D.2101_299 = (long intD.2) [gg5.c : 9] bD.2098;

  # BLOCK 52 freq:2640
  # PRED: 51 [100.0%]  (fallthru,exec) 53 [100.0%]  (fallthru,exec)
  # srcp1D.2100_300 = PHI srcp1D.2100_298(51), srcp1D.2100_308(53)
  # srcp2D.2101_304 = PHI srcp2D.2101_299(51), srcp2D.2101_309(53)
  [gg5.c : 13] srcp1.0D.2149_301 = (unsigned charD.10 *) srcp1D.2100_300;
  [gg5.c : 13] # VUSE aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D) { aD.1965 bD.1970 aD.1971 bD.1976 aD.1977 bD.1982
aD.1983 SMT.25D.2200 }
  D.2150_302 = *srcp1.0D.2149_301;
  [gg5.c : 13] a0D.2102_303 = (long unsigned intD.4) D.2150_302;
  [gg5.c : 14] srcp2.1D.2151_305 = (unsigned charD.10 *) srcp2D.2101_304;
  [gg5.c : 14] # VUSE aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D) { aD.1965 bD.1970 aD.1971 bD.1976 aD.1977 bD.1982
aD.1983 SMT.25D.2200 }
  D.2152_306 = *srcp2.1D.2151_305;

(a = x and b = b0) before taking their addresses, but *.dceloop1 nukes them,
supposedly because VUSE on the *srcp1 and *srcp2 reads is wrong.  This is with
-O2 -fno-strict-aliasing, but even with strict aliasing taking an address of an
unsigned long variable, casting it to unsigned char * and reading it a single
byte at a time through unsigned char * pointer is valid.


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread jakub at gcc dot gnu dot org


--- Comment #3 from jakub at gcc dot gnu dot org  2008-11-07 16:19 ---
In assembly, it seems the a and b arguments to mymemcmp1 aren't stored into
memory at all:
.loc 1 128 0
movq(%rax), %r12#* srcp2.272, b0
.LVL54:
.loc 1 126 0
movq(%rdi), %rsi#* srcp1, a3
.LVL55:
.loc 1 127 0
movq8(%rdi), %rbx   #, a0
.LVL56:
.loc 1 129 0
addq$8, %rdi#, srcp1.270
.LVL57:
.L28:
.loc 1 152 0
movl%r9d, %ecx  #,
.LVL58:
movq%rbx, %r10  # a0, tmp154
.loc 1 149 0
movq8(%rdi), %r11   #, a1
.LVL59:
.loc 1 152 0
salq%cl, %r10   #, tmp154
movl%r8d, %ecx  #,
.loc 1 150 0
movq8(%rax), %rbp   #, b1
.LVL60:
.loc 1 152 0
shrq%cl, %rsi   #, tmp155
.LVL61:
orq %rsi, %r10  # tmp155, tmp156
cmpq%r12, %r10  # b0, tmp156
je  .L26#,
.LBB112:
.LBB113:
.loc 1 8 0
leaq-8(%rsp), %rcx  #, srcp1
.LVL62:
.loc 1 9 0
leaq-16(%rsp), %rdx #, srcp2
.LVL63:
.p2align 4,,10
.p2align 3
.L31:
.loc 1 13 0
movzbl  (%rcx), %eax#* srcp1, a0
.LVL64:
.loc 1 14 0
movzbl  (%rdx), %edi#* srcp2, b0
...

At je .L26 insn %r12 register contains correct value of b0 variable and %r10 of
x (shifted + ored together value).  But then suddenly the code assumes it is in
memory without actually storing it there.


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2008-11-07 17:35 ---
I will have a look.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Keywords||alias
   Last reconfirmed|2008-11-07 15:29:03 |2008-11-07 17:35:59
   date||


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread jakub at gcc dot gnu dot org


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.4.0


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread jakub at gcc dot gnu dot org


--- Comment #5 from jakub at gcc dot gnu dot org  2008-11-07 16:46 ---
At *.crited there is still a virtual dependency between a = x; (and b = b0;)
and
*srcp1 + *srcp2 reads:
  # MPT.26D.2201_438 = VDEF MPT.26D.2201_421(D) { MPT.26D.2201 }
  aD.2099 = xD.2073_296;
  # MPT.26D.2201_439 = VDEF MPT.26D.2201_438 { MPT.26D.2201 }
  bD.2098 = b0D.2069_297;
...
  [gg5.c : 13] # VUSE aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D), MPT.26D.2201_439 { aD.1965 bD.1970 aD.1971 bD.1976
aD.1977 bD.1982 aD.1983 SMT.25D.2200 MPT.26D.2201
}
  D.2150_302 = *srcp1.0D.2149_301;
...
  [gg5.c : 14] # VUSE aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D), MPT.26D.2201_439 { aD.1965 bD.1970 aD.1971 bD.1976
aD.1977 bD.1982 aD.1983 SMT.25D.2200 MPT.26D.2201
}
  D.2152_306 = *srcp2.1D.2151_305;

through MPT.26.  But in *.pre that's gone and there is no virtual dependency
between them anymore.


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2008-11-07 18:43 ---
During update_alias_info we collect the variables that are written to, but
because we use gimple_stored_syms to get at them we miss those that are in
memory partitions.  If the new partitioning moves them out of a partition
we then miss conflicts for them.  Oops.

I have a patch.


-- 


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



[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

2008-11-07 Thread rguenth at gcc dot gnu dot org


--- Comment #8 from rguenth at gcc dot gnu dot org  2008-11-07 19:33 ---
Created an attachment (id=16633)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16633action=view)
prototype patch

Prototype patch.  It needs some work as appearantly we cannot use MPT_SYMBOLS
reliably there - I get random segfaults / referenced_var_lookup ICEs.

As we are only interested in symbols we can just look at the statement
manually.
But at least for asms that will need some work.


-- 


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