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

Questionable code in fixup_reorder_chain


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.

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?

Thanks in advance.

-- 
Eric Botcazou
WITH Text_IO;

PROCEDURE p  IS

  TYPE  Real    IS DIGITS  12;
  TYPE  Double  IS DIGITS  13;

  PROCEDURE q (Option   : IN Character)  IS

    Z, Nn, Np,
    Npp, Nz, Ne, Nc     : Integer;
    File_name           : String (1..5);
    I, C                : Double;
    U_0                 : Text_IO.File_type;
  BEGIN

      FOR  Sp  IN  6..335  LOOP
      IF  (true)  THEN
        Nc := 0;
        FOR  N  IN  1..85 LOOP
          IF  (true)  THEN
            Text_IO.New_line;
            IF  (Z < 6)    THEN
              Nc := 1;
            ELSE
             Nc := 0;
            END IF;
            EXIT;
          END IF;
        END LOOP;
        BEGIN
          IF  (File_name(1) = ' ')  THEN
            File_name(1) := '0';
          END IF;
          Text_IO.New_line;

          IF  ((Option = '1')  OR  (Option = '2'))  THEN
            BEGIN
              Text_IO.Open (U_0, Text_IO.In_file, File_name & ".");
              Text_IO.Skip_line (U_0, 3);
              LOOP
                BEGIN
                  declare
                    X,y : integer ;
                  begin
                    if x = y then
                      Np  := 0;
                      Npp := 0;
                    end if;
                  end;
                  IF  (Nn /= 0)  THEN
                    IF  (Np /= 0)  THEN
                      Text_IO.New_line;
                    ELSE
                      Text_IO.New_line;
                    END IF;
                  ELSE
                    IF ((C - I) > 0.0)  THEN
                      NULL;
                    END IF;
                  END IF;
                END;
              END LOOP;
            END;
            Text_IO.New_Line;
          END IF;
        END;
      END IF;
      END LOOP;
  END;

begin
  null;
end;

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