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]

Re: tree-ssa branch broken


On Tue, 2 Jul 2002, Daniel Berlin wrote:

> On Tue, 2 Jul 2002, Graham Stott wrote:
> 
> > Diego Novillo wrote:
> > > On Sat, 29 Jun 2002, Graham Stott wrote:
> > > 
> > > 
> > >>I get the same segv compiling crtstuff.c with the stage2 compiler just
> > >>built by stage1 and that is with and without rtl checking enabled.
> > >>
> > > 
> > > It's possible that I'm not getting a segv because of the older
> > > binutils I'm running.  I still have not had time to look into it
> > > any more than this.
> > Interestingly I can get both the segv and rtl checking failure :-)
> > 
> > It depends very much on your stack layout which part of the stack
> > gets trampled. The segv occurs when the recog () return address gets
> > trampled and the rtl checking failure occurs when the INSN parameter
> > to recog_memozied_1 () gets trampled.
> > 
> > I found this out when adding some debuging code to recog_memozied_1 ()
> > resulted in the rtl checking failure rather than segv.
> > 
> > In both cases the trample occurs during the same call to recog () from
> > recog_memoized_1 ().
> > 
> > I think it's a problem with SIMPLE but I'm having difficulty pinpointing
> > exactly what although I do suspect SIMPLE is doing something wrong when
> > processing the "operands[N] = x" assigments where operands is declared as
> > 
> > 		rtx * const operands = &recog_data.operand[0];
> 
> Ah, here's the bug.
> 
> Check this out:
> 
> We move the initializer to before the initialization of it's rhs.
> 
> Like so:
> 
> recog_2 (simplified):
> 
>   struct rtx_def * * const operands;
> ...
>   struct recog_data * recog_data.4070;
>  ...
>   operands = (struct rtx_def * *)recog_data.4070;
> ....
>     recog_data.4070 = &recog_data;
>         recog_data.4071 = (struct rtx_def * *)recog_data.4070;
> 
> 
> Wheee.
> Evil.
> 
> It looks like we end up putting something in the wrong level, because it's 
> really:
>   int _code.2667;
>   unsigned char T.2666;
>   int _code.2665;
>   union rtunion * retval.2664;
>   operands = (struct rtx_def * *)recog_data.4070;
>   struct rtx_def * x1;
>   struct rtx_def * x2;
>   struct rtx_def * x3;
>   struct rtx_def * x4;
>   struct rtx_def * x5;
>   
> (IE the initialization is in the middle of a bunch of variable 
> declarations at the top)

Actually, this is really symptomatic of an ordering problem, not a level 
problem.

We must be doing

add_tree (initializer, post_p)
simplify_stmt (body_containing_rhs_of_initializer)

rather than
simplify_stmt (body_containing_rhs_of_initializer)
add_tree (initializer, post_p)

or something, so that we end up with the initialization before the actual 
simplified body that sets it.

> 
> 
> --Dan
> 
> 


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