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.
Created attachment 14571 [details] preprocessed source
/* 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"); }
Testing a fix.
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
Fixed.