diff options
author | Olivier Hainque <hainque@adacore.com> | 2007-06-12 13:32:27 +0000 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2007-06-12 13:32:27 +0000 |
commit | 0e1a6f292f824ee36e4c6e3047bb5d5f863b5184 (patch) | |
tree | 3259accf8e26823f3276d4d3a167b9abdebc6ce1 /gcc | |
parent | beff4180563acfb4c308a7c48b0ca6f5ff6a6782 (diff) | |
download | gcc-0e1a6f292f824ee36e4c6e3047bb5d5f863b5184.zip gcc-0e1a6f292f824ee36e4c6e3047bb5d5f863b5184.tar.gz gcc-0e1a6f292f824ee36e4c6e3047bb5d5f863b5184.tar.bz2 |
tree-nested.c (convert_local_reference): Handle VIEW_CONVERT_EXPR.
* tree-nested.c (convert_local_reference): Handle VIEW_CONVERT_EXPR.
Request walking the subtrees only, leaving the current is_lhs/val_only
untouched.
(convert_non_local_reference): Likewise.
testsuite/
* gnat.dg/lhs_view_convert.adb: New test.
From-SVN: r125646
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/lhs_view_convert.adb | 29 | ||||
-rw-r--r-- | gcc/tree-nested.c | 14 |
4 files changed, 54 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19115a8..7cb1cf2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-06-12 Olivier Hainque <hainque@adacore.com> + + * tree-nested.c (convert_local_reference): Handle VIEW_CONVERT_EXPR. + Request walking the subtrees only, leaving the current is_lhs/val_only + untouched. + (convert_non_local_reference): Likewise. + 2007-06-12 Nathan Sidwell <nathan@codesourcery.com> * config/m68k/m68k-devices.def (52221, 52223, 5253): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c297077..7aec663 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-06-12 Olivier Hainque <hainque@adacore.com> + + * gnat.dg/lhs_view_convert.adb: New test. + 2007-06-12 Richard Guenther <rguenther@suse.de> PR tree-optimization/15353 diff --git a/gcc/testsuite/gnat.dg/lhs_view_convert.adb b/gcc/testsuite/gnat.dg/lhs_view_convert.adb new file mode 100644 index 0000000..e7947f0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/lhs_view_convert.adb @@ -0,0 +1,29 @@ +-- { dg-do run } +-- { dg-options "-gnatp" } + +procedure Lhs_View_Convert is + + type Root is tagged record + RV : Natural; + end record; + + type Derived is new Root with null record; + + Root_Instance : Root := (RV => 1); + + Derived_Instance : Derived; + + procedure Process is + X : Natural := Derived_Instance.RV; + begin + null; + end; +begin + Derived_Instance.RV := 2; + + Root (Derived_Instance) := Root (Root_Instance); + + if Derived_Instance.RV /= Root_Instance.RV then + raise Program_Error; + end if; +end; diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index f26c9ba..dbb146d 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1035,6 +1035,13 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data) walk_tree (tp, convert_nonlocal_reference, wi, NULL); break; + case VIEW_CONVERT_EXPR: + /* Just request to look at the subtrees, leaving val_only and lhs + untouched. This might actually be for !val_only + lhs, in which + case we don't want to force a replacement by a temporary. */ + *walk_subtrees = 1; + break; + case OMP_PARALLEL: save_suppress = info->suppress_expansion; if (convert_nonlocal_omp_clauses (&OMP_PARALLEL_CLAUSES (t), wi)) @@ -1313,6 +1320,13 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data) wi->val_only = save_val_only; break; + case VIEW_CONVERT_EXPR: + /* Just request to look at the subtrees, leaving val_only and lhs + untouched. This might actually be for !val_only + lhs, in which + case we don't want to force a replacement by a temporary. */ + *walk_subtrees = 1; + break; + case OMP_PARALLEL: save_suppress = info->suppress_expansion; if (convert_local_omp_clauses (&OMP_PARALLEL_CLAUSES (t), wi)) |