From: Jim Wilson Date: Thu, 21 Apr 1994 19:49:26 +0000 (-0700) Subject: (sparc_type_code): Don't put more than 30 bits of info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aee2c3c58e51267c48e8d0b2c487961e75cde815;p=gcc.git (sparc_type_code): Don't put more than 30 bits of info into the variable qualifiers. From-SVN: r7123 --- diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 81723adf9c6..4b8c1621757 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;