This is the mail archive of the gcc-bugs@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]

[Bug middle-end/49721] convert_memory_address_addr_space may generate invalid new insns


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

--- Comment #15 from Uros Bizjak <ubizjak at gmail dot com> 2011-08-02 20:22:27 UTC ---
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #10)
> > > Here is the problem:
> > 
> > No, in your case new insn is rejected (twice):
> > 
> > Trying 434 -> 435:
> > Failed to match this instruction:
> > (parallel [
> >         (set (reg/f:SI 364)
> >             (if_then_else:SI (eq:SI (reg:SI 442)
> >                     (const_int 0 [0]))
> >                 (const:SI (plus:SI (symbol_ref:SI ("iplane.1553") [flags 0x2] 
> > <var_decl 0x7f9a07ef33c0 iplane>)
> >                         (const_int -4 [0xfffffffffffffffc])))
> >                 (const:SI (plus:SI (symbol_ref:SI ("iplane.1553") [flags 0x2] 
> > <var_decl 0x7f9a07ef33c0 iplane>)
> >                         (const_int 4 [0x4])))))
> >         (clobber (reg:CC 17 flags))
> >     ])
> > Failed to match this instruction:
> > (set (reg/f:SI 364)
> >     (if_then_else:SI (eq:SI (reg:SI 442)
> >             (const_int 0 [0]))
> >         (const:SI (plus:SI (symbol_ref:SI ("iplane.1553") [flags 0x2] 
> > <var_decl 0x7f9a07ef33c0 iplane>)
> >                 (const_int -4 [0xfffffffffffffffc])))
> >         (const:SI (plus:SI (symbol_ref:SI ("iplane.1553") [flags 0x2] 
> > <var_decl 0x7f9a07ef33c0 iplane>)
> >                 (const_int 4 [0x4])))))
> 
> When new insns (even if they are rejected) are generated, max_uid_known
> is increased, which breaks combine due to the fixed arrays allocated
> at the beginning of the combine pass:
> 
>  /* Allocate array for insn info.  */
>   max_uid_known = get_max_uid ();
>   uid_log_links = XCNEWVEC (struct insn_link *, max_uid_known + 1); 
>   uid_insn_cost = XCNEWVEC (int, max_uid_known + 1); 
>   gcc_obstack_init (&insn_link_obstack);

Yeah, following ""patch"" works:

Index: combine.c
===================================================================
--- combine.c    (revision 177171)
+++ combine.c    (working copy)
@@ -1102,8 +1102,8 @@ combine_instructions (rtx f, unsigned in

   /* Allocate array for insn info.  */
   max_uid_known = get_max_uid ();
-  uid_log_links = XCNEWVEC (struct insn_link *, max_uid_known + 1);
-  uid_insn_cost = XCNEWVEC (int, max_uid_known + 1);
+  uid_log_links = XCNEWVEC (struct insn_link *, max_uid_known + 100);
+  uid_insn_cost = XCNEWVEC (int, max_uid_known + 100);
   gcc_obstack_init (&insn_link_obstack);

   nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0);

It produces something that looks like correct assembly...

Paolo?


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