Questionable code in fixup_reorder_chain

Jan Hubicka hubicka@ucw.cz
Fri Sep 23 12:15:00 GMT 2005


> Hi Jan,
> 
> I think fixup_reorder_chain contains questionable code to cope with a 
> pathological case:
> 
> 	      /* The degenerated case of conditional jump jumping to the next
> 		 instruction can happen on target having jumps with side
> 		 effects.
> 
> 		 Create temporarily the duplicated edge representing branch.
> 		 It will get unidentified by force_nonfallthru_and_redirect
> 		 that would otherwise get confused by fallthru edge not pointing
> 		 to the next basic block.  */
> 	      if (!e_taken)
> 		{
> 		  rtx note;
> 		  edge e_fake;
> 		  bool redirected;
> 
> 		  e_fake = unchecked_make_edge (bb, e_fall->dest, 0);
> 
> 		  redirected = redirect_jump (BB_END (bb),
> 					      block_label (bb), 0);
> 		  gcc_assert (redirected);
> 
> Note the call to redirect_jump that creates a loop.  It is responsible for the 
> ICE on the attached Ada testcase with the 3.4.5pre compiler at -O3 because the 
> edge and the jump disagree on the target.
Duh.  The code is ineed quite ugly side case.
> 
> The final patch: http://gcc.gnu.org/ml/gcc-cvs/2003-03/msg01294.html
> The original version: http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02097.html
> 
> Am I right in thinking that the call to redirect_jump must be removed?

I actually believe there was reason for creating the loop (ie
redirecting the edge to anything else than the fallthru egdge
destination) as otherwise we screwed up in
force_nonfallthru_and_redirect and this function (called via
force_nonfallthru) is supposed to redirect the jump back to proper
destination.  This is remarkably ugly hack :(

Would be possible to at leat see the RTL and precise ICE this code is
causing?

Honza



More information about the Gcc mailing list