public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jdx at o2 dot pl" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107801] Building cross compiler for H8 family fails in libstdc++ (c++17/memory_resource.cc) Date: Sun, 27 Nov 2022 02:31:59 +0000 [thread overview] Message-ID: <bug-107801-4-ZJZNeYTVCO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107801-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801 --- Comment #9 from Jan Dubiec <jdx at o2 dot pl> --- I think I have found why the static assertion fails as mentioned in my previous comment. Surprisingly, for H8/300H, H8/S and H8/SX in normal mode 32-bit integers and floats are aligned on 4-byte boundaries. Let's consider following structure: struct foo { uint32_t i; uint16_t j; }; In advanced mode sizeof(struct foo) is 8. In normal mode, i.e. when the code is compiled with -mn, the size is still 8 although one could expect it to be 6 (and that is why the assertion fails). In order to the size be 6 bytes, -malign-300 must be used along with -mn. So the natural solution seems to be adding -malign-300 to the compiler options when libstdc++ is built in normal mode. BTW. I do not even get why 4-byte boundaries are used at all. According to H8/300H and H8/S software manuals (I didn't check H8/SX) "The CPU can access word data and longword data in memory, but word or longword data must begin at an even address." (longword is 32-bit word in Renesas' nomenclature). They do not state that alignment must be 4 bytes for 32-bit integers and floats.
next prev parent reply other threads:[~2022-11-27 2:32 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-22 4:56 [Bug libstdc++/107801] New: " jdx at o2 dot pl 2022-11-22 9:08 ` [Bug libstdc++/107801] " redi at gcc dot gnu.org 2022-11-22 9:10 ` redi at gcc dot gnu.org 2022-11-22 9:20 ` redi at gcc dot gnu.org 2022-11-22 10:39 ` cvs-commit at gcc dot gnu.org 2022-11-22 11:06 ` cvs-commit at gcc dot gnu.org 2022-11-22 17:05 ` jdx at o2 dot pl 2022-11-22 17:09 ` redi at gcc dot gnu.org 2022-11-23 5:16 ` jdx at o2 dot pl 2022-11-26 21:41 ` pinskia at gcc dot gnu.org 2022-11-27 2:31 ` jdx at o2 dot pl [this message] 2022-11-27 7:35 ` redi at gcc dot gnu.org 2022-11-28 12:10 ` redi at gcc dot gnu.org 2022-11-28 13:32 ` redi at gcc dot gnu.org 2022-11-28 16:57 ` cvs-commit at gcc dot gnu.org 2022-11-28 17:01 ` redi at gcc dot gnu.org 2022-11-30 0:42 ` jdx at o2 dot pl 2022-11-30 1:48 ` redi at gcc dot gnu.org 2022-12-04 11:59 ` jdx at o2 dot pl 2023-05-16 12:50 ` cvs-commit at gcc dot gnu.org 2023-05-16 15:37 ` cvs-commit at gcc dot gnu.org 2023-05-16 16:16 ` cvs-commit at gcc dot gnu.org 2023-05-16 16:17 ` redi 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-107801-4-ZJZNeYTVCO@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).