Bug 34132

Summary: [4.3 Regression] ICE: internal consistency failure (invalid rtl sharing found in the insn)
Product: gcc Reporter: Martin Michlmayr <tbm>
Component: rtl-optimizationAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: falk, gcc-bugs, pinskia, rth
Priority: P3 Keywords: ice-on-valid-code
Version: 4.3.0   
Target Milestone: 4.3.0   
Host: Target: alpha-linux-gnu
Build: Known to work: 4.2.2
Known to fail: Last reconfirmed: 2007-11-18 10:37:04
Attachments: preprocessed source

Description Martin Michlmayr 2007-11-17 11:58:19 UTC
With current trunk on Alpha:

(sid)353:tbm@vorpal: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O1 smapi-api_sdm.c
(sid)354:tbm@vorpal: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O2 smapi-api_sdm.c
smapi-api_sdm.c: In function 'SdmOpenMsg':
smapi-api_sdm.c:15: error: invalid rtl sharing found in the insn
(insn 53 49 24 4 smapi-api_sdm.c:11 (set (reg:DI 77)
        (high:DI (symbol_ref:DI ("sd_msg") [flags 0x6] <var_decl 0x200002b85a0 sd_msg>))) 252 {*movdi_er_nofix} (expr_list:REG_EQUAL (high:DI (symbol_ref:DI ("sd_msg") [flags 0x6] <var_decl 0x200002b85a0 sd_msg>))
        (nil)))
smapi-api_sdm.c:15: error: shared rtx
(high:DI (symbol_ref:DI ("sd_msg") [flags 0x6] <var_decl 0x200002b85a0 sd_msg>))
smapi-api_sdm.c:15: internal compiler error: internal consistency failure
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Martin Michlmayr 2007-11-17 11:59:15 UTC
Created attachment 14571 [details]
preprocessed source
Comment 2 Martin Michlmayr 2007-11-17 11:59:49 UTC
/* Testcase by Martin Michlmayr <tbm@cyrius.com> */

static char *sd_msg = "%s%u.msg";
void SdmOpenMsg (short mode, char *msgname, int filemode)
{
  if (mode == 0)
  {
    xprintf (msgname, (char *) sd_msg);
    filemode = 1;
  }
  else if (mode == 1)
    filemode = 00;
  xprintf (msgname, (char *) sd_msg);
  xprintf (filemode, "%d");
}
Comment 3 Jakub Jelinek 2007-11-18 10:37:04 UTC
Testing a fix.
Comment 4 Jakub Jelinek 2007-11-18 19:22:44 UTC
Subject: Bug 34132

Author: jakub
Date: Sun Nov 18 19:22:35 2007
New Revision: 130275

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130275
Log:
	PR rtl-optimization/34132
	* gcse.c (try_replace_reg): Avoid rtx sharing between REG_EQUAL note
	and insn.

	* gcc.c-torture/compile/20071118-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20071118-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gcse.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2007-11-18 19:23:24 UTC
Fixed.