RFC expand_builtin_strlen ()

grahams grahams@rcp.co.uk
Fri Feb 4 06:19:00 GMT 2000


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);

Graham


More information about the Gcc mailing list