diff mbox series

[pushed] Objective-C, Darwin: Fix a regression in handling bad receivers.

Message ID 20240112141230.62685-1-iain@sandoe.co.uk
State New
Headers show
Series [pushed] Objective-C, Darwin: Fix a regression in handling bad receivers. | expand

Commit Message

Iain Sandoe Jan. 12, 2024, 2:12 p.m. UTC
Tested on i686 and powerpc darwin, and a cross from x86-64 darwin to
powerpc, pushed to trunk, thanks,
Iain

--- 8< ---

This is seen on 32b targets with a 64b multilib, and is an ICE when
the build has checking enabled.  The fix is to exit the routine
early if the sender or receiver are already error_mark_node.

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.cc
	(build_v2_objc_method_fixup_call): Early exit for cases
	where the sender or receiver are known to be in error.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 gcc/objc/objc-next-runtime-abi-02.cc | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/gcc/objc/objc-next-runtime-abi-02.cc b/gcc/objc/objc-next-runtime-abi-02.cc
index dfc1129530a..a622f4cbf4e 100644
--- a/gcc/objc/objc-next-runtime-abi-02.cc
+++ b/gcc/objc/objc-next-runtime-abi-02.cc
@@ -1657,6 +1657,8 @@  build_v2_objc_method_fixup_call (int super_flag, tree method_prototype,
   rcv_p = (super_flag ? objc_super_type : objc_object_type);
 
   lookup_object = build_c_cast (input_location, rcv_p, lookup_object);
+  if (sender == error_mark_node || lookup_object == error_mark_node)
+    return error_mark_node;
 
   /* Use SAVE_EXPR to avoid evaluating the receiver twice.  */
   lookup_object = save_expr (lookup_object);