Bug 36765 - [4.3 Regression] Revision 137573 miscompiles 464.h264ref in SPEC CPU 2006
Summary: [4.3 Regression] Revision 137573 miscompiles 464.h264ref in SPEC CPU 2006
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.4.0
: P1 major
Target Milestone: 4.3.3
Assignee: Richard Biener
URL:
Keywords: alias, wrong-code
: 38905 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-08 17:11 UTC by H.J. Lu
Modified: 2009-01-19 09:35 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0 4.3.2 4.4.0
Known to fail: 4.3.3
Last reconfirmed: 2009-01-18 22:09:14


Attachments
Small test case reduced from cpu2006.464.h264ref (1.84 KB, application/octet-stream)
2008-07-11 05:46 UTC, Joey Ye
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-07-08 17:11:28 UTC
Revision 137573 miscompiles 464.h264ref in SPEC CPU 2006 on Linux/x86-64
with -O2 -ffast-math:


Running Benchmarks
  Running 464.h264ref test base o2 default
Error with '/export/gnu/import/rrs/spec/2006/spec/bin/specinvoke -E -d /export/gnu/import/rrs/spec/2006/spec/benchspec/CPU2006/464.h264ref/run/run_base_test_o2.0000 -c 1 -e compare.err -o compare.stdout -f compare.cmd': check file '/export/gnu/import/rrs/spec/2006/spec/benchspec/CPU2006/464.h264ref/run/run_base_test_o2.0000/.err'
*** Miscompare of foreman_test_baseline_leakybucketparam.cfg, see /export/gnu/import/rrs/spec/2006/spec/benchspec/CPU2006/464.h264ref/run/run_base_test_o2.0000/foreman_test_baseline_leakybucketparam.cfg.mis
*** Miscompare of foreman_test_baseline_encodelog.out, see /export/gnu/import/rrs/spec/2006/spec/benchspec/CPU2006/464.h264ref/run/run_base_test_o2.0000/foreman_test_baseline_encodelog.out.mis
Invalid run; unable to continue.  If you wish to ignore errors please use '-I' or ignore_errors
Comment 1 Joey Ye 2008-07-11 05:46:46 UTC
Created attachment 15897 [details]
Small test case reduced from cpu2006.464.h264ref

/home/jye2/work/bug-37665> gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --disable-bootstrap --enable-languages=c,c++,fortran --enable-checking=assert
Thread model: posix
gcc version 4.4.0 20080707 (experimental) [trunk revision 137573] (GCC) 
/home/jye2/work/bug-37665> make -B && ./m.exe && echo PASS
gcc -c main.c -g
gcc -O2 -ffast-math -g   -c -o l5.o l5.c
gcc -o m.exe main.o l5.o
Bmin[0]=21
Aborted

/home/jye2/work/bug-37665> gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --disable-bootstrap --enable-languages=c,c++,fortran --enable-checking=assert
Thread model: posix
gcc version 4.4.0 20080707 (experimental) [trunk revision 137572] (GCC) 
/home/jye2/work/bug-37665> make -B && ./m.exe && echo PASS
gcc -c main.c -g
gcc -O2 -ffast-math -g   -c -o l5.o l5.c
gcc -o m.exe main.o l5.o
PASS
Comment 2 Joey Ye 2008-07-11 05:49:13 UTC
Effect of line 76 
    buffer_frame[0] = InitFullness;
is eliminated by optimizer due to bug in GCC.
Comment 3 Richard Biener 2008-07-11 10:15:59 UTC
Thanks for reducing this.
Comment 4 Richard Biener 2008-07-11 10:42:20 UTC
Turns out this is a problem I already have a patch in my queue.  Reduced
testcase:

int __attribute__((noinline))
foo(int i)
{
  int *p = __builtin_malloc (4 * sizeof(int));
  *p = 0;
  p[i] = 1;
  return *p;
}
extern void abort (void);
int main()
{
  if (foo(0) != 1)
    abort ();
  return 0;
}

The bug is latent since forever.
Comment 5 Richard Biener 2008-07-11 12:45:06 UTC
Fixed.
Comment 6 Richard Biener 2008-07-11 12:45:13 UTC
Subject: Bug 36765

Author: rguenth
Date: Fri Jul 11 12:44:26 2008
New Revision: 137715

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137715
Log:
2008-07-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36765
	* tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add
	aliases from HEAP vars to SMTs.

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

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

Comment 7 Richard Biener 2009-01-18 20:54:35 UTC
The testcase from comment #4 fails on the branch.  Re-opening, possibly
related to PR38905.
Comment 8 Richard Biener 2009-01-18 21:22:59 UTC
*** Bug 38905 has been marked as a duplicate of this bug. ***
Comment 9 H.J. Lu 2009-01-18 22:09:14 UTC
This patch:

http://gcc.gnu.org/ml/gcc/2009-01/msg00260.html

works on Linux/x86-64.
Comment 10 Richard Biener 2009-01-19 09:33:19 UTC
Subject: Bug 36765

Author: rguenth
Date: Mon Jan 19 09:33:06 2009
New Revision: 143494

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143494
Log:
2009-01-19  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2008-07-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36765
	* tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add
	aliases from HEAP vars to SMTs.

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

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr36765.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/gcc/tree-ssa-alias.c

Comment 11 Richard Biener 2009-01-19 09:35:22 UTC
Fixed.