Another unrecognizable insn in current CVS snapshot
Clinton Popetz
cpopetz@cygnus.com
Tue Apr 4 09:42:00 GMT 2000
On Tue, Apr 04, 2000 at 12:48:59AM -0500, James A. Bednar wrote:
>
> Using the GCC Online Compiler Submission at
> http://www.codesourcery.com/gcc-compile.html on the following code
> generates an "Unrecognizable insn" internal compiler error (see
> attached):
>
> typedef struct {
> char name[64];
> } Name;
>
> typedef struct {
> Name list[250];
> } NameList;
>
> NameList names;
>
> void f()
> {
> int idx=0;
> while (strlen(names.list[idx].name))
> idx++;
> }
A smaller example would be:
char list[250][64];
int f(int idx) { return (strlen(list[idx])); }
> This may be due to the same problem as my bug report of a few minutes
> ago, since the same GCC line number is mentioned in the error message
> below.
Nope, that's just a common place for gcc to fail.
The problem is in expand_builtin_strlen, which used to do this:
src_rtx = memory_address (BLKmode,
expand_expr (src, NULL_RTX, ptr_mode,
EXPAND_NORMAL));
but now does this:
pat = expand_expr (src, src_reg, ptr_mode, EXPAND_SUM);
as a result of this patch:
2000-03-08 Richard Henderson <rth@cygnus.com>
* builtins.c (expand_builtin_strlen): Be prepared for strlensi
to fail. Don't pre-expand the source operand.
In the above case will result in:
(insn 22 7 13 (set (reg:SI 29)
(plus:SI (mult:SI (reg/v:SI 26)
(const_int 64 [0x40]))
(symbol_ref:SI ("list")))) -1 (nil)
(nil))
for the src. It seems we should probably legitimize the address here. Ok?
-Clint
2000-04-04 Clinton Popetz <cpopetz@cygnus.com>
* builtins.c (expand_builtin_strlen): Force the source to
be a memory address.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.44
diff -c -2 -p -r1.44 builtins.c
*** builtins.c 2000/04/01 00:09:21 1.44
--- builtins.c 2000/04/04 16:35:03
*************** expand_builtin_strlen (exp, target, mode
*** 1389,1393 ****
/* Now that we are assured of success, expand the source. */
start_sequence ();
! pat = expand_expr (src, src_reg, ptr_mode, EXPAND_SUM);
if (pat != src_reg)
emit_move_insn (src_reg, pat);
--- 1389,1394 ----
/* Now that we are assured of success, expand the source. */
start_sequence ();
! pat = memory_address (BLKmode,
! expand_expr (src, src_reg, ptr_mode, EXPAND_SUM));
if (pat != src_reg)
emit_move_insn (src_reg, pat);
More information about the Gcc-patches
mailing list