]> 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)
committerThomas Schwinge <tschwinge@baylibre.com>
Tue, 25 Mar 2025 08:12:12 +0000 (09:12 +0100)
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.

(cherry picked from commit cb537f0d838bac376bfe5e6d765e19cd3af01031)

gcc/cp/ChangeLog.omp
gcc/cp/init.cc

index ed923563941f956af74f8f145679e8e6d12fd87b..e37a4344ca47b6db164ab8c23671911f82c05d59 100644 (file)
@@ -1,5 +1,10 @@
 2025-03-25  Thomas Schwinge  <tschwinge@baylibre.com>
 
+       Backported from trunk:
+       2025-03-21  Jason Merrill  <jason@redhat.com>
+
+       * init.cc (throw_bad_array_new_length): Returns void.
+
        Backported from trunk:
        2025-03-21  Thomas Schwinge  <tschwinge@baylibre.com>
 
index e622547a092fd07cb5e76d7defbfd3a398258456..12e7cecfc59ff8b1a4c978d9f9a95ec0cdc6920f 100644 (file)
@@ -2800,8 +2800,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)
@@ -2813,7 +2812,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);