From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B198D3858C00; Thu, 23 Feb 2023 22:50:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B198D3858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677192602; bh=m+Y2LleYgC2wusS6vB9ZFcUfLHhZQBNG9OeAqxL6yVQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pbPRwIU9raH6bHfjl7X6uHXGwNmne4lpYvRiWXwH5vNkZCMBUxmUFxgkY+2yYcwgY 1yXeRWHEQoYC2AdWrR+yikGvuxbzWwp32JHSUwFk3TB9aK3CUQ4W2pWf4cPZI8OCIU XnJo6s8cjWtmTXu+v9ml6CMmTsNZl2EKOjDOTvaU= From: "ibuclaw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug d/106977] [13 regression] d21 dies with SIGBUS on 32-bit Darwin Date: Thu, 23 Feb 2023 22:49:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ibuclaw at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106977 --- Comment #12 from ibuclaw at gcc dot gnu.org --- Looks like a bad mismatch between C++ and D. When C++ calls the method, it pushes one register. When D calls it, pushes two. Looks like the method itself returns the result in 2 registers as well - or maybe uses return slot optimization. --- // C++ Caller code #include "tree.h" #include "dmd/dsymbol.h" #include "dmd/aggregate.h" void set_visibility_for_decl (tree node, Dsymbol *sym) { Visibility visibility =3D sym->visible (); // C++ Caller asm pushl %ebx subl $20, %esp .loc 1 2561 1 movl 32(%esp), %eax movl 28(%esp), %ebx .loc 1 2562 40 movl (%eax), %edx pushl %eax call *104(%edx) // D Caller code import dmd.dsymbol; import dmd.aggregate; import dmd.gluelayer; extern(C++) void set_visibility_for_decl (tree_node* node, Dsymbol sym) { Visibility visibility =3D sym.visible(); } // D Caller asm subl $28, %esp .loc 1 5 1 movl 36(%esp), %eax .loc 1 8 27 leal 8(%esp), %ecx subl $8, %esp movl (%eax), %edx pushl %eax pushl %ecx call *104(%edx) // D Callee code override final Visibility visible() pure nothrow @nogc @safe { return visibility; } // D Callee asm movl 8(%esp), %edx movl 4(%esp), %eax .loc 1 789 9 movl 208(%edx), %ecx movl 212(%edx), %edx movl %ecx, (%eax) movl %edx, 4(%eax) .loc 1 790 5 ret $4=