diff mbox

patch to fix PR58712

Message ID 52829F45.1070106@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Nov. 12, 2013, 9:36 p.m. UTC
The following patch fixes usage of an uninitialized value in
record_operand_costs:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58712

The single set insn might have less 2 operands, e.g. x86_fnstcw_1.

Committed as rev. 204720.

2013-11-12  Vladimir Makarov  <vmakarov@redhat.com>

        PR other/58712
        * ira-costs.c (record_operand_costs): Check operands number for
        the single set.
diff mbox

Patch

Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 204594)
+++ ira-costs.c	(working copy)
@@ -1224,6 +1224,9 @@  record_operand_costs (rtx insn, enum reg
      preferred class is very expensive as the source of a copy
      instruction.  */
   if ((set = single_set (insn)) != NULL_RTX
+      /* In rare cases the single set insn might have less 2 operands
+	 as the source can be a fixed special reg.  */
+      && recog_data.n_operands > 1
       && ops[0] == SET_DEST (set) && ops[1] == SET_SRC (set))
     {
       int regno, other_regno;