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

Possible bug in gimplify.c:mostly_copy_tree_r with SAVE_EXPR

Although it's correct that a SAVE_EXPR can be shared, I don't believe its
contents can.  If we have an expression both in the SAVE_EXPR and someplace
else, they must be unique copies.  I'm running into a SIGSEGV on a small Ada
test case where a COND_EXPR is set to VOID_TYPE but then when it sees it
inside a non-VOID SAVE_EXPR, it gets confused.

So I think it shouldn't copy a SAVE_EXPR, but should not clear *walk_subtree.

Unfortunately, just doing that doesn't fix the problem, so I'm a little
confused.  The test case is two tiny Ada files: is:

package Identifiers is
  type ID_Type (<>) is private;
  function Create (S : String) return ID_Type;
  function Create (I : Integer) return ID_Type;

  type Disc is ( Str, Int );
  type ID_Type (D : Disc) is
      case D is
        when Str => S : String (1..80);
        when Int => I : Integer;
      end case;
    end record;
end Identifiers;

and test_ids.adb is

with Identifiers; use Identifiers;
procedure Test_IDs is
  X : ID_Type := Create ("Francisco");
  Y : ID_Type := Create (12);
  Z : ID_Type := X;
end Test_IDs;

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