aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenth@gcc.gnu.org>2008-10-16 08:19:49 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-10-16 08:19:49 +0000
commitbd4a51ab34c0033d7359f3cb138d2efeb5efb5e9 (patch)
treee8d65b04c2d8f9c3a71d5eab0ef74c5a07810ace
parent5b429886c5e390a0d7ae27311f859d2ae1d4b2c1 (diff)
downloadgcc-bd4a51ab34c0033d7359f3cb138d2efeb5efb5e9.zip
gcc-bd4a51ab34c0033d7359f3cb138d2efeb5efb5e9.tar.gz
gcc-bd4a51ab34c0033d7359f3cb138d2efeb5efb5e9.tar.bz2
re PR middle-end/37418 (error: type mismatch in address expression, verify_gimple failed)
2008-10-16 Joseph Myers <joseph@codesourcery.com> Richard Guenther <rguenther@suse.de> PR middle-end/37418 * tree-ssa.c (useless_type_conversion_p_1): Do not treat volatile qualified functions or methods as relevant. * gcc.c-torture/compile/pr37418-1.c, gcc.c-torture/compile/pr37418-2.c, gcc.c-torture/compile/pr37418-3.c, gcc.c-torture/compile/pr37418-4.c: New tests. From-SVN: r141165
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37418-1.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37418-2.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37418-3.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37418-4.c6
-rw-r--r--gcc/tree-ssa.c11
7 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 057069d..733b18a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-16 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/37418
+ * tree-ssa.c (useless_type_conversion_p_1): Do not treat
+ volatile qualified functions or methods as relevant.
+
2008-10-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37525
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8cee6d0..dd4544b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-16 Joseph Myers <joseph@codesourcery.com>
+
+ PR middle-end/37418
+ * gcc.c-torture/compile/pr37418-1.c,
+ gcc.c-torture/compile/pr37418-2.c,
+ gcc.c-torture/compile/pr37418-3.c,
+ gcc.c-torture/compile/pr37418-4.c: New tests.
+
2008-10-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34670
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c
new file mode 100644
index 0000000..dbb1a65
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-1.c
@@ -0,0 +1,6 @@
+typedef void ft(int);
+void f(int args)__attribute__((noreturn));
+void f2(ft *p __attribute__((noreturn)))
+{
+ p = f;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c
new file mode 100644
index 0000000..dcc0039
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-2.c
@@ -0,0 +1,6 @@
+typedef void ft(int);
+volatile ft f;
+void f2(ft *p __attribute__((noreturn)))
+{
+ p = f;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c
new file mode 100644
index 0000000..5a2c2e8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-3.c
@@ -0,0 +1,6 @@
+typedef void ft(int);
+void f(int args)__attribute__((const));
+void f2(ft *p __attribute__((const)))
+{
+ p = f;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c
new file mode 100644
index 0000000..bc87278
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37418-4.c
@@ -0,0 +1,6 @@
+typedef void ft(int);
+const ft f;
+void f2(ft *p __attribute__((const)))
+{
+ p = f;
+}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index c53c528..8f238a3 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1125,9 +1125,14 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
{
/* Don't lose casts between pointers to volatile and non-volatile
qualified types. Doing so would result in changing the semantics
- of later accesses. */
- if ((TYPE_VOLATILE (TREE_TYPE (outer_type))
- != TYPE_VOLATILE (TREE_TYPE (inner_type)))
+ of later accesses. For function types the volatile qualifier
+ is used to indicate noreturn functions. */
+ if (TREE_CODE (TREE_TYPE (outer_type)) != FUNCTION_TYPE
+ && TREE_CODE (TREE_TYPE (outer_type)) != METHOD_TYPE
+ && TREE_CODE (TREE_TYPE (inner_type)) != FUNCTION_TYPE
+ && TREE_CODE (TREE_TYPE (inner_type)) != METHOD_TYPE
+ && (TYPE_VOLATILE (TREE_TYPE (outer_type))
+ != TYPE_VOLATILE (TREE_TYPE (inner_type)))
&& TYPE_VOLATILE (TREE_TYPE (outer_type)))
return false;