aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-07-03 08:49:54 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-07-03 08:49:54 +0000
commit4a147e4e048576fd75cec40797cca5a972c91c48 (patch)
tree50dbff5174357134e5765f52d37d701d41e0be34 /gcc
parent28dd005525dc1a166827d6fe818e01bed7f42e1b (diff)
downloadgcc-4a147e4e048576fd75cec40797cca5a972c91c48.zip
gcc-4a147e4e048576fd75cec40797cca5a972c91c48.tar.gz
gcc-4a147e4e048576fd75cec40797cca5a972c91c48.tar.bz2
utils2.c (build_simple_component_ref): Do not look through an extension if the type contains a placeholder.
* gcc-interface/utils2.c (build_simple_component_ref): Do not look through an extension if the type contains a placeholder. From-SVN: r189202
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils2.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/discr37.adb12
-rw-r--r--gcc/testsuite/gnat.dg/discr37.ads22
5 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 0e0456c..f6eb89b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2012-07-03 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/utils2.c (build_simple_component_ref): Do not look
+ through an extension if the type contains a placeholder.
+
+2012-07-03 Eric Botcazou <ebotcazou@adacore.com>
+
* exp_disp.adb (Expand_Dispatching_Call): Propagate the convention on
the designated subprogram type and also set Is_Dispatch_Table_Entity.
(Expand_Interface_Thunk): Propagate the convention on the thunk.
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index c7dfe98..b72ebed 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1912,10 +1912,12 @@ build_simple_component_ref (tree record_variable, tree component,
break;
/* Next, see if we're looking for an inherited component in an extension.
- If so, look thru the extension directly. */
+ If so, look thru the extension directly, but not if the type contains
+ a placeholder, as it might be needed for a later substitution. */
if (!new_field
&& TREE_CODE (record_variable) == VIEW_CONVERT_EXPR
&& TYPE_ALIGN_OK (record_type)
+ && !type_contains_placeholder_p (record_type)
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (record_variable, 0)))
== RECORD_TYPE
&& TYPE_ALIGN_OK (TREE_TYPE (TREE_OPERAND (record_variable, 0))))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0dc8e25..539dfd3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr37.ad[sb]: New test.
+
2012-07-03 Oleg Endo <olegendo@gcc.gnu.org>
* g++.dg/other/packed1.C: Remove SH from xfail list.
diff --git a/gcc/testsuite/gnat.dg/discr37.adb b/gcc/testsuite/gnat.dg/discr37.adb
new file mode 100644
index 0000000..b0e750e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr37.adb
@@ -0,0 +1,12 @@
+-- { dg-do compile }
+
+package body Discr37 is
+
+ procedure Proc (A : access Child) is
+ B : Derived renames Derived (A.F(1).all);
+ C : Derived renames Derived (B.S(1).all);
+ begin
+ null;
+ end;
+
+end Discr37;
diff --git a/gcc/testsuite/gnat.dg/discr37.ads b/gcc/testsuite/gnat.dg/discr37.ads
new file mode 100644
index 0000000..7d91b2d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr37.ads
@@ -0,0 +1,22 @@
+package Discr37 is
+
+ subtype Index is Integer range 0 .. 100;
+
+ type Root;
+ type Frame_Ptr is access all Root'Class;
+
+ type Arr is array (Index range <>) of Frame_Ptr;
+
+ type Root (Level : Index) is tagged record
+ S : Arr (0 .. Level);
+ end record;
+
+ type Derived (Level : Index) is new Root (Level) with null record;
+
+ type Child is new Derived (0) with record
+ F : Arr (0 .. 100);
+ end record;
+
+ procedure Proc (A : access Child);
+
+end Discr37;