]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/8674 (ICE in cp_expr_size, at cp/cp-lang.c:307)
authorJason Merrill <jason@redhat.com>
Mon, 10 Feb 2003 16:18:34 +0000 (11:18 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 10 Feb 2003 16:18:34 +0000 (11:18 -0500)
        * call.c (call_builtin_trap): New fn.
        (convert_arg_to_ellipsis): Use it.  Downgrade error to warning.
        (build_call): Don't set current_function_returns_abnormally outside
        a function.

        PR c++/8674
        * call.c (build_over_call): Check specifically for TARGET_EXPR
        when eliding.

From-SVN: r62639

gcc/cp/ChangeLog
gcc/cp/call.c

index 2fd119a899d5426c43ba90220994b59500c1536e..43053d5043e899a6f27e99ea1be0196f7006a3c0 100644 (file)
@@ -1,3 +1,14 @@
+2003-02-10  Jason Merrill  <jason@redhat.com>
+
+       * call.c (call_builtin_trap): New fn.
+       (convert_arg_to_ellipsis): Use it.  Downgrade error to warning.
+       (build_call): Don't set current_function_returns_abnormally outside
+       a function.
+
+       PR c++/8674
+       * call.c (build_over_call): Check specifically for TARGET_EXPR
+       when eliding.
+
 2003-02-05  Release Manager
 
        * GCC 3.2.2 Released.
 
        * GCC 3.2.1 Released.
 
-2002-11-19  Release Manager
-
-       * GCC 3.2.1 Released.
-
-2002-11-18  Release Manager
-
-       * GCC 3.2.1 Released.
-
 2002-11-11  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/7788
index c8dcaf021189a97ea0842b315df7a86f982ed7ae..d0096de36806115217ebc381b54fa4bcff592cc1 100644 (file)
@@ -102,6 +102,7 @@ static tree convert_class_to_reference PARAMS ((tree, tree, tree));
 static tree direct_reference_binding PARAMS ((tree, tree));
 static int promoted_arithmetic_type_p PARAMS ((tree));
 static tree conditional_conversion PARAMS ((tree, tree));
+static tree call_builtin_trap PARAMS ((void));
 
 tree
 build_vfield_ref (datum, type)
@@ -408,7 +409,7 @@ build_call (function, parms)
   nothrow = ((decl && TREE_NOTHROW (decl))
             || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
 
-  if (decl && TREE_THIS_VOLATILE (decl))
+  if (decl && TREE_THIS_VOLATILE (decl) && cfun)
     current_function_returns_abnormally = 1;
 
   if (decl && TREE_DEPRECATED (decl))
@@ -4001,6 +4002,22 @@ convert_like_real (convs, expr, fn, argnum, inner)
                      LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
 }
 
+/* Build a call to __builtin_trap which can be used in an expression.  */
+
+static tree
+call_builtin_trap ()
+{
+  tree fn = get_identifier ("__builtin_trap");
+  if (IDENTIFIER_GLOBAL_VALUE (fn))
+    fn = IDENTIFIER_GLOBAL_VALUE (fn);
+  else
+    abort ();
+
+  fn = build_call (fn, NULL_TREE);
+  fn = build (COMPOUND_EXPR, integer_type_node, fn, integer_zero_node);
+  return fn;
+}
+
 /* ARG is being passed to a varargs function.  Perform any conversions
    required.  Array/function to pointer decay must have already happened.
    Return the converted value.  */
@@ -4025,9 +4042,10 @@ convert_arg_to_ellipsis (arg)
       /* Undefined behaviour [expr.call] 5.2.2/7.  We used to just warn
         here and do a bitwise copy, but now cp_expr_size will abort if we
         try to do that.  */
-      error ("cannot pass objects of non-POD type `%#T' through `...'",
-            TREE_TYPE (arg));
-      arg = error_mark_node;
+      warning ("cannot pass objects of non-POD type `%#T' through `...'; \
+call will abort at runtime",
+              TREE_TYPE (arg));
+      arg = call_builtin_trap ();
     }
 
   return arg;
@@ -4296,12 +4314,12 @@ build_over_call (cand, args, flags)
          temp or an INIT_EXPR otherwise.  */
       if (integer_zerop (TREE_VALUE (args)))
        {
-         if (! real_lvalue_p (arg))
+         if (TREE_CODE (arg) == TARGET_EXPR)
            return arg;
          else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
            return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
        }
-      else if ((!real_lvalue_p (arg)
+      else if ((TREE_CODE (arg) == TARGET_EXPR
                || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
               /* Empty classes have padding which can be hidden
                  inside an (empty) base of the class. This must not