From c9d19f43d70873e74aa3b03270d6b5c06256b68a Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sat, 8 May 2010 12:06:57 +0000 Subject: * gimple.c (gimple_types_compatible_p) : Treat bounds of domain types as equal if they are both PLACEHOLDER_EXPRs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159185 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/gimple.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gnat.dg/lto6.adb | 11 +++++++++++ gcc/testsuite/gnat.dg/lto6_pkg.ads | 8 ++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/lto6.adb create mode 100644 gcc/testsuite/gnat.dg/lto6_pkg.ads diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b3097a65887..735c120b2e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-05-08 Eric Botcazou + + * gimple.c (gimple_types_compatible_p) : Treat bounds of + domain types as equal if they are both PLACEHOLDER_EXPRs. + 2010-05-08 Richard Guenther * lto-wrapper.c (run_gcc): Remove linker output from diff --git a/gcc/gimple.c b/gcc/gimple.c index 6d439c553a2..d9a613ad189 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -3305,9 +3305,15 @@ gimple_types_compatible_p (tree t1, tree t2) /* The minimum/maximum values have to be the same. */ if ((min1 == min2 - || (min1 && min2 && operand_equal_p (min1, min2, 0))) + || (min1 && min2 + && ((TREE_CODE (min1) == PLACEHOLDER_EXPR + && TREE_CODE (min2) == PLACEHOLDER_EXPR) + || operand_equal_p (min1, min2, 0)))) && (max1 == max2 - || (max1 && max2 && operand_equal_p (max1, max2, 0)))) + || (max1 && max2 + && ((TREE_CODE (max1) == PLACEHOLDER_EXPR + && TREE_CODE (max2) == PLACEHOLDER_EXPR) + || operand_equal_p (max1, max2, 0))))) goto same_types; else goto different_types; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85dd6b9d856..b0d26f113db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-05-08 Eric Botcazou + + * gnat.dg/lto6.adb: New test. + * gnat.dg/lto6_pkg.ads: New helper. + 2010-05-08 Eric Botcazou * gnat.dg/lto5.adb: New test. diff --git a/gcc/testsuite/gnat.dg/lto6.adb b/gcc/testsuite/gnat.dg/lto6.adb new file mode 100644 index 00000000000..f3d4841d7aa --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto6.adb @@ -0,0 +1,11 @@ +-- { dg-do run } +-- { dg-options "-gnat05 -O2 -flto" } + +with Lto6_Pkg; use Lto6_Pkg; + +procedure Lto6 is + type Enum is (A, B, C, D); + Table : array (B .. C, 1 .. 1) of F_String := (others => (others => Null_String)); +begin + Table := (others => (others => Null_String)); +end; diff --git a/gcc/testsuite/gnat.dg/lto6_pkg.ads b/gcc/testsuite/gnat.dg/lto6_pkg.ads new file mode 100644 index 00000000000..81b7ddc5a87 --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto6_pkg.ads @@ -0,0 +1,8 @@ +with Ada.Finalization; use Ada.Finalization; + +package Lto6_Pkg is + type F_String is new Controlled with record + Data : access String; + end record; + Null_String : constant F_String := (Controlled with Data => null); +end Lto6_Pkg; -- cgit v1.2.1