This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] flow.c: Fix execute/20020227-1.c.


Hi,

Attached is a patch to fix execute/20020227-1.c on H8.  

Consider a minimized version of execute/20020227-1.c:

typedef __complex__ float cf;

struct x {
  cf f;
} __attribute__ ((__packed__));

void
f2 (struct x *y)
{
  if (y->f != 1)
    abort ();
}

Without the patch, the above code causes the following ICE:

20020227-1.c: In function `f2':
20020227-1.c:12: error: unrecognizable insn:
(insn 81 73 82 0 (nil) (set (reg:SF 19)
        (const_double:SF 0 [0x0] 0.0 [0x0.0p+0])) -1 (nil)
    (nil))
20020227-1.c:12: internal compiler error: in extract_insn, at recog.c:2188

This is because initialize_uninitialized_subregs() in flow.c emits a
hard-coded move, assuming that (const_double:SF 0) fits in the
immediate field of a move instruction.

The patch fixes this by using emit_move_insn.

Tested on h8300 port.  OK to apply?

Kazu Hirata

2003-06-03  Kazu Hirata  <kazu@cs.umass.edu>

	* flow.c (initialize_uninitialized_subregs): Use
	emit_move_insn instead of emitting a hardcoded move.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.550
diff -u -r1.550 flow.c
--- flow.c	3 May 2003 14:25:21 -0000	1.550
+++ flow.c	3 Jun 2003 17:34:58 -0000
@@ -1484,8 +1484,11 @@
 	      for_each_rtx (&i, find_regno_partial, &param);
 	      if (param.retval != NULL_RTX)
 		{
-		  insn = gen_move_insn (param.retval,
-				        CONST0_RTX (GET_MODE (param.retval)));
+		  start_sequence ();
+		  emit_move_insn (param.retval,
+				  CONST0_RTX (GET_MODE (param.retval)));
+		  insn = get_insns ();
+		  end_sequence ();
 		  insert_insn_on_edge (insn, e);
 		  did_something = 1;
 		}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]