RFC expand_builtin_strlen ()

Jeffrey A Law law@cygnus.com
Wed Feb 16 21:02:00 GMT 2000


  In message < 389ADF4C.9141B73F@rcp.co.uk >you write:
  > All
  > 
  > The following code exits in expand_builtin_strlen() builtins.c
  > 
  > 	emit_insn (GEN_FCN (icode)(result, ...));
  > 
  > This calls gen_strlensi () which is generated from the 
  > define_expand "strlensi" pattern in the MD file.
  > 
  > On the x86 (latest CVS) this expander may fail and exit using
  > the FAIL macro this results in gen_strlensi () returning a NULL_RTX.
  > This NULL_RTX result is passed to emit_insn () which is obviously 
  > ther wrong thing to do. 
  > 
  > I think the above should be written so that if the expander
  > fails the compiler falls back to the strlen() library call
  > and pass the bogus NULL_RTX to emit_insn ().
  > 
  > 	expanded_rtx = GEN_FCN (icode)(result, ...);
  > 	if (!expanded_rtx)
  >   	   return NULL_RTX;
  > 
  > 	emit_insn (expanded_rtx);
Agreed.  cmpstrsi has the same problem.  I'll post a patch shortly.

jeff



More information about the Gcc mailing list