public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ibuclaw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug d/106977] [13 regression] d21 dies with SIGBUS on 32-bit Darwin Date: Fri, 24 Feb 2023 11:39:06 +0000 [thread overview] Message-ID: <bug-106977-4-jWpgSCxDFZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106977-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106977 --- Comment #26 from ibuclaw at gcc dot gnu.org --- Comparing the D and C++ trees side by side. At the point of `finish_function` for the ::vis() method, I see the following: D: type <record_type 0x7ffff6f91888 Visibility cxx-odr-p BLK C++: type <record_type 0x7ffff700aa80 Visibility cxx-odr-p type_5 DI When does TYPE_MODE get set, and why is it that value? Setting watchers in both language compilers... - C++/D: make_node() sets the memory to E_VOIDmode - C++/D: entrypoint to compute_record_type() sets BLKmode - D: returns early because all fields still have DECL_SIZE = null - C++: exit to compute_record_type() sets E_DImode In D, this is finish_aggregate_type() which calls compute_record_mode() before calling layout_decl() on all fields. This was not the Looking at history between 2022/06/10 .. 2022/06/24, I think we have a clear commit that introduced this wrong code/behaviour - r13-1104. The loop added in r13-1104 that sets DECL_SIZE on all fields was added after the call to compute_record_mode. Looks like this is the mistake, it should have been put before compute_record_mode. So then, I think we finally have a fix: --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -615,9 +615,6 @@ finish_aggregate_type (unsigned structsize, unsigned alignsize, tree type) SET_TYPE_ALIGN (type, alignsize * BITS_PER_UNIT); TYPE_PACKED (type) = (alignsize == 1); - /* Set the back-end type mode. */ - compute_record_mode (type); - /* Layout all fields now the type is complete. */ for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) { @@ -662,6 +659,9 @@ finish_aggregate_type (unsigned structsize, unsigned alignsize, tree type) } } + /* Set the back-end type mode after all fields have had their size set. */ + compute_record_mode (type); + /* Fix up all forward-referenced variants of this aggregate type. */ for (tree t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) {
next prev parent reply other threads:[~2023-02-24 11:39 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-20 14:06 [Bug d/106977] New: " ro at gcc dot gnu.org 2022-09-21 7:48 ` [Bug d/106977] " rguenth at gcc dot gnu.org 2022-11-07 14:37 ` ibuclaw at gdcproject dot org 2022-11-07 14:49 ` ro at CeBiTec dot Uni-Bielefeld.DE 2022-11-07 15:34 ` ibuclaw at gdcproject dot org 2022-11-07 15:43 ` ro at CeBiTec dot Uni-Bielefeld.DE 2023-02-22 23:58 ` iains at gcc dot gnu.org 2023-02-23 1:20 ` ibuclaw at gcc dot gnu.org 2023-02-23 7:38 ` iains at gcc dot gnu.org 2023-02-23 10:21 ` iains at gcc dot gnu.org 2023-02-23 10:43 ` ibuclaw at gcc dot gnu.org 2023-02-23 10:50 ` ibuclaw at gcc dot gnu.org 2023-02-23 10:51 ` iains at gcc dot gnu.org 2023-02-23 22:49 ` ibuclaw at gcc dot gnu.org 2023-02-23 23:11 ` ibuclaw at gcc dot gnu.org 2023-02-23 23:29 ` iains at gcc dot gnu.org 2023-02-23 23:33 ` pinskia at gcc dot gnu.org 2023-02-23 23:34 ` iains at gcc dot gnu.org 2023-02-23 23:36 ` iains at gcc dot gnu.org 2023-02-23 23:55 ` pinskia at gcc dot gnu.org 2023-02-24 0:00 ` pinskia at gcc dot gnu.org 2023-02-24 1:13 ` ibuclaw at gcc dot gnu.org 2023-02-24 2:03 ` ibuclaw at gcc dot gnu.org 2023-02-24 2:12 ` ibuclaw at gcc dot gnu.org 2023-02-24 7:52 ` iains at gcc dot gnu.org 2023-02-24 8:20 ` ibuclaw at gcc dot gnu.org 2023-02-24 8:46 ` iains at gcc dot gnu.org 2023-02-24 11:39 ` ibuclaw at gcc dot gnu.org [this message] 2023-02-24 17:48 ` iains at gcc dot gnu.org 2023-02-24 18:14 ` iains at gcc dot gnu.org 2023-02-24 18:39 ` ibuclaw at gcc dot gnu.org 2023-02-24 20:07 ` iains at gcc dot gnu.org 2023-04-26 6:56 ` [Bug d/106977] [13/14 " rguenth at gcc dot gnu.org 2023-06-28 18:19 ` cvs-commit at gcc dot gnu.org 2023-06-28 18:52 ` cvs-commit at gcc dot gnu.org 2023-06-28 18:57 ` ibuclaw at gcc dot gnu.org 2023-06-29 7:52 ` iains at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-106977-4-jWpgSCxDFZ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).