Flow crash for conditional branches against a constant

Daniel Jacobowitz drow@false.org
Fri Jun 11 15:44:00 GMT 2004


I'm working on a port that has a branch instruction taking an unsigned
immediate.  Something like this is valid:

  (set (pc) (if_then_else (ne (reg:SI 66) (const_int 1)))
            (label_ref 1)
            (pc))

But flow.c completely falls down on this construct.  For instance, that will
cause not_reg_cond to abort because it is only prepared to handle comparison
against 0.

Flow also doesn't like this:
  (set (pc) (if_then_else (ne (subreg:SI (reg:QI 66)) (const_int 1)))
            (label_ref 1)
            (pc))
It uses REGNO on the first argument without checking for SUBREGs created by
combine.

Both of these are pretty easy to fix.  But are other parts of the compiler
going to misbehave also?  The relevant section of gccint hasn't been updated
in a while; it claims that only (OP (cc0) (const_int 0)) is valid in
if_then_else instructions, but this port doesn't use cc0.

-- 
Daniel Jacobowitz



More information about the Gcc mailing list