Bug 29329 - [4.1 regression] internal consistency failure
Summary: [4.1 regression] internal consistency failure
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.2
: P1 normal
Target Milestone: 4.1.2
Assignee: Eric Botcazou
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code
Depends on: 25514
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-03 09:45 UTC by Debian GCC Maintainers
Modified: 2007-01-21 22:40 UTC (History)
5 users (show)

See Also:
Host:
Target: arm-linux-gnu
Build:
Known to work: 4.0.4 4.2.0
Known to fail: 4.1.1
Last reconfirmed: 2007-01-12 09:09:57


Attachments
preprocessed source (14.78 KB, application/x-gzip)
2006-10-03 09:46 UTC, Debian GCC Maintainers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-10-03 09:45:43 UTC
[forwarded from http://bugs.debian.org/390694]

4.1 SVN 20060920, works with 4.2 and 4.0.4

$ gcc -c -fPIC -g -O2 -g tree234.i
tree234.c: In function 'delpos234_internal':
tree234.c:927: fatal error: internal consistency failure
compilation terminated.

compilation works with -O1

compilation with -O0:

$ gcc -c -fPIC -g -O0 -g tree234.i
/tmp/cco6vA7j.s: Assembler messages:
/tmp/cco6vA7j.s:172: Error: Rn must not overlap other operands -- `swpb r3,r2,[r3]'


  Matthias
Comment 1 Debian GCC Maintainers 2006-10-03 09:46:11 UTC
Created attachment 12376 [details]
preprocessed source
Comment 2 Andrew Pinski 2006-10-08 02:10:04 UTC
(In reply to comment #0)
> compilation with -O0:
> 
> $ gcc -c -fPIC -g -O0 -g tree234.i
> /tmp/cco6vA7j.s: Assembler messages:
> /tmp/cco6vA7j.s:172: Error: Rn must not overlap other operands -- `swpb
> r3,r2,[r3]'

That is a bug in the source:
 asm volatile(
   "# here \n\t"
   "swpb %0, %1, [%2] \n\t"
   : "=r" (val)
   : "r"(1), "r" (lock) : "memory"
 );

I don't know how to fix that in the inline-asm.  Maybe an early clobber can fix that.  I doubt this is related to the ICE anyways.
Comment 3 Andrew Pinski 2006-10-08 02:40:57 UTC
Reduced testcase:
struct node234_Tag
{
    int t1;
    int kids[4];
    void *elems[3];
};
void *add234_internal(struct node234_Tag *n, int ei)
{
  int j;
  for (j = ei; j < 2 && n->elems[j+1];)
    j++;
  n->kids[j+1] = 0;
}
Comment 4 Eric Botcazou 2006-11-01 12:27:34 UTC
Investigating.
Comment 5 Eric Botcazou 2006-11-02 07:44:26 UTC
The combiner drops a REG_DEAD note without updating liveness info.
Comment 6 Eric Botcazou 2007-01-05 07:31:27 UTC
Still blocked by 25514.  Mark, we badly need a decision for the latter.
Comment 7 Eric Botcazou 2007-01-21 22:32:50 UTC
Subject: Bug 29329

Author: ebotcazou
Date: Sun Jan 21 22:32:39 2007
New Revision: 121037

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121037
Log:
	PR rtl-optimization/29329
	* combine.c (replaced_rhs_insn): Rename to i2mod.
	(replaced_rhs_value): Rename to i2mod_new_rhs.
	(i2mod_old_rhs): New global variable.
	(combine_instructions): Adjust for above change.  Save a copy of
	the old RHS into i2mod_old_rhs when the contents of a REG_EQUAL
	note are substituted in the second instruction.
	(distribute_notes) <REG_DEAD>: Adjust for above change.  Do not
	ditch the note if it pertains to the second eliminated register
	and this register is mentioned in i2mod_old_rhs.

	Revert:
	2006-09-12  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* combine.c (distribute_notes) <REG_DEAD>: Do not consider SETs past
	the insn to which the note was originally attached.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20070121.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog

Comment 8 Eric Botcazou 2007-01-21 22:34:04 UTC
Subject: Bug 29329

Author: ebotcazou
Date: Sun Jan 21 22:33:52 2007
New Revision: 121038

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121038
Log:
	PR rtl-optimization/29329
	* combine.c (replaced_rhs_insn): Rename to i2mod.
	(replaced_rhs_value): Rename to i2mod_new_rhs.
	(i2mod_old_rhs): New global variable.
	(combine_instructions): Adjust for above change.  Save a copy of
	the old RHS into i2mod_old_rhs when the contents of a REG_EQUAL
	note are substituted in the second instruction.
	(distribute_notes) <REG_DEAD>: Adjust for above change.  Do not
	ditch the note if it pertains to the second eliminated register
	and this register is mentioned in i2mod_old_rhs.

	Revert:
	2006-09-12  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* combine.c (distribute_notes) <REG_DEAD>: Do not consider SETs past
	the insn to which the note was originally attached.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.c-torture/compile/20070121.c
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/combine.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 9 Eric Botcazou 2007-01-21 22:35:16 UTC
Subject: Bug 29329

Author: ebotcazou
Date: Sun Jan 21 22:34:57 2007
New Revision: 121039

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121039
Log:
	PR rtl-optimization/29329
	* combine.c (replaced_rhs_insn): Rename to i2mod.
	(replaced_rhs_value): Rename to i2mod_new_rhs.
	(i2mod_old_rhs): New global variable.
	(combine_instructions): Adjust for above change.  Save a copy of
	the old RHS into i2mod_old_rhs when the contents of a REG_EQUAL
	note are substituted in the second instruction.
	(distribute_notes) <REG_DEAD>: Adjust for above change.  Do not
	ditch the note if it pertains to the second eliminated register
	and this register is mentioned in i2mod_old_rhs.

	Revert:
	2006-09-12  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* combine.c (distribute_notes) <REG_DEAD>: Do not consider SETs past
	the insn to which the note was originally attached.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/20070121.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/combine.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 10 Eric Botcazou 2007-01-21 22:40:00 UTC
At long last.