Bug 9745 - [3.3/3.4 regression][powerpc] miscompiles libmcrypt (alias problem during loop)
Summary: [3.3/3.4 regression][powerpc] miscompiles libmcrypt (alias problem during loop)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3
: P2 critical
Target Milestone: 3.3.1
Assignee: David Edelsohn
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2003-02-18 16:16 UTC by olh
Modified: 2004-01-17 04:22 UTC (History)
3 users (show)

See Also:
Host: powerpc-suse-linux
Target: powerpc-suse-linux
Build: powerpc-suse-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments
cast-256.i.gz (20.54 KB, application/x-gzip )
2003-05-21 15:17 UTC, olh
Details
self_test.i.gz (20.55 KB, application/x-gzip )
2003-05-21 15:17 UTC, olh
Details
Smaller example from pr11319 (228 bytes, text/plain)
2003-06-25 13:38 UTC, Andrew Pinski
Details
loop_regs_update patch for aliasing problems (651 bytes, patch)
2003-07-09 08:07 UTC, Jim Wilson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description olh 2003-02-18 16:16:01 UTC
gcc-3.3 branch miscompiles libmcrypt-2.5.5/modules/algorithms/cast-256.c with -O2
Using -O1 works.
make check fails:

Algorithm: cast-256... failed compatibility
Expected: 5db4dd765f1d3835615a14afcb5dc2f5
Got: 5944c34942d241e42814575ac5da8404

Modes:
   cbc: failed
   cfb: failed
   ctr: failed
   ecb: failed
   ncfb: failed
   nofb: failed
   ofb: failed

Algorithm: cast-256... failed compatibility
Expected: 5db4dd765f1d3835615a14afcb5dc2f5
Got: a4851815627314e950b04aa86f183c50

Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java --disable-checking --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix  
gcc version 3.3 20030215 (prerelease) (SuSE Linux)
 /usr/lib/gcc-lib/powerpc-suse-linux/3.3/cc1 -E -quiet -v -I. -I. -I../.. -I. -I../.. -I../../lib -MD cast-256.d -MF .deps/cast-256.Tpo -MP -MT cast-256.lo -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__PIC__=2 -D__pic__=2 -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=unix -Asystem=posix -DHAVE_CONFIG_H -DPIC cast-256.c -fsigned-char -fPIC -O1 cast-256.i
ignoring duplicate directory "."
ignoring duplicate directory "."
ignoring duplicate directory "../.."
#include "..." search starts here:
#include <...> search starts here:
 .
 ../..
 ../../lib
 /usr/local/include
 /usr/lib/gcc-lib/powerpc-suse-linux/3.3/include
 /usr/powerpc-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/powerpc-suse-linux/3.3/cc1 -fpreprocessed cast-256.i -quiet -dumpbase cast-256.c -auxbase cast-256 -O1 -version -fsigned-char -fPIC -o cast-256.s
GNU C version 3.3 20030215 (prerelease) (SuSE Linux) (powerpc-suse-linux)
        compiled by GNU C version 3.3 20030215 (prerelease) (SuSE Linux).
 /usr/lib/gcc-lib/powerpc-suse-linux/3.3/../../../../powerpc-suse-linux/bin/as -mppc -V -Qy -K PIC -o cast-256.o cast-256.s
GNU assembler version 2.13.90.0.18 (powerpc-suse-linux) using BFD version 2.13.90.0.18 20030121 (SuSE Linux)

Release:
gcc version 3.3 20030215 (prerelease) (SuSE Linux)

Environment:
glibc 2.3.1cvs 20030213, binutils 2.13.90.0.18
Comment 1 olh 2003-02-18 16:16:01 UTC
Fix:
http://gcc.gnu.org/ml/gcc-patches/2003-03/msg00549.html
Not necessarily the correct fix, but highlights the problem.
Comment 2 David Edelsohn 2003-02-20 22:04:24 UTC
Responsible-Changed-From-To: unassigned->dje
Responsible-Changed-Why: PowerPC
Comment 3 David Edelsohn 2003-02-20 22:04:24 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: strength reduction bug
Comment 4 janis187 2003-02-24 16:11:56 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, dje@gcc.gnu.org, gcc-bugs@gcc.gnu.org, olh@suse.de,
   gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: optimization/9745: gcc-3_3-branch miscompiles libmcrypt, native 
 powerpc-linux
Date: Mon, 24 Feb 2003 16:11:56 -0800

 This regression shows up starting with a huge patch that
 David S. Miller <davem@redhat.com> added on 2002-06-11 to
 "Delete SEQUENCE rtl usage outside of reorg and ssa passes".
 (The ChangeLog entry gives the incorrect date.)
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9745
Comment 5 Andrew Pinski 2003-06-25 13:35:26 UTC
*** Bug 11319 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2003-06-25 13:38:46 UTC
Created attachment 4280 [details]
Smaller example from pr11319

Here is a smaller example that has the problem, it comes from PR11319 which
marcus@jet.franken.de filed.
Comment 7 marcus 2003-06-30 11:27:18 UTC
10021 contains a patch which apparently fixes at least my testcase. 
Comment 8 olh 2003-07-05 10:10:16 UTC
discussion about this bug: 
http://gcc.gnu.org/ml/gcc/2003-07/msg00088.html 
Comment 9 Jim Wilson 2003-07-09 08:07:22 UTC
Created attachment 4367 [details]
loop_regs_update patch for aliasing problems

A new proposed patch which may be a better replacement for my earlier alias.c
find_base_value patch.
Comment 10 CVS Commits 2003-07-11 06:44:46 UTC
Subject: Bug 9745

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	wilson@gcc.gnu.org	2003-07-11 06:44:41

Modified files:
	gcc            : ChangeLog loop.c 

Log message:
	PR optimization/9745
	* loop.c (loop_iv_add_mult_emit_before): Call loop_regs_update before
	loop_insn_emit_before.
	(loop_iv_add_mult_sink, loop_iv_add_mult_hoist): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.451&r2=2.452
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&r1=1.462&r2=1.463

Comment 11 CVS Commits 2003-07-11 06:47:09 UTC
Subject: Bug 9745

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	wilson@gcc.gnu.org	2003-07-11 06:47:05

Modified files:
	gcc            : ChangeLog loop.c 

Log message:
	PR optimization/9745
	* loop.c (loop_iv_add_mult_emit_before): Call loop_regs_update before
	loop_insn_emit_before.
	(loop_iv_add_mult_sink, loop_iv_add_mult_hoist): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.648&r2=1.16114.2.649
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.433.2.7&r2=1.433.2.8

Comment 12 Jim Wilson 2003-07-11 06:53:22 UTC
loop.c patch checked in mainline and 3.3 branch.