c/9835: ICE - segfault using -msoft-float with latest mips-elf toolchain

Fred Fish fnf@public.ninemoons.com
Tue Feb 25 17:31:00 GMT 2003


The following code (simplified from my original reported testcase)
triggers an internal compiler error when compiled with -O2 and
-msoft-float by the latest mips-elf toolchain:

  void
  foo ()
  {
    double dval;
    unsigned int ival;
  
    if (dval == 0)
      return;
    if (dval != dval)
      {
        bar (ival);
      }
    if (dval < 0)
      {
        bar (ival);
      }
  }

For example:

  $ ./cc1 -O2 -msoft-float segfault.i
   foo
  segfault.i: In function `foo':
  segfault.i:17: internal compiler error: Segmentation fault  

Comparing with a previously working compiler, I have backtracked the
problem to a recent change made to cprop_jump().  The following patch
that reverts one line of that change will sidestep the problem, but is
probably NOT the right fix.  Unfortunately my knowledge of gcc
internals is not sufficient for me to provide a better patch at this
time.

  Index: gcse.c
  ===================================================================
  RCS file: /mips/newtools/fsf/gcc/gcc/gcse.c,v
  retrieving revision 1.3
  diff -u -p -r1.3 gcse.c
  --- gcse.c    2003/02/24 15:40:41     1.3
  +++ gcse.c    2003/02/25 17:29:28
  @@ -4064,7 +4064,7 @@ cprop_jump (bb, setcc, jump, from, src)
   
         new_set = simplify_replace_rtx (SET_SRC (set),
                                      SET_DEST (setcc_set),
  -                                   setcc_set_src);
  +                                   SET_SRC (setcc_set));
       }
     else
       new_set = set;

-Fred



More information about the Gcc-bugs mailing list