diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1994-04-21 12:49:26 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1994-04-21 12:49:26 -0700 |
commit | aee2c3c58e51267c48e8d0b2c487961e75cde815 (patch) | |
tree | ff464ca4d990c38181ab102193fedd270d972155 /gcc | |
parent | c1da1f33b7a47a10d89010fdd0d00f00d66e8512 (diff) | |
download | gcc-aee2c3c58e51267c48e8d0b2c487961e75cde815.zip gcc-aee2c3c58e51267c48e8d0b2c487961e75cde815.tar.gz gcc-aee2c3c58e51267c48e8d0b2c487961e75cde815.tar.bz2 |
(sparc_type_code): Don't put more than 30 bits of info
into the variable qualifiers.
From-SVN: r7123
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/sparc/sparc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 81723adf..4b8c162 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -2886,6 +2886,11 @@ sparc_type_code (type) register unsigned long qualifiers = 0; register unsigned shift = 6; + /* Only the first 30 bits of the qualifer are valid. We must refrain from + setting more, since some assemblers will give an error for this. Also, + we must be careful to avoid shifts of 32 bits or more to avoid getting + unpredictable results. */ + for (;;) { switch (TREE_CODE (type)) @@ -2894,14 +2899,16 @@ sparc_type_code (type) return qualifiers; case ARRAY_TYPE: - qualifiers |= (3 << shift); + if (shift < 30) + qualifiers |= (3 << shift); shift += 2; type = TREE_TYPE (type); break; case FUNCTION_TYPE: case METHOD_TYPE: - qualifiers |= (2 << shift); + if (shift < 30) + qualifiers |= (2 << shift); shift += 2; type = TREE_TYPE (type); break; @@ -2909,7 +2916,8 @@ sparc_type_code (type) case POINTER_TYPE: case REFERENCE_TYPE: case OFFSET_TYPE: - qualifiers |= (1 << shift); + if (shift < 30) + qualifiers |= (1 << shift); shift += 2; type = TREE_TYPE (type); break; |