aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sturm <jsturm@one-point.com>2003-11-20 03:34:59 +0000
committerJeff Sturm <jsturm@gcc.gnu.org>2003-11-20 03:34:59 +0000
commitc2a141a0f3fe5472f667083fa3f94bbfc1e400c2 (patch)
tree1d6369d0db9aa36c0c4de45e8fd11dcf130d3214
parent6df5a5c72a98bd1a6c0ddbfd342e233ef7840f72 (diff)
downloadgcc-c2a141a0f3fe5472f667083fa3f94bbfc1e400c2.zip
gcc-c2a141a0f3fe5472f667083fa3f94bbfc1e400c2.tar.gz
gcc-c2a141a0f3fe5472f667083fa3f94bbfc1e400c2.tar.bz2
re PR rtl-optimization/13024 (gcj can't build current rhug)
Fix PR java/13024. * except.c (prepare_eh_table_type): Allocate variable-sized buffer `buf' with alloca. From-SVN: r73752
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/except.c20
2 files changed, 17 insertions, 9 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index ea30c77..13c7625 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-19 Jeff Sturm <jsturm@one-point.com>
+
+ Fix PR java/13024.
+ * except.c (prepare_eh_table_type): Allocate variable-sized
+ buffer `buf' with alloca.
+
2003-11-17 Jeff Sturm <jsturm@one-point.com>
Fix PR java/12857.
diff --git a/gcc/java/except.c b/gcc/java/except.c
index dc97b42f..c0fa800 100644
--- a/gcc/java/except.c
+++ b/gcc/java/except.c
@@ -312,6 +312,10 @@ tree
prepare_eh_table_type (tree type)
{
tree exp;
+ const char *name;
+ char *buf;
+ tree decl;
+ tree utf8_ref;
/* The "type" (match_info) in a (Java) exception table is a pointer to:
* a) NULL - meaning match any type in a try-finally.
@@ -323,10 +327,9 @@ prepare_eh_table_type (tree type)
exp = NULL_TREE;
else if (is_compiled_class (type) && !flag_indirect_dispatch)
{
- char buf[64];
- tree decl;
- sprintf (buf, "%s_ref",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+ name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ buf = alloca (strlen (name) + 5);
+ sprintf (buf, "%s_ref", name);
decl = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
TREE_STATIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
@@ -342,11 +345,10 @@ prepare_eh_table_type (tree type)
}
else
{
- tree decl;
- tree utf8_ref = build_utf8_ref (DECL_NAME (TYPE_NAME (type)));
- char buf[64];
- sprintf (buf, "%s_ref",
- IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0))));
+ utf8_ref = build_utf8_ref (DECL_NAME (TYPE_NAME (type)));
+ name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0)));
+ buf = alloca (strlen (name) + 5);
+ sprintf (buf, "%s_ref", name);
decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_ptr_type);
TREE_STATIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;