aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-08-02 23:48:37 +0000
committerJason Molenda <jmolenda@apple.com>1999-08-02 23:48:37 +0000
commita0b3c4fd32cf8336bf7b69f373ef86d5c54035f6 (patch)
treecf8f31bccdd267252e6b3c9636a1d323397673e2 /gdb/stabsread.c
parent30727aa6d12fb866494020c0b62ab265a2bdcdfe (diff)
downloadgdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.zip
gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.gz
gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.bz2
import gdb-1999-08-02 snapshot
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index ec59cf3..52b22f1 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4701,18 +4701,30 @@ read_range_type (pp, typenums, objfile)
/* We used to do this only for subrange of self or subrange of int. */
else if (n2 == 0)
{
+ /* -1 is used for the upper bound of (4 byte) "unsigned int" and
+ "unsigned long", and we already checked for that,
+ so don't need to test for it here. */
+
if (n3 < 0)
/* n3 actually gives the size. */
return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED,
NULL, objfile);
- if (n3 == 0xff)
- return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, NULL, objfile);
- if (n3 == 0xffff)
- return init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, NULL, objfile);
- /* -1 is used for the upper bound of (4 byte) "unsigned int" and
- "unsigned long", and we already checked for that,
- so don't need to test for it here. */
+ /* Is n3 == 2**(8n))-1 for some integer n? Then it's an
+ unsigned n-byte integer. But do require n to be a power of
+ two; we don't want 3- and 5-byte integers flying around. */
+ {
+ int bytes;
+ unsigned long bits;
+
+ bits = n3;
+ for (bytes = 0; (bits & 0xff) == 0xff; bytes++)
+ bits >>= 8;
+ if (bits == 0
+ && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
+ return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
+ objfile);
+ }
}
/* I think this is for Convex "long long". Since I don't know whether
Convex sets self_subrange, I also accept that particular size regardless