public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-965] Fix segfault at run time on strict-alignment platforms Date: Fri, 21 May 2021 08:41:43 +0000 (GMT) [thread overview] Message-ID: <20210521084143.1C19A385703A@sourceware.org> (raw) https://gcc.gnu.org/g:1e66a9170071aded59dda09ac437757de4223346 commit r12-965-g1e66a9170071aded59dda09ac437757de4223346 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Fri May 21 10:40:41 2021 +0200 Fix segfault at run time on strict-alignment platforms This fixes a regression present on the mainline and 11 branch by restricting the problematic change dealing with bitfields whose nomimal subtype is self-referential to the cases where the size is really lower. gcc/ada/ * gcc-interface/trans.c (Call_to_gnu): Restrict previous change to bitfields whose size is not equal to the type size. (gnat_to_gnu): Likewise. Diff: --- gcc/ada/gcc-interface/trans.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 8ce0d8ac9e8..adbbbb11aea 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4611,6 +4611,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, || (gnu_target && TREE_CODE (gnu_target) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (gnu_target, 1)) + && DECL_SIZE (TREE_OPERAND (gnu_target, 1)) + != TYPE_SIZE (TREE_TYPE (gnu_target)) && type_is_padding_self_referential (gnu_result_type)))) { gnu_retval = create_temporary ("R", gnu_result_type); @@ -8370,7 +8372,9 @@ gnat_to_gnu (Node_Id gnat_node) much data. But do not remove it if it is already too small. */ if (type_is_padding_self_referential (TREE_TYPE (gnu_result)) && !(TREE_CODE (gnu_result) == COMPONENT_REF - && DECL_BIT_FIELD (TREE_OPERAND (gnu_result, 1)))) + && DECL_BIT_FIELD (TREE_OPERAND (gnu_result, 1)) + && DECL_SIZE (TREE_OPERAND (gnu_result, 1)) + != TYPE_SIZE (TREE_TYPE (gnu_result)))) gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result); }
reply other threads:[~2021-05-21 8:41 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210521084143.1C19A385703A@sourceware.org \ --to=ebotcazou@gcc.gnu.org \ --cc=gcc-cvs@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).