pa.c (hppa_encode_label): Correct size of alloca buffer so we don't overrun it.

* pa.c (hppa_encode_label): Correct size of alloca buffer
        so we don't overrun it.  Correct leading `*' case.
        * pa.h (STRIP_NAME_ENCODING): Simplify now that we don't
        need to handle `*@'.
        (FUNCTION_NAME_P): Likewise.

From-SVN: r39385
This commit is contained in:
Alan Modra 2001-02-01 01:11:28 +00:00 committed by Jeff Law
parent c3e5f9fa09
commit 10d17cb7bd
3 changed files with 20 additions and 15 deletions

View File

@ -1,3 +1,11 @@
2001-01-31 Alan Modra <alan@linuxcare.com.au>
* pa.c (hppa_encode_label): Correct size of alloca buffer
so we don't overrun it. Correct leading `*' case.
* pa.h (STRIP_NAME_ENCODING): Simplify now that we don't
need to handle `*@'.
(FUNCTION_NAME_P): Likewise.
2001-01-31 Richard Henderson <rth@redhat.com>
* config.gcc (alpha-osf5): Use float-i128.h.

View File

@ -5965,18 +5965,17 @@ hppa_encode_label (sym)
rtx sym;
{
const char *str = XSTR (sym, 0);
int len = strlen (str);
char *newstr = alloca (len + 1);
int len = strlen (str) + 1;
char *newstr, *p;
p = newstr = alloca (len + 1);
if (str[0] == '*')
*newstr++ = *str++;
strcpy (newstr + 1, str);
*newstr = '@';
/* Prepending '@' increases the length of the string. That's important
to note since we're going to allocate persistent storage for the
new string. */
len++;
{
str++;
len--;
}
*p++ = '@';
strcpy (p, str);
XSTR (sym,0) = ggc_alloc_string (newstr, len);
}

View File

@ -1488,8 +1488,7 @@ do { \
|| (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c' \
&& !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
#define FUNCTION_NAME_P(NAME) \
(*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
#define FUNCTION_NAME_P(NAME) (*(NAME) == '@')
#define ENCODE_SECTION_INFO(DECL)\
do \
@ -1511,9 +1510,8 @@ while (0)
This is sort of inverse to ENCODE_SECTION_INFO. */
#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
(VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \
1 + (SYMBOL_NAME)[1] == '@'\
: (SYMBOL_NAME)[0] == '@'))
(VAR) = ((SYMBOL_NAME) \
+ (*(SYMBOL_NAME) == '*' || *(SYMBOL_NAME) == '@'))
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */