re PR tree-optimization/53336 (invalid types in nop conversion)
authorPaolo Bonzini <bonzini@gnu.org>
Tue, 22 May 2012 08:31:52 +0000 (08:31 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Tue, 22 May 2012 08:31:52 +0000 (08:31 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr53336.C [new file with mode: 0644]
gcc/tree-cfg.c

index 6c87e74e097f5ebbf841df3b7f138dd7f4bfec38..7d63d054a8a8b3e914031e9cac0b8a326df2959c 100644 (file)
@@ -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.
index 5aa76109b6b2eeda53a47d19eaf209ba8b585457..661da35a139f48e890efac7dfcb927758f20b100 100644 (file)
@@ -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 (file)
index 0000000..ab12194
--- /dev/null
@@ -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;
+}
+
index f8e1fb5d3253293a6e1ba2f1995cca2a392a8139..423db1db4530d3b836d993cd1dd0a0dd6f2c10e7 100644 (file)
@@ -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