OSDN Git Service

PR c++/45635
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Sep 2010 15:39:57 +0000 (15:39 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Sep 2010 15:39:57 +0000 (15:39 +0000)
* class.c (build_vtbl_initializer): Use fn instead of init's operand
as first argument to FDESC_EXPR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164311 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c

index 20887a0..efa238a 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/45635
+       * class.c (build_vtbl_initializer): Use fn instead of init's operand
+       as first argument to FDESC_EXPR.
+
 2010-09-15  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/45665
index 4823fa2..c594d6a 100644 (file)
@@ -7796,9 +7796,14 @@ build_vtbl_initializer (tree binfo,
          if (DECL_PURE_VIRTUAL_P (fn_original))
            {
              fn = abort_fndecl;
-             if (abort_fndecl_addr == NULL)
-               abort_fndecl_addr = fold_convert (vfunc_ptr_type_node, build_fold_addr_expr (fn));
-             init = abort_fndecl_addr;
+             if (!TARGET_VTABLE_USES_DESCRIPTORS)
+               {
+                 if (abort_fndecl_addr == NULL)
+                   abort_fndecl_addr
+                     = fold_convert (vfunc_ptr_type_node,
+                                     build_fold_addr_expr (fn));
+                 init = abort_fndecl_addr;
+               }
            }
          else
            {
@@ -7810,7 +7815,9 @@ build_vtbl_initializer (tree binfo,
                }
              /* Take the address of the function, considering it to be of an
                 appropriate generic type.  */
-             init = fold_convert (vfunc_ptr_type_node, build_fold_addr_expr (fn));
+             if (!TARGET_VTABLE_USES_DESCRIPTORS)
+               init = fold_convert (vfunc_ptr_type_node,
+                                    build_fold_addr_expr (fn));
            }
        }
 
@@ -7825,8 +7832,7 @@ build_vtbl_initializer (tree binfo,
            for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
              {
                tree fdesc = build2 (FDESC_EXPR, vfunc_ptr_type_node,
-                                    TREE_OPERAND (init, 0),
-                                    build_int_cst (NULL_TREE, i));
+                                    fn, build_int_cst (NULL_TREE, i));
                TREE_CONSTANT (fdesc) = 1;
 
                CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, fdesc);