re PR c++/18968 (ICE: tree check: expected ssa_name, have addr_expr in vrp_hash)
authorAndrew Pinski <pinskia@physics.uc.edu>
Tue, 14 Dec 2004 02:21:56 +0000 (02:21 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Tue, 14 Dec 2004 02:21:56 +0000 (18:21 -0800)
2004-12-13  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/18968
        * g++.dg/opt/pr18968.C: New test.

2004-12-13  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/18968
        * class.c (build_base_path): Convert the zero constant to the correct
        type when comparing.

From-SVN: r92121

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr18968.C [new file with mode: 0644]

index 71cce5f64117b284dd5c94a06ae5604541d3aae9..a90ffecede83d6bb6f1c022763acebdf0023f2ba 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-13  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c++/18968
+       * class.c (build_base_path): Convert the zero constant to the correct
+       type when comparing.
+
 2004-12-13  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/18925
index f7e5c7b9083a5a1ad3dd98d2728dc4e05e3cf485..9625acca7cea15077bbae4034b8118826c61e6ab 100644 (file)
@@ -295,8 +295,11 @@ build_base_path (enum tree_code code,
 
   /* Now that we've saved expr, build the real null test.  */
   if (null_test)
-    null_test = fold (build2 (NE_EXPR, boolean_type_node,
-                             expr, integer_zero_node));
+    {
+      tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
+      null_test = fold (build2 (NE_EXPR, boolean_type_node,
+                               expr, zero));
+    }
 
   /* If this is a simple base reference, express it as a COMPONENT_REF.  */
   if (code == PLUS_EXPR && !virtual_access
index 957c5eb4cee7ae5720a790d0b312563e0528672f..6b23ef11a183c12289d1edf42df060a6539e8c25 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-13  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c++/18968
+       * g++.dg/opt/pr18968.C: New test.
+
 2004-12-13  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/18925
diff --git a/gcc/testsuite/g++.dg/opt/pr18968.C b/gcc/testsuite/g++.dg/opt/pr18968.C
new file mode 100644 (file)
index 0000000..cce73b5
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O1" }
+struct X
+{
+  int i;
+};
+struct Y : virtual X {};
+struct Z : Y {};
+struct A
+{
+  Z* p;
+  A();
+};
+A::A() : p(0)
+{
+  ((X*)(Y*)p)->i++;
+}
+