* [Bug fortran/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
@ 2020-11-12 12:56 ` vries at gcc dot gnu.org
2021-10-13 12:22 ` vries at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-12 12:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 33ac761f85d..737d7bd0f6e 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -117,7 +117,8 @@ f77_print_array_1 (int nss, int ndimensions, struct type
*type,
LONGEST lowerbound, upperbound;
LONGEST i;
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
+ if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+ lowerbound = 0, upperbound = -1;
if (nss != ndimensions)
{
...
With the patch, we have instead the expected:
...
Breakpoint 1, bar (varz=..., vart=...) at dynamic.f90:68
68 varz(2) = 5 ! varz-almostfilled^M
$1 = ()
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
2020-11-12 12:56 ` [Bug fortran/26870] " vries at gcc dot gnu.org
@ 2021-10-13 12:22 ` vries at gcc dot gnu.org
2021-10-13 14:06 ` [Bug symtab/26870] " vries at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-13 12:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
With gdb-11.1 we have:
...
(gdb) PASS: gdb.fortran/dynamic.exp: ptype vart
p varz^M
$26 = <error reading variable>^M
(gdb) FAIL: gdb.fortran/dynamic.exp: p varz
p vart^M
$27 = <error reading variable>^M
(gdb) FAIL: gdb.fortran/dynamic.exp: p vart
...
which means we no longer get the "warning: array or string index out of range"
which is good.
The error message is a bit uninformative, and could be improved using:
...
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 324055da93f..05740c838ad 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1050,7 +1050,7 @@ do_val_print (struct value *value, struct ui_file
*stream, int recurs
e,
catch (const gdb_exception_error &except)
{
fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable>"));
+ _("<error reading variable: %s>"), except.what ());
}
}
...
to:
...
(gdb) PASS: gdb.fortran/dynamic.exp: ptype vart
p varz^M
$26 = <error reading variable: failed to get range bounds>^M
(gdb) FAIL: gdb.fortran/dynamic.exp: p varz
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug symtab/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
2020-11-12 12:56 ` [Bug fortran/26870] " vries at gcc dot gnu.org
2021-10-13 12:22 ` vries at gcc dot gnu.org
@ 2021-10-13 14:06 ` vries at gcc dot gnu.org
2021-10-13 14:07 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-13 14:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|fortran |symtab
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Tentative patch:
> ...
> diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
> index 33ac761f85d..737d7bd0f6e 100644
> --- a/gdb/f-valprint.c
> +++ b/gdb/f-valprint.c
> @@ -117,7 +117,8 @@ f77_print_array_1 (int nss, int ndimensions, struct type
> *type,
> LONGEST lowerbound, upperbound;
> LONGEST i;
>
> - get_discrete_bounds (range_type, &lowerbound, &upperbound);
> + if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
> + lowerbound = 0, upperbound = -1;
>
> if (nss != ndimensions)
> {
> ...
>
> With the patch, we have instead the expected:
> ...
> Breakpoint 1, bar (varz=..., vart=...) at dynamic.f90:68
> 68 varz(2) = 5 ! varz-almostfilled^M
> $1 = ()
> ...
Reading this back, I don't think this is the right solution. This suggests
that the dimension is 0, and the error may give the idea of using an explicit
dimension for printing the variable.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug symtab/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
` (2 preceding siblings ...)
2021-10-13 14:06 ` [Bug symtab/26870] " vries at gcc dot gnu.org
@ 2021-10-13 14:07 ` vries at gcc dot gnu.org
2021-10-13 14:07 ` vries at gcc dot gnu.org
2021-10-13 14:08 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-13 14:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.1
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Marking this as fixed in 11.2, where we now do:
...
(gdb) PASS: gdb.fortran/dynamic.exp: ptype vart
p varz^M
$26 = <error reading variable>^M
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug symtab/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
` (3 preceding siblings ...)
2021-10-13 14:07 ` vries at gcc dot gnu.org
@ 2021-10-13 14:07 ` vries at gcc dot gnu.org
2021-10-13 14:08 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-13 14:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #4)
> Marking this as fixed in 11.2, where we now do:
> ...
> (gdb) PASS: gdb.fortran/dynamic.exp: ptype vart
> p varz^M
> $26 = <error reading variable>^M
> ...
Now really mark this fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug symtab/26870] [fortran] Printing dynamic array fails
2020-11-12 12:50 [Bug fortran/26870] New: [fortran] Printing dynamic array fails vries at gcc dot gnu.org
` (4 preceding siblings ...)
2021-10-13 14:07 ` vries at gcc dot gnu.org
@ 2021-10-13 14:08 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-13 14:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26870
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> The error message is a bit uninformative, and could be improved using:
> ...
> diff --git a/gdb/valprint.c b/gdb/valprint.c
> index 324055da93f..05740c838ad 100644
> --- a/gdb/valprint.c
> +++ b/gdb/valprint.c
> @@ -1050,7 +1050,7 @@ do_val_print (struct value *value, struct ui_file
> *stream, int recurs
> e,
> catch (const gdb_exception_error &except)
> {
> fprintf_styled (stream, metadata_style.style (),
> - _("<error reading variable>"));
> + _("<error reading variable: %s>"), except.what ());
> }
> }
>
> ...
> to:
> ...
> (gdb) PASS: gdb.fortran/dynamic.exp: ptype vart
> p varz^M
> $26 = <error reading variable: failed to get range bounds>^M
> (gdb) FAIL: gdb.fortran/dynamic.exp: p varz
> ...
Submitted for trunk here (
https://sourceware.org/pipermail/gdb-patches/2021-October/182521.html ).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread