summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-19 21:22:04 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-19 21:22:04 +0000
commitcbcfd5e3d8d2b8c6ca1c8a67d9554c188ebf9ce1 (patch)
tree38cb017fd903c3620a5e88ecf3ae36249695c729 /gcc
parentbe42dbcec6416d879a72b52e261451a67630c139 (diff)
downloadgcc-cbcfd5e3d8d2b8c6ca1c8a67d9554c188ebf9ce1.tar.gz
* gimple-fold.c (canonicalize_constructor_val): Strip only useless type
conversions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-fold.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gnat.dg/aggr20.adb10
-rw-r--r--gcc/testsuite/gnat.dg/aggr20.ads24
-rw-r--r--gcc/testsuite/gnat.dg/aggr20_pkg.ads9
6 files changed, 54 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a14b3d91fd5..1a3d4017f51 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple-fold.c (canonicalize_constructor_val): Strip only useless type
+ conversions.
+
2012-07-19 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/53942
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index b97719a4c1c..ccdeb34677f 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -139,7 +139,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
tree
canonicalize_constructor_val (tree cval, tree from_decl)
{
- STRIP_NOPS (cval);
+ STRIP_USELESS_TYPE_CONVERSION (cval);
if (TREE_CODE (cval) == POINTER_PLUS_EXPR
&& TREE_CODE (TREE_OPERAND (cval, 1)) == INTEGER_CST)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 79bdd959132..740d26bdf35 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2012-07-19 Eric Botcazou <ebotcazou@adacore.com>
+ * gnat.dg/aggr20.ad[sb]: New test.
+ * gnat.dg/aggr20_pkg.ads: New helper.
+
+2012-07-19 Eric Botcazou <ebotcazou@adacore.com>
+
* gnat.dg/derived_type3.adb: New test.
* gnat.dg/derived_type3_pkg.ad[sb]: New helper.
diff --git a/gcc/testsuite/gnat.dg/aggr20.adb b/gcc/testsuite/gnat.dg/aggr20.adb
new file mode 100644
index 00000000000..85111e25b4e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr20.adb
@@ -0,0 +1,10 @@
+-- { dg-do compile }
+
+package body Aggr20 is
+
+ procedure Proc (R : out Rec3) is
+ begin
+ R := (Callback => Nil_Rec2);
+ end;
+
+end Aggr20;
diff --git a/gcc/testsuite/gnat.dg/aggr20.ads b/gcc/testsuite/gnat.dg/aggr20.ads
new file mode 100644
index 00000000000..6405cae9dfb
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr20.ads
@@ -0,0 +1,24 @@
+with Aggr20_Pkg; use Aggr20_Pkg;
+with System;
+
+package Aggr20 is
+
+ type Rec1 is record
+ Address : System.Address;
+ end record;
+
+ Nil_Rec1 : constant Rec1 := (Address => Default_Nil_Address);
+
+ type Rec2 is record
+ Callback : Rec1;
+ end record;
+
+ Nil_Rec2 : constant Rec2 := (Callback => Nil_Rec1);
+
+ type Rec3 is record
+ Callback : Rec2;
+ end record;
+
+ procedure Proc (R : out Rec3);
+
+end Aggr20;
diff --git a/gcc/testsuite/gnat.dg/aggr20_pkg.ads b/gcc/testsuite/gnat.dg/aggr20_pkg.ads
new file mode 100644
index 00000000000..66f5bd58045
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr20_pkg.ads
@@ -0,0 +1,9 @@
+with System;
+
+package Aggr20_Pkg is
+
+ procedure Proc;
+
+ Default_Nil_Address : constant System.Address := Proc'Address;
+
+end Aggr20_Pkg;