public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1389] ada: Make internal_error_function more robust
@ 2023-05-30 7:18 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-30 7:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f60d3abea1106dca6565bb390eabfe19c84e2f40
commit r14-1389-gf60d3abea1106dca6565bb390eabfe19c84e2f40
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Fri Jan 27 00:05:37 2023 +0100
ada: Make internal_error_function more robust
gcc/ada/
* gcc-interface/misc.cc (internal_error_function): Be prepared for
an input_location set to UNKNOWN_LOCATION.
Diff:
---
gcc/ada/gcc-interface/misc.cc | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 56c7bb9b533..30319ae58b1 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -330,13 +330,23 @@ internal_error_function (diagnostic_context *context, const char *msgid,
sp.Bounds = &temp;
sp.Array = buffer;
- xloc = expand_location (input_location);
- if (context->show_column && xloc.column != 0)
- loc = xasprintf ("%s:%d:%d", xloc.file, xloc.line, xloc.column);
+ if (input_location == UNKNOWN_LOCATION)
+ {
+ loc = NULL;
+ temp_loc.Low_Bound = 1;
+ temp_loc.High_Bound = 0;
+ }
else
- loc = xasprintf ("%s:%d", xloc.file, xloc.line);
- temp_loc.Low_Bound = 1;
- temp_loc.High_Bound = strlen (loc);
+ {
+ xloc = expand_location (input_location);
+ if (context->show_column && xloc.column != 0)
+ loc = xasprintf ("%s:%d:%d", xloc.file, xloc.line, xloc.column);
+ else
+ loc = xasprintf ("%s:%d", xloc.file, xloc.line);
+ temp_loc.Low_Bound = 1;
+ temp_loc.High_Bound = strlen (loc);
+ }
+
sp_loc.Bounds = &temp_loc;
sp_loc.Array = loc;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-30 7:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 7:18 [gcc r14-1389] ada: Make internal_error_function more robust Marc Poulhi?s
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).