aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-11-09 20:31:45 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-11-09 20:31:45 +0100
commit9b999dc5ea45237cc7accead90a33e9c4a6893f5 (patch)
treed0452c9d439eb92c86bdb032f5caa94bb5be505c /gcc
parent0104d6c71a694c717617dfc4c847641825ca094c (diff)
downloadgcc-9b999dc5ea45237cc7accead90a33e9c4a6893f5.zip
gcc-9b999dc5ea45237cc7accead90a33e9c4a6893f5.tar.gz
gcc-9b999dc5ea45237cc7accead90a33e9c4a6893f5.tar.bz2
re PR target/43808 (-fipa-reference -fschedule-insns -fstrict-aliasing causes two gfortran check failures)
PR target/43808 * cfgexpand.c (partition_stack_vars): Call update_alias_info_with_stack_vars unconditionally. (update_alias_info_with_stack_vars): Allow unused unreferenced vars when not optimizing. * gfortran.dg/pr43808.f90: New test. From-SVN: r166509
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cfgexpand.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr43808.f9018
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dbf4ef6..d8b2550 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/43808
+ * cfgexpand.c (partition_stack_vars): Call
+ update_alias_info_with_stack_vars unconditionally.
+ (update_alias_info_with_stack_vars): Allow unused
+ unreferenced vars when not optimizing.
+
2010-11-09 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/46036
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c44649e..784639d 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -516,9 +516,11 @@ update_alias_info_with_stack_vars (void)
unsigned int uid = DECL_PT_UID (decl);
/* We should never end up partitioning SSA names (though they
may end up on the stack). Neither should we allocate stack
- space to something that is unused and thus unreferenced. */
+ space to something that is unused and thus unreferenced, except
+ for -O0 where we are preserving even unreferenced variables. */
gcc_assert (DECL_P (decl)
- && referenced_var_lookup (DECL_UID (decl)));
+ && (!optimize
+ || referenced_var_lookup (DECL_UID (decl))));
bitmap_set_bit (part, uid);
*((bitmap *) pointer_map_insert (decls_to_partitions,
(void *)(size_t) uid)) = part;
@@ -684,8 +686,7 @@ partition_stack_vars (void)
}
}
- if (optimize)
- update_alias_info_with_stack_vars ();
+ update_alias_info_with_stack_vars ();
}
/* A debugging aid for expand_used_vars. Dump the generated partitions. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5517521f..3e451d0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/43808
+ * gfortran.dg/pr43808.f90: New test.
+
2010-11-09 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/46036
diff --git a/gcc/testsuite/gfortran.dg/pr43808.f90 b/gcc/testsuite/gfortran.dg/pr43808.f90
new file mode 100644
index 0000000..97de628
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr43808.f90
@@ -0,0 +1,18 @@
+! PR target/43808
+! { dg-do run }
+! { dg-options "-O0 -fipa-reference -fschedule-insns -fstrict-aliasing" }
+
+ type :: a
+ integer, allocatable :: i(:)
+ end type a
+ type :: b
+ type (a), allocatable :: j(:)
+ end type b
+ type(a) :: x(2)
+ type(b) :: y(2)
+ x(1) = a((/1,2,3,4/))
+ x(2) = a((/1,2,3,4/)+10)
+ y(1) = b((/x(1),x(2)/))
+ y(2) = b((/x(1),x(2)/))
+ if (y(1)%j(1)%i(1) .ne. 1) call abort
+end