diff options
author | Per Bothner <per@bothner.com> | 1995-12-11 09:02:26 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1995-12-11 09:02:26 +0000 |
commit | f6d165855eebd59b95ceb16c48f10c7c927d187c (patch) | |
tree | 264ab904eadb005f1a121f9b9cb5374d09458855 /gdb/gdbtypes.c | |
parent | 406477a6961ef023cb8414059fbd8979c9d879f6 (diff) | |
download | gdb-f6d165855eebd59b95ceb16c48f10c7c927d187c.zip gdb-f6d165855eebd59b95ceb16c48f10c7c927d187c.tar.gz gdb-f6d165855eebd59b95ceb16c48f10c7c927d187c.tar.bz2 |
* valops.c (value_cast): Handle casts to and from TYPE_CODE_CHAR.
* ch-exp.c (match_integer_literal): Fix long long support.
* gdbtypes.c (get_discrete_bounds): Make TYPE_LENGTH (type) ==
sizeof (LONGEST) case work OK.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3cde087..99c7c57 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -369,7 +369,7 @@ get_discrete_bounds (type, lowp, highp) *highp = 1; return 0; case TYPE_CODE_INT: - if (TYPE_LENGTH (type) >= sizeof (LONGEST)) /* Too big */ + if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */ return -1; if (!TYPE_UNSIGNED (type)) { @@ -380,7 +380,11 @@ get_discrete_bounds (type, lowp, highp) /* ... fall through for unsigned ints ... */ case TYPE_CODE_CHAR: *lowp = 0; - *highp = (1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT)) - 1; + /* This round-about calculation is to avoid shifting by + TYPE_LENGTH (type) * TARGET_CHAR_BIT, which will not work + if TYPE_LENGTH (type) == sizeof (LONGEST). */ + *highp = 1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1); + *highp = (*highp - 1) | *highp; return 0; default: return -1; |