aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2012-05-22 08:31:52 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2012-05-22 08:31:52 +0000
commit819f3b2cfa364ed63cb9200459ca6574aaa123da (patch)
tree3c8790916f85a32265d55ae917edeb9ac9c927b2 /gcc
parent7caf4b0caa0c8f0283d12632a7aa33276614e079 (diff)
downloadgcc-819f3b2cfa364ed63cb9200459ca6574aaa123da.zip
gcc-819f3b2cfa364ed63cb9200459ca6574aaa123da.tar.gz
gcc-819f3b2cfa364ed63cb9200459ca6574aaa123da.tar.bz2
re PR tree-optimization/53336 (invalid types in nop conversion)
gcc: 2012-05-16 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/53336 * tree-cfg.c (verify_gimple_assign_unary): Allow conversion from non-integer integral types to offset type and vice versa. gcc/testsuite: 2012-05-16 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/53336 * g++.dg/torture/pr53336.C: New testcase. From-SVN: r187759
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr53336.C45
-rw-r--r--gcc/tree-cfg.c6
4 files changed, 59 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6c87e74..7d63d05 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-22 Paolo Bonzini <bonzini@gnu.org>
+
+ PR tree-optimization/53336
+ * tree-cfg.c (verify_gimple_assign_unary): Allow conversion from
+ non-integer integral types to offset type and vice versa.
+
2012-05-22 Alan Modra <amodra@gmail.com>
* config/rs6000/aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5aa7610..661da35 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-22 Paolo Bonzini <bonzini@gnu.org>
+
+ PR tree-optimization/53336
+ * g++.dg/torture/pr53336.C: New testcase.
+
2012-05-22 Dodji Seketeli <dodji@redhat.com>
PR c++/53322
diff --git a/gcc/testsuite/g++.dg/torture/pr53336.C b/gcc/testsuite/g++.dg/torture/pr53336.C
new file mode 100644
index 0000000..ab12194
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr53336.C
@@ -0,0 +1,45 @@
+// { dg-do compile }
+
+bool foo();
+
+struct C
+{
+ C()
+ {
+ if (foo())
+ foo();
+ }
+};
+
+struct S
+{
+ struct dummy
+ {
+ int i_;
+ };
+ typedef int dummy::*bool_type;
+
+ operator bool_type() const
+ {
+ return foo() ? &dummy::i_ : 0;
+ }
+};
+
+int x;
+
+struct adaptor
+{
+ C c;
+
+ virtual void bar()
+ {
+ if (S())
+ x = 0;
+ }
+};
+
+int main()
+{
+ adaptor a;
+}
+
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f8e1fb5..423db1d 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3373,11 +3373,11 @@ verify_gimple_assign_unary (gimple stmt)
|| ptrofftype_p (sizetype))))
return false;
- /* Allow conversion from integer to offset type and vice versa. */
+ /* Allow conversion from integral to offset type and vice versa. */
if ((TREE_CODE (lhs_type) == OFFSET_TYPE
- && TREE_CODE (rhs1_type) == INTEGER_TYPE)
+ && INTEGRAL_TYPE_P (rhs1_type))
|| (TREE_CODE (lhs_type) == INTEGER_TYPE
- && TREE_CODE (rhs1_type) == OFFSET_TYPE))
+ && INTEGRAL_TYPE_P (rhs1_type)))
return false;
/* Otherwise assert we are converting between types of the