public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4175] [Ada] Fix latent bug in set_end_locus_from_node Date: Tue, 5 Oct 2021 08:24:42 +0000 (GMT) [thread overview] Message-ID: <20211005082442.D96883858436@sourceware.org> (raw) https://gcc.gnu.org/g:650ad524d8a5928998037c1f6434054d46a400d4 commit r12-4175-g650ad524d8a5928998037c1f6434054d46a400d4 Author: Bob Duff <duff@adacore.com> Date: Wed Aug 11 07:44:31 2021 -0400 [Ada] Fix latent bug in set_end_locus_from_node gcc/ada/ * gcc-interface/trans.c (set_end_locus_from_node): Check that Handled_Statement_Sequence is not Empty before calling End_Label, because the Empty node has no End_Label, and depending on the exact node layout chosen by gen_il, calling End_Label might crash, or might work OK by accident. Diff: --- gcc/ada/gcc-interface/trans.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 158bfe35f7b..4aaa567237c 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -10507,10 +10507,15 @@ set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) case N_Package_Body: case N_Subprogram_Body: case N_Block_Statement: - gnat_end_label = End_Label (Handled_Statement_Sequence (gnat_node)); + if (Present (Handled_Statement_Sequence (gnat_node))) + gnat_end_label = End_Label (Handled_Statement_Sequence (gnat_node)); + else + gnat_end_label = Empty; + break; case N_Package_Declaration: + gcc_checking_assert (Present (Specification (gnat_node))); gnat_end_label = End_Label (Specification (gnat_node)); break;
reply other threads:[~2021-10-05 8:24 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=20211005082442.D96883858436@sourceware.org \ --to=pmderodat@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).