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 r13-530] [Ada] Initialize Compiler_State to avoid Constraint_Error Date: Tue, 17 May 2022 08:28:13 +0000 (GMT) [thread overview] Message-ID: <20220517082813.63962385742A@sourceware.org> (raw) https://gcc.gnu.org/g:83bfddac6feff4dcacc2b93e2357629a3bfa971b commit r13-530-g83bfddac6feff4dcacc2b93e2357629a3bfa971b Author: Etienne Servais <servais@adacore.com> Date: Tue Oct 26 17:00:24 2021 +0200 [Ada] Initialize Compiler_State to avoid Constraint_Error When building gnat1 with `-gnatVa` as we do locally, rules like: `gcc -c -gnatyM79 <any adb file with lines longer than 79>` will throw a constraint error as `lib.compiler_state` is initialized by par.adb, ie after scanning. Therefore any error_msg thrown during scanning will perform this uninitialized read (which raises a Constraint_Error when the compiler was compiled with `-gnatVa`). Initialize this flag to `Parsing`. gcc/ada/ * lib.ads: initialize `Compiler_State` to `Parsing`. Diff: --- gcc/ada/lib.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads index 4a799130a4b..e29d42af570 100644 --- a/gcc/ada/lib.ads +++ b/gcc/ada/lib.ads @@ -39,7 +39,7 @@ package Lib is -- Type to hold list of indirect references to unit number table type Compiler_State_Type is (Parsing, Analyzing); - Compiler_State : Compiler_State_Type; + Compiler_State : Compiler_State_Type := Parsing; -- Indicates current state of compilation. This is used to implement the -- function In_Extended_Main_Source_Unit.
reply other threads:[~2022-05-17 8:28 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=20220517082813.63962385742A@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).