This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: I386 strlen "fix" (giveup)
This broke tiomisc.cc on Linux/x86, since we end up here at the very
beginning of a sequence, when last_insn is null. Here's a patch; does
this seem like the way to fix this problem?
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
* builtins.c (expand_builtin_strlen): Make sure that we have something
at the beginning of the sequence.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.34
diff -c -p -r1.34 builtins.c
*** builtins.c 2000/03/08 19:21:13 1.34
--- builtins.c 2000/03/10 19:45:46
*************** expand_builtin_strlen (exp, target, mode
*** 1381,1386 ****
--- 1381,1388 ----
/* Mark the beginning of the strlen sequence so we can emit the
source operand later. */
before_strlen = get_last_insn();
+ if (before_strlen == NULL_RTX)
+ before_strlen = emit_note (0, NOTE_INSN_DELETED);
/* Check the string is readable and has an end. */
if (current_function_check_memory_usage)