Commit 10d17cb7 by Alan Modra Committed by Jeff Law

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
parent c3e5f9fa
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> 2001-01-31 Richard Henderson <rth@redhat.com>
* config.gcc (alpha-osf5): Use float-i128.h. * config.gcc (alpha-osf5): Use float-i128.h.
......
...@@ -5965,18 +5965,17 @@ hppa_encode_label (sym) ...@@ -5965,18 +5965,17 @@ hppa_encode_label (sym)
rtx sym; rtx sym;
{ {
const char *str = XSTR (sym, 0); const char *str = XSTR (sym, 0);
int len = strlen (str); int len = strlen (str) + 1;
char *newstr = alloca (len + 1); char *newstr, *p;
p = newstr = alloca (len + 1);
if (str[0] == '*') if (str[0] == '*')
*newstr++ = *str++; {
strcpy (newstr + 1, str); str++;
*newstr = '@'; len--;
}
/* Prepending '@' increases the length of the string. That's important *p++ = '@';
to note since we're going to allocate persistent storage for the strcpy (p, str);
new string. */
len++;
XSTR (sym,0) = ggc_alloc_string (newstr, len); XSTR (sym,0) = ggc_alloc_string (newstr, len);
} }
......
...@@ -1488,8 +1488,7 @@ do { \ ...@@ -1488,8 +1488,7 @@ do { \
|| (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c' \ || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c' \
&& !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings))) && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
#define FUNCTION_NAME_P(NAME) \ #define FUNCTION_NAME_P(NAME) (*(NAME) == '@')
(*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
#define ENCODE_SECTION_INFO(DECL)\ #define ENCODE_SECTION_INFO(DECL)\
do \ do \
...@@ -1511,9 +1510,8 @@ while (0) ...@@ -1511,9 +1510,8 @@ while (0)
This is sort of inverse to ENCODE_SECTION_INFO. */ This is sort of inverse to ENCODE_SECTION_INFO. */
#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
(VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \ (VAR) = ((SYMBOL_NAME) \
1 + (SYMBOL_NAME)[1] == '@'\ + (*(SYMBOL_NAME) == '*' || *(SYMBOL_NAME) == '@'))
: (SYMBOL_NAME)[0] == '@'))
/* Specify the machine mode that this machine uses /* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */ for the index in the tablejump instruction. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment