aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJames E Wilson <wilson@specifixinc.com>2004-02-09 21:18:45 +0000
committerJim Wilson <wilson@gcc.gnu.org>2004-02-09 13:18:45 -0800
commitc76362b488fac9643f1ca0d549ea6151fd28ba5b (patch)
tree7bf9232584860975a8b2d86f90808c9c7d818aa7 /gcc
parentd886a0416470d04610d04f4af3b401532ea9cd4f (diff)
downloadgcc-c76362b488fac9643f1ca0d549ea6151fd28ba5b.zip
gcc-c76362b488fac9643f1ca0d549ea6151fd28ba5b.tar.gz
gcc-c76362b488fac9643f1ca0d549ea6151fd28ba5b.tar.bz2
re PR libstdc++/5625 ([mips] exception unwinding creates invalid pointer on mips)
PR libstdc++/5625 * builtin-types.def (BT_WORD, BT_FN_WORD_PTR): New. * builtins.c (expand_builtin): Handle BUILT_IN_EXTEND_POINTER. * builtins.def (BUILT_IN_EXTEND_POINTER): New. * except.c (expand_builtin_extend_pointer): New. * except.h (expand_builtin_extend_pointer): Declare. From-SVN: r77554
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/builtin-types.def2
-rw-r--r--gcc/builtins.c3
-rw-r--r--gcc/builtins.def1
-rw-r--r--gcc/except.c20
-rw-r--r--gcc/except.h1
6 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6720079..6ba6220 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2004-02-09 James E Wilson <wilson@specifixinc.com>
+
+ PR libstdc++/5625
+ * builtin-types.def (BT_WORD, BT_FN_WORD_PTR): New.
+ * builtins.c (expand_builtin): Handle BUILT_IN_EXTEND_POINTER.
+ * builtins.def (BUILT_IN_EXTEND_POINTER): New.
+ * except.c (expand_builtin_extend_pointer): New.
+ * except.h (expand_builtin_extend_pointer): Declare.
+
2004-02-09 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_emit_move): Remove splitting slow
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index df74661..bf236cf 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -64,6 +64,7 @@ DEF_PRIMITIVE_TYPE (BT_INT, integer_type_node)
DEF_PRIMITIVE_TYPE (BT_UNSIGNED, unsigned_type_node)
DEF_PRIMITIVE_TYPE (BT_LONG, long_integer_type_node)
DEF_PRIMITIVE_TYPE (BT_LONGLONG, long_long_integer_type_node)
+DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 0))
DEF_PRIMITIVE_TYPE (BT_FLOAT, float_type_node)
DEF_PRIMITIVE_TYPE (BT_INTMAX, intmax_type_node)
DEF_PRIMITIVE_TYPE (BT_DOUBLE, double_type_node)
@@ -142,6 +143,7 @@ DEF_FUNCTION_TYPE_1 (BT_FN_DOUBLE_CONST_STRING, BT_DOUBLE, BT_CONST_STRING)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_CONST_STRING,
BT_LONGDOUBLE, BT_CONST_STRING)
DEF_FUNCTION_TYPE_1 (BT_FN_STRING_CONST_STRING, BT_STRING, BT_CONST_STRING)
+DEF_FUNCTION_TYPE_1 (BT_FN_WORD_PTR, BT_WORD, BT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING,
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 48be07b..2fdc370 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5539,6 +5539,9 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_EH_RETURN_DATA_REGNO:
return expand_builtin_eh_return_data_regno (arglist);
#endif
+ case BUILT_IN_EXTEND_POINTER:
+ return expand_builtin_extend_pointer (TREE_VALUE (arglist));
+
case BUILT_IN_VA_START:
case BUILT_IN_STDARG_START:
return expand_builtin_va_start (arglist);
diff --git a/gcc/builtins.def b/gcc/builtins.def
index a813580..d8c772f 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -516,6 +516,7 @@ DEF_GCC_BUILTIN (BUILT_IN_EH_RETURN, "eh_return", BT_FN_VOID_PTRMODE_PTR,
DEF_GCC_BUILTIN (BUILT_IN_EH_RETURN_DATA_REGNO, "eh_return_data_regno", BT_FN_INT_INT, ATTR_NULL)
DEF_LIB_BUILTIN (BUILT_IN_EXIT, "exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_EXPECT, "expect", BT_FN_LONG_LONG_LONG, ATTR_NULL)
+DEF_GCC_BUILTIN (BUILT_IN_EXTEND_POINTER, "extend_pointer", BT_FN_WORD_PTR, ATTR_CONST_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_EXTRACT_RETURN_ADDR, "extract_return_addr", BT_FN_PTR_PTR, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_FRAME_ADDRESS, "frame_address", BT_FN_PTR_UNSIGNED, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_FROB_RETURN_ADDR, "frob_return_addr", BT_FN_PTR_PTR, ATTR_NULL)
diff --git a/gcc/except.c b/gcc/except.c
index 8c4c726..5d85e51 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3076,6 +3076,26 @@ expand_eh_return (void)
emit_label (around_label);
}
+
+/* Convert a ptr_mode address ADDR_TREE to a Pmode address controlled by
+ POINTERS_EXTEND_UNSIGNED and return it. */
+
+rtx
+expand_builtin_extend_pointer (tree addr_tree)
+{
+ rtx addr = expand_expr (addr_tree, NULL_RTX, ptr_mode, 0);
+ int extend;
+
+#ifdef POINTERS_EXTEND_UNSIGNED
+ extend = POINTERS_EXTEND_UNSIGNED;
+#else
+ /* The previous EH code did an unsigned extend by default, so we do this also
+ for consistency. */
+ extend = 1;
+#endif
+
+ return convert_modes (word_mode, ptr_mode, addr, extend);
+}
/* In the following functions, we represent entries in the action table
as 1-based indices. Special cases are:
diff --git a/gcc/except.h b/gcc/except.h
index 75bbd6f..5093a65 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -117,6 +117,7 @@ extern rtx expand_builtin_frob_return_addr (tree);
extern rtx expand_builtin_dwarf_sp_column (void);
extern void expand_builtin_eh_return (tree, tree);
extern void expand_eh_return (void);
+extern rtx expand_builtin_extend_pointer (tree);
extern rtx get_exception_pointer (struct function *);
extern int duplicate_eh_regions (struct function *, struct inline_remap *);