This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC expand_builtin_strlen ()
- To: grahams <grahams at rcp dot co dot uk>
- Subject: Re: RFC expand_builtin_strlen ()
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 16 Feb 2000 21:57:09 -0700
- cc: gcc at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
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