aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-04-27 13:25:27 -0600
committerTom Tromey <tromey@adacore.com>2023-04-28 11:05:45 -0600
commita38b832238eecf6611a338b39bb8f03f2968c26d (patch)
tree385a0c6857a295638ca7d81a1440bb5b0e841c53 /gdb/gdbtypes.c
parentebb83b77a74a4f31d7fba7e892599c4552aad137 (diff)
downloadgdb-a38b832238eecf6611a338b39bb8f03f2968c26d.zip
gdb-a38b832238eecf6611a338b39bb8f03f2968c26d.tar.gz
gdb-a38b832238eecf6611a338b39bb8f03f2968c26d.tar.bz2
Do not change type in get_discrete_low_bound
get_discrete_low_bound has this code: /* Set unsigned indicator if warranted. */ if (low >= 0) type->set_is_unsigned (true); It's bad to modify a type in a getter like this, so this patch removes this code. FWIW I looked and this code has been there since at least 1999 (it was in the initial sourceware import). Types in general would benefit from const-ification, which would probably reveal more code like this, but I haven't attempted that. Regression tested on x86-64 Fedora 36. Reviewed-by: Kevin Buettner <kevinb@redhat.com>
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6af5935..c8d5314 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1084,10 +1084,6 @@ get_discrete_low_bound (struct type *type)
low = type->field (i).loc_enumval ();
}
- /* Set unsigned indicator if warranted. */
- if (low >= 0)
- type->set_is_unsigned (true);
-
return low;
}
else