Bug 42113 - [4.3/4.4/4.5 Regression] Internal Compiler error with -O3, breaking commit known
Summary: [4.3/4.4/4.5 Regression] Internal Compiler error with -O3, breaking commit known
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.2
: P4 major
Target Milestone: 4.3.5
Assignee: Uroš Bizjak
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-20 00:43 UTC by Matt Turner
Modified: 2010-03-27 12:17 UTC (History)
3 users (show)

See Also:
Host: alpha-unknown-linux-gnu
Target: alpha-unknown-linux-gnu
Build: alpha-unknown-linux-gnu
Known to work: 4.3.4 4.4.1
Known to fail: 4.3.5 4.4.2 4.5.0
Last reconfirmed: 2009-11-20 10:42:41


Attachments
Test Case 1 - pp.i - preprocessed pp.c from libperl (70.20 KB, text/plain)
2009-11-20 00:44 UTC, Matt Turner
Details
Test Case 2 - flist.i - preprocessed flist.c from rsync (45.69 KB, text/plain)
2009-11-20 00:45 UTC, Matt Turner
Details
patch to fix mode of scratch register in *cmp_s{add,sub}_si{,di} (372 bytes, patch)
2009-11-20 13:40 UTC, Uroš Bizjak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Turner 2009-11-20 00:43:54 UTC
Unfortunately, but 8603 seems to cause internal compiler errors on select files when using -O3. -O{s,0,1,2} are unaffected.

I'm attaching pp.i (preprocessed pp.c from libperl), and flist.i (preprocessed flist.c from rsync) as test cases.

gcc-4.3.4 does not exhibit this failure, but when patched from bug 8603, it fails. gcc-4.4.1 does not exhibit this failure, but gcc-4.4.2, which includes the patch from 8603, does fail.
Comment 1 Matt Turner 2009-11-20 00:44:54 UTC
Created attachment 19061 [details]
Test Case 1 - pp.i - preprocessed pp.c from libperl
Comment 2 Matt Turner 2009-11-20 00:45:23 UTC
Created attachment 19062 [details]
Test Case 2 - flist.i - preprocessed flist.c from rsync
Comment 3 Uroš Bizjak 2009-11-20 10:06:34 UTC
Both files compile OK with 4.5 cross from x86_64-pc-linux-gnu.

Probably a target specific patch should be backported from mainline to 4.3 and 4.4 branches.
Comment 4 Uroš Bizjak 2009-11-20 10:42:41 UTC
Confirmed with 4.4 cross.
Comment 5 Uroš Bizjak 2009-11-20 12:58:01 UTC
This reduced testcase fails also on 4.5:

--cut here--
int make_file (int a, int b)
{
  int foo = a * sizeof (int);

  if (b)
    foo += sizeof (int);

  return foo;
}
--cut here--
Comment 6 Uroš Bizjak 2009-11-20 13:40:57 UTC
Created attachment 19067 [details]
patch to fix mode of scratch register in *cmp_s{add,sub}_si{,di}

This patch fixes wrong modes of scratch register in *cmp_s{add,sub}_si{,di} patterns.
Comment 7 Matt Turner 2009-11-21 16:15:43 UTC
I can confirm that the attached patch fixes the issue. Thanks!
Comment 8 uros 2009-11-22 09:31:08 UTC
Subject: Bug 42113

Author: uros
Date: Sun Nov 22 09:30:50 2009
New Revision: 154423

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154423
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to SImode.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.

testsuite/ChangeLog:

	PR target/42113
	* gcc.target/alpha/pr42113.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/alpha/pr42113.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/alpha.md
    trunk/gcc/testsuite/ChangeLog

Comment 9 Matt Turner 2009-11-22 17:52:16 UTC
WRT the test suite: should it be 

/* { dg-options "-O2" } */

or

/* { dg-options "-O3" } */

That is, -O2 or -O3? I could only produce the internal compiler error with -O3, and not at all with -Os, -O0, -O1, -O2.
Comment 10 Uroš Bizjak 2009-11-22 18:10:44 UTC
Subject: Re:  [4.3/4.4/4.5 Regression] Internal Compiler
 error with -O3, breaking commit known

On 11/22/2009 06:52 PM, mattst88 at gmail dot com wrote:
> ------- Comment #9 from mattst88 at gmail dot com  2009-11-22 17:52 -------
> WRT the test suite: should it be
>
> /* { dg-options "-O2" } */
>
> or
>
> /* { dg-options "-O3" } */
>
> That is, -O2 or -O3? I could only produce the internal compiler error with -O3,
> and not at all with -Os, -O0, -O1, -O2.
>    

The testcase also fails with -O2,.

Uros.


Comment 11 uros 2009-11-23 21:14:49 UTC
Subject: Bug 42113

Author: uros
Date: Mon Nov 23 21:14:32 2009
New Revision: 154464

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154464
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to SImode.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.

testsuite/ChangeLog:

	PR target/42113
	* gcc.target/alpha/pr42113.c: New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/alpha/pr42113.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/alpha/alpha.md
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog

Comment 12 uros 2009-11-23 21:27:42 UTC
Subject: Bug 42113

Author: uros
Date: Mon Nov 23 21:27:30 2009
New Revision: 154465

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154465
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to SImode.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.

testsuite/ChangeLog:

	PR target/42113
	* gcc.target/alpha/pr42113.c: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/alpha/pr42113.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/alpha/alpha.md
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 13 Uroš Bizjak 2009-11-23 21:30:39 UTC
Fixed.
Comment 14 uros 2010-03-26 18:46:09 UTC
Subject: Bug 42113

Author: uros
Date: Fri Mar 26 18:45:56 2010
New Revision: 157759

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157759
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to DImode.  Split to DImode comparison operator.
	Use SImode subreg of scratch register in the multiplication.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/alpha.md

Comment 15 uros 2010-03-27 12:09:37 UTC
Subject: Bug 42113

Author: uros
Date: Sat Mar 27 12:09:24 2010
New Revision: 157774

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157774
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to DImode.  Split to DImode comparison operator.
	Use SImode subreg of scratch register in the multiplication.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.


Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/alpha/alpha.md

Comment 16 uros 2010-03-27 12:16:33 UTC
Subject: Bug 42113

Author: uros
Date: Sat Mar 27 12:15:50 2010
New Revision: 157775

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157775
Log:
	PR target/42113
	* config/alpha/alpha.md (*cmp_sadd_si): Change mode
	of scratch register to DImode.  Split to DImode comparison operator.
	Use SImode subreg of scratch register in the multiplication.
	(*cmp_sadd_sidi): Ditto.
	(*cmp_ssub_si): Ditto.
	(*cmp_ssub_sidi): Ditto.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/alpha/alpha.md

Comment 17 Uroš Bizjak 2010-03-27 12:17:15 UTC
Fixed in a better way.