public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix access to uninitialized global variable when emitting error
@ 2020-10-15  9:40 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-10-15  9:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

When calling Error_Msg_FE with a message string that contains "<<"
insertion characters, the error reporting machinery was accessing
uninitialized Error_Msg_Warn variable to decide whether to emit error or
a warning.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_util.adb (Bad_Predicated_Subtype_Use): Emit an
	unconditional error, not a conditional warning.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 375 bytes --]

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -982,7 +982,7 @@ package body Sem_Util is
                    Reason => PE_Bad_Predicated_Generic_Type));
 
             else
-               Error_Msg_FE (Msg & "<<", N, Typ);
+               Error_Msg_FE (Msg, N, Typ);
             end if;
 
          else



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-15  9:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  9:40 [Ada] Fix access to uninitialized global variable when emitting error Pierre-Marie de Rodat

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).