]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: fix return type of __cxa_bad_array_new_length
authorJason Merrill <jason@redhat.com>
Thu, 20 Mar 2025 13:55:40 +0000 (09:55 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 21 Mar 2025 15:04:56 +0000 (11:04 -0400)
We were lying about the return type, but that's not necessary; we already
need to handle a COND_EXPR where one side is void for THROW_EXPR.

This fixes an execution failure on nvptx:
error: Prototype doesn't match for '__cxa_throw_bad_array_new_length'

gcc/cp/ChangeLog:

* init.cc (throw_bad_array_new_length): Returns void.

gcc/cp/init.cc

index ce6e58e05f2f43277787f197d3d5a728d7672c99..e589e45e8916abed596b42282a0326e3b3c3a804 100644 (file)
@@ -2810,8 +2810,7 @@ diagnose_uninitialized_cst_or_ref_member (tree type, bool using_new, bool compla
 }
 
 /* Call __cxa_bad_array_new_length to indicate that the size calculation
-   overflowed.  Pretend it returns sizetype so that it plays nicely in the
-   COND_EXPR.  */
+   overflowed.  */
 
 tree
 throw_bad_array_new_length (void)
@@ -2823,7 +2822,7 @@ throw_bad_array_new_length (void)
       fn = get_global_binding (name);
       if (!fn)
        fn = push_throw_library_fn
-         (name, build_function_type_list (sizetype, NULL_TREE));
+         (name, build_function_type_list (void_type_node, NULL_TREE));
     }
 
   return build_cxx_call (fn, 0, NULL, tf_warning_or_error);