From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8203B385481F; Wed, 28 Jul 2021 23:15:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8203B385481F From: "mhjacobson at me dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug objc/101666] New: Objective-C frontend crashes with `-fobjc-nilcheck` Date: Wed, 28 Jul 2021 23:15:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: objc X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mhjacobson at me dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2021 23:15:01 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101666 Bug ID: 101666 Summary: Objective-C frontend crashes with `-fobjc-nilcheck` Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc Assignee: unassigned at gcc dot gnu.org Reporter: mhjacobson at me dot com Target Milestone: --- Details, including minimal reproducer, below. The Objective-C frontend cra= shes when I try to use -fobjc-nilcheck under the NeXT v2 ABI. If I send a messa= ge whose return type would require using objc_msgSend_stret (and a nil check), crash. Message sends not requiring stret (and thus no nil check) work fine. =3D=3D=3D macOS 10.15.7 "Catalina" / x86_64 $ gcc --version gcc (GCC) 10.2.0 $ gcc -Os -fobjc-nilcheck -xobjective-c - struct point { double x, y, z; }; @interface Foo - (struct point)bar; @end Foo *f; int main(void) { struct point p =3D [f bar]; } : In function =E2=80=98main=E2=80=99: :10:9: internal compiler error: Segmentation fault: 11 Here's the backtrace: (lldb) bt * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D EXC_BAD_ACC= ESS (code=3D1, address=3D0x0) * frame #0: 0x00000001012ce428 cc1obj`recompute_constructor_flags(c=3D0x0000000144513f90) at tree.c:2018:12 frame #1: 0x00000001012cd45f cc1obj`build_constructor(type=3D0x0000000144505930, vals=3D0x000000014450a6= 78) at tree.c:2059:3 frame #2: 0x000000010000c2bd cc1obj`objc_build_constructor(type=3D0x0000000144505930, elts=3D0x000000014= 450a678) at objc-act.c:3235:22 frame #3: 0x0000000100031b37 cc1obj`build_v2_build_objc_method_call(super_flag=3D0, method_prototype=3D0x0000000144504a18, lookup_object=3D0x00000001444f3720, selector=3D0x00000001444f36a0, method_params=3D0x000000014452b140, check_for_nil=3Dtrue) at objc-next-runtime-abi-02.c:1637:12 frame #4: 0x000000010002d8da cc1obj`next_runtime_abi_02_build_objc_method_call(loc=3D62820, method_prototype=3D0x0000000144504a18, receiver=3D0x0000000142c5d240, rtype=3D0x0000000144527000, sel_name=3D0x000000014451bf00, method_params=3D0x0000000000000000, super=3D0) at objc-next-runtime-abi-02.c:1720:10 frame #5: 0x000000010000902d cc1obj`objc_finish_message_expr(receiver=3D0x0000000142c5d240, sel_name=3D0x000000014451bf00, method_params=3D0x0000000000000000, deprecated_method_prototype=3D0x0000000000000000) at objc-act.c:5679:12 frame #6: 0x000000010000ec8f cc1obj`objc_build_message_expr(receiver=3D0x0000000142c5d240, message_args=3D0x000000014451bf00) at objc-act.c:5308:10 frame #7: 0x00000001000be312 cc1obj`c_parser_postfix_expression(parser=3D0x0000000142c5d1b0) at c-parser.c:10163:17 frame #8: 0x00000001000b5f21 cc1obj`c_parser_unary_expression(parser=3D0x0000000142c5d1b0) at c-parser.c:8276:14 frame #9: 0x00000001000b3ce5 cc1obj`c_parser_cast_expression(parser=3D0x0000000142c5d1b0, after=3D0x0000000000000000) at c-parser.c:8115:12 frame #10: 0x00000001000b209b cc1obj`c_parser_binary_expression(parser=3D0x0000000142c5d1b0, after=3D0x0000000000000000, omp_atomic_lhs=3D0x0000000000000000) at c-parser.c:7918:19 frame #11: 0x00000001000b1800 cc1obj`c_parser_conditional_expression(parser=3D0x0000000142c5d1b0, after=3D0x0000000000000000, omp_atomic_lhs=3D0x0000000000000000) at c-parser.c:7652:10 frame #12: 0x00000001000b13ed cc1obj`c_parser_expr_no_commas(parser=3D0x0000000142c5d1b0, after=3D0x0000000000000000, omp_atomic_lhs=3D0x0000000000000000) at c-parser.c:7569:9 frame #13: 0x00000001000c6921 cc1obj`c_parser_initializer(parser=3D0x0000000142c5d1b0) at c-parser.c:5227= :13 frame #14: 0x00000001000c34a0 cc1obj`c_parser_declaration_or_fndef(parser=3D0x0000000142c5d1b0, fndef_ok= =3Dfalse, static_assert_ok=3Dtrue, empty_ok=3Dtrue, nested=3Dtrue, start_attr_ok=3Dtr= ue, objc_foreach_object_declaration=3D0x0000000000000000, omp_declare_simd_clauses=3Dvec @ 0x00007ffeefbfed= e8, have_attrs=3Dfalse, attrs=3D0x0000000000000000, oacc_routine_data=3D0x0000000000000000, fallthru_attr_p=3D0x00007ffeefbfeeb= f) at c-parser.c:2248:12 frame #15: 0x00000001000c00d4 cc1obj`c_parser_compound_statement_nostart(parser=3D0x0000000142c5d1b0) at c-parser.c:5718:4 frame #16: 0x00000001000c6c3d cc1obj`c_parser_compound_statement(parser=3D0x0000000142c5d1b0, endlocp=3D0x00007ffeefbff070) at c-parser.c:5617:24 frame #17: 0x00000001000c3e66 cc1obj`c_parser_declaration_or_fndef(parser=3D0x0000000142c5d1b0, fndef_ok= =3Dtrue, static_assert_ok=3Dtrue, empty_ok=3Dtrue, nested=3Dfalse, start_attr_ok=3Dt= rue, objc_foreach_object_declaration=3D0x0000000000000000, omp_declare_simd_clauses=3Dvec @ 0x00007ffeefbff4= 78, have_attrs=3Dfalse, attrs=3D0x0000000000000000, oacc_routine_data=3D0x0000000000000000, fallthru_attr_p=3D0x000000000000000= 0) at c-parser.c:2505:11 frame #18: 0x00000001000ee11e cc1obj`c_parser_external_declaration(parser=3D0x0000000142c5d1b0) at c-parser.c:1745:7 frame #19: 0x00000001000b095d cc1obj`c_parser_translation_unit(parser=3D0x0000000142c5d1b0) at c-parser.c:1618:4 frame #20: 0x00000001000b066b cc1obj`c_parse_file() at c-parser.c:21745= :3 frame #21: 0x0000000100178750 cc1obj`c_common_parse_file() at c-opts.c:1190:7 frame #22: 0x0000000100eaeb34 cc1obj`compile_file() at toplev.c:458:3 frame #23: 0x0000000100eaaee5 cc1obj`do_compile() at toplev.c:2278:11 frame #24: 0x0000000100eaa5b4 cc1obj`toplev::main(this=3D0x00007ffeefbf= f7f8, argc=3D24, argv=3D0x00007ffeefbff838) at toplev.c:2417:7 frame #25: 0x0000000101427c0b cc1obj`main(argc=3D24, argv=3D0x00007ffee= fbff838) at main.c:39:17 frame #26: 0x00007fff6c08ecc9 libdyld.dylib`start + 1=