public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102295] ELF symbol sizes for variable-length objects are too small (C++) Date: Tue, 10 May 2022 08:20:44 +0000 [thread overview] Message-ID: <bug-102295-4-4boxLvcqmH@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102295-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102295 --- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:e54c8a86166fff6357729a3cde1b1cd143985abe commit r10-10643-ge54c8a86166fff6357729a3cde1b1cd143985abe Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Sep 14 16:56:30 2021 +0200 c++: Update DECL_*SIZE for objects with flexible array members with initializers [PR102295] The C FE updates DECL_*SIZE for vars which have initializers for flexible array members for many years, but C++ FE kept DECL_*SIZE the same as the type size (i.e. as if there were zero elements in the flexible array member). This results e.g. in ELF symbol sizes being too small. Note, if the flexible array member is initialized only with non-constant initializers, we have a worse bug that this patch doesn't solve, the splitting of initializers into constant and dynamic initialization removes the initializer and we don't have just wrong DECL_*SIZE, but nothing is emitted when emitting those vars into assembly either and so the dynamic initialization clobbers other vars that may overlap the variable. I think we need keep an empty CONSTRUCTOR elt in DECL_INITIAL for the flexible array member in that case. 2021-09-14 Jakub Jelinek <jakub@redhat.com> PR c++/102295 * decl.c (layout_var_decl): For aggregates ending with a flexible array member, add the size of the initializer for that member to DECL_SIZE and DECL_SIZE_UNIT. * g++.target/i386/pr102295.C: New test. (cherry picked from commit 818c505188ff5cd8eb048eb0e614c4ef732225bd)
next prev parent reply other threads:[~2022-05-10 8:20 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-12 22:46 [Bug c++/102295] New: " pinskia at gcc dot gnu.org 2021-09-12 23:15 ` [Bug c++/102295] " pinskia at gcc dot gnu.org 2021-09-13 16:34 ` jakub at gcc dot gnu.org 2021-09-13 16:38 ` jakub at gcc dot gnu.org 2021-09-13 20:40 ` pinskia at gcc dot gnu.org 2021-09-14 14:57 ` cvs-commit at gcc dot gnu.org 2021-09-14 14:59 ` jakub at gcc dot gnu.org 2021-09-15 20:22 ` cvs-commit at gcc dot gnu.org 2021-09-15 23:05 ` cvs-commit at gcc dot gnu.org 2021-09-15 23:05 ` cvs-commit at gcc dot gnu.org 2021-09-16 8:50 ` jakub at gcc dot gnu.org 2022-05-10 8:20 ` cvs-commit at gcc dot gnu.org [this message] 2022-05-10 8:20 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:22 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:22 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:36 ` jakub 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-102295-4-4boxLvcqmH@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).