[Bug middle-end/36988] [4.4 Regression] ICE in gimple_rhs_has_side_effects, at gimple.c:2369

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 1 09:39:00 GMT 2008



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-08-01 09:37 -------
typedef struct {
    unsigned char mbxCommand;
} MAILBOX_t;
void lpfc_sli_brdrestart(void)
{
  volatile unsigned int word0;
  MAILBOX_t *mb;
  mb = (MAILBOX_t *) &word0;
  mb->mbxCommand = 0x1A;
  __writel((*(unsigned int *) mb));
}

So, we CCP &word0 into *mb.0_2 in

<bb 2>:
  mb_1 = (struct MAILBOX_t *) &word0;
  mb_1->mbxCommand ={v} 26;
  mb.0_2 = (unsigned int *) mb_1;
  D.1953_3 = *mb.0_2;

which is ok, but since word0 is volatile (and thus has TREE_SIDE_EFFECTS set)
the assert in gimple_rhs_has_side_effects complains about the statement
not being volatile, which is bogus.

The real problem here is that we do not trust the statement state
(this wasn't a volatile load in the source, so it should not become one
by mere propagation either), but try to verify it using state on the operands.
Now - as DECLs are shared - we have no choice other than making the statement
volatile here or not doing the propagation.  Both of which sucks, as we
have to sprinkle code to deal which such cases everywhere.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36988



More information about the Gcc-bugs mailing list