aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2003-04-11 00:24:58 +0000
committerZack Weinberg <zack@gcc.gnu.org>2003-04-11 00:24:58 +0000
commit06790e5fd57528a3ee2822d392ff918c1c49abb7 (patch)
tree1fa5f9ae60027aff2b51248aca045b3cd343f3c3
parent5288c2a113d5dd42cecb9553edeb652616c77f8e (diff)
downloadgcc-06790e5fd57528a3ee2822d392ff918c1c49abb7.zip
gcc-06790e5fd57528a3ee2822d392ff918c1c49abb7.tar.gz
gcc-06790e5fd57528a3ee2822d392ff918c1c49abb7.tar.bz2
tree.c (tree_operand_check_failed): New function.
* tree.c (tree_operand_check_failed): New function. * tree.h (TREE_OPERAND_CHECK, TREE_OPERAND_CHECK_CODE, TREE_RTL_OPERAND_CHECK): New checking macros. (TREE_OPERAND, SAVE_EXPR_CONTEXT, SAVE_EXPR_RTL, RTL_EXPR_SEQUENCE, RTL_EXPR_RTL, WITH_CLEANUP_EXPR_RTL, CONSTRUCTOR_ELTS, LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY, EXIT_BLOCK_RETURN, LOOP_EXPR_BODY, EXPR_WFL_NODE, EXPR_WFL_FILENAME_NODE, EXPR_WFL_FILENAME, TARGET_EXPR_SLOT, TARGET_EXPR_INITIAL, TARGET_EXPR_CLEANUP): Use the new checking macros. From-SVN: r65452
-rw-r--r--gcc/ChangeLog31
-rw-r--r--gcc/tree.c16
-rw-r--r--gcc/tree.h77
3 files changed, 97 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 263bdc9..572d52a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2003-04-10 Zack Weinberg <zack@codesourcery.com>
+
+ * tree.c (tree_operand_check_failed): New function.
+ * tree.h (TREE_OPERAND_CHECK, TREE_OPERAND_CHECK_CODE,
+ TREE_RTL_OPERAND_CHECK): New checking macros.
+ (TREE_OPERAND, SAVE_EXPR_CONTEXT, SAVE_EXPR_RTL,
+ RTL_EXPR_SEQUENCE, RTL_EXPR_RTL, WITH_CLEANUP_EXPR_RTL,
+ CONSTRUCTOR_ELTS, LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY,
+ EXIT_BLOCK_RETURN, LOOP_EXPR_BODY, EXPR_WFL_NODE,
+ EXPR_WFL_FILENAME_NODE, EXPR_WFL_FILENAME, TARGET_EXPR_SLOT,
+ TARGET_EXPR_INITIAL, TARGET_EXPR_CLEANUP): Use the new
+ checking macros.
+
Thu Apr 10 23:52:30 CEST 2003 Jan Hubicka <jh@suse.cz>
PR inline-asm/8803
@@ -94,7 +107,7 @@ Thu Apr 10 23:52:30 CEST 2003 Jan Hubicka <jh@suse.cz>
(sched_analyze_insn): Ditto. Use anti-dependencies for
MOVE_BARRIER and true-dependencies as TRUE_BARRIER.
(init_deps_global): Initialize the barrier as NO_BARRIER.
-
+
2003-04-09 Vladimir Makarov <vmakarov@redhat.com>
* config/ia64/ia64.c (issue_nops_and_insn): Add new parameter.
@@ -135,7 +148,7 @@ Thu Apr 10 23:52:30 CEST 2003 Jan Hubicka <jh@suse.cz>
* config/arm/xscale-elf.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise,
but only if -msoft-float is specified pass. Otherwise pass
-mfpu=softvfp.
-
+
2003-04-09 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* function.c (purge_addressof): Use free_INSN_LIST_node instead of
@@ -171,7 +184,7 @@ Thu Apr 10 23:52:30 CEST 2003 Jan Hubicka <jh@suse.cz>
* function.c (postponed_insns): New.
(purge_addressof_1): Postpone processing of insns if addressofs
are not put into stack.
- (purge_addressof): Process postponed insns.
+ (purge_addressof): Process postponed insns.
2003-04-08 J"orn Rennecke <joern.rennecke@superh.com>
@@ -540,7 +553,7 @@ Mon Apr 7 14:36:24 CEST 2003 Jan Hubicka <jh@suse.cz>
handle_pch.
(c_common_write_pch): Call handle_pch.
(c_common_read_pch): Don't call start_source_file,
- or end_source_file.
+ or end_source_file.
Fri Apr 4 17:43:52 2003 Olivier Hainque <hainque@act-europe.fr>
@@ -585,7 +598,7 @@ Fri Apr 4 15:58:52 2003 J"orn Rennecke <joern.rennecke@superh.com>
* sh.c (fpscr_set_from_mem): Use ACTUAL_NORMAL_MODE.
2003-04-04 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
+
* doc/contrib.texi (Contributors): Add entries for Wolfgang
Bangerth, DJ Delorie, Christian Ehrhardt, Christopher Faylor,
Nathanael Nerode, Diego Novillo, Hartmut Penner, Volker Reichelt,
@@ -665,7 +678,7 @@ Thu Apr 3 22:27:40 CEST 2003 Jan Hubicka <jh@suse.cz>
(dwarf2out_source_line): Don't do anything if line==0.
* stor-layout.c (do_type_align): New fn, split out from...
- (layout_decl): ...here. Do all alignment calculations for
+ (layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
@@ -739,7 +752,7 @@ Thu Apr 3 00:31:21 CEST 2003 Jan Hubicka <jh@suse.cz>
Thu Apr 3 00:18:49 CEST 2003 Jan Hubicka <jh@suse.cz>
* i386.c (override_options): Disable red zone by default on i386.
- (compute_frame_layout, ix86_force_to_memory, ix86_free_from_memory):
+ (compute_frame_layout, ix86_force_to_memory, ix86_free_from_memory):
Do not test TARGET_64BIT together with TARGET_RED_ZONE
2003-04-02 Kazu Hirata <kazu@cs.umass.edu>
@@ -781,7 +794,7 @@ Thu Apr 3 00:18:49 CEST 2003 Jan Hubicka <jh@suse.cz>
Remove additional cycle in the reservation before retirement.
(ppc8540_mfcr, ppc8540_mtcrf, ppc8540_mtjmpr): Add missed
reservation of ppc8540_issue.
-
+
2003-04-02 Andreas Schwab <schwab@suse.de>
* real.c (decode_ieee_single): Fix decoding of SNaN bit.
@@ -1839,7 +1852,7 @@ Mon Mar 24 20:03:03 CET 2003 Jan Hubicka <jh@suse.cz>
operands in case MULT_EXPR of 2003-02-16 patch.
2003-03-20 Daniel Berlin <dberlin@dberlin.org>
- Merge changes from new-regalloc-branch
+ Merge changes from new-regalloc-branch
From Michael Matz <matz@suse.de>
* df.c (df_ref_record_1): Move init of loc to safe point.
diff --git a/gcc/tree.c b/gcc/tree.c
index ecee8f3..57d76b4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4587,6 +4587,22 @@ tree_vec_elt_check_failed (idx, len, file, line, function)
idx + 1, len, function, trim_filename (file), line);
}
+/* Similar to above, except that the check is for the bounds of the operand
+ vector of an expression node. */
+
+void
+tree_operand_check_failed (idx, code, file, line, function)
+ int idx;
+ enum tree_code code;
+ const char *file;
+ int line;
+ const char *function;
+{
+ internal_error
+ ("tree check: accessed operand %d of %s with %d operands in %s, at %s:%d",
+ idx + 1, tree_code_name[code], TREE_CODE_LENGTH (code),
+ function, trim_filename (file), line);
+}
#endif /* ENABLE_TREE_CHECKING */
/* For a new vector type node T, build the information necessary for
diff --git a/gcc/tree.h b/gcc/tree.h
index e276a87..b4a6703 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -324,6 +324,40 @@ struct tree_common GTY(())
__FILE__, __LINE__, __FUNCTION__); \
&__t->vec.a[__i]; }))
+/* Special checks for TREE_OPERANDs. */
+#define TREE_OPERAND_CHECK(t, i) __extension__ \
+(*({const tree __t = EXPR_CHECK(t); \
+ const int __i = (i); \
+ if (__i < 0 || __i >= TREE_CODE_LENGTH (TREE_CODE (__t))) \
+ tree_operand_check_failed (__i, TREE_CODE (__t), \
+ __FILE__, __LINE__, __FUNCTION__); \
+ &__t->exp.operands[__i]; }))
+
+#define TREE_OPERAND_CHECK_CODE(t, code, i) __extension__ \
+(*({const tree __t = t; \
+ const int __i = (i); \
+ const enum tree_code __code = code; \
+ if (TREE_CODE (__t) != __code) \
+ tree_check_failed (__t, __code, \
+ __FILE__, __LINE__, __FUNCTION__); \
+ if (__i < 0 || __i >= TREE_CODE_LENGTH (__code)) \
+ tree_operand_check_failed (__i, __code, \
+ __FILE__, __LINE__, __FUNCTION__); \
+ &__t->exp.operands[__i]; }))
+
+#define TREE_RTL_OPERAND_CHECK(t, code, i) __extension__ \
+(*(rtx *) \
+ ({const tree __t = t; \
+ const int __i = (i); \
+ const enum tree_code __code = code; \
+ if (TREE_CODE (__t) != __code) \
+ tree_check_failed (__t, __code, \
+ __FILE__, __LINE__, __FUNCTION__); \
+ if (__i < 0 || __i >= TREE_CODE_LENGTH (__code)) \
+ tree_operand_check_failed (__i, __code, \
+ __FILE__, __LINE__, __FUNCTION__); \
+ &__t->exp.operands[__i]; }))
+
extern void tree_check_failed PARAMS ((const tree, enum tree_code,
const char *, int, const char *))
ATTRIBUTE_NORETURN;
@@ -334,6 +368,10 @@ extern void tree_vec_elt_check_failed PARAMS ((int, int, const char *,
int, const char *))
ATTRIBUTE_NORETURN;
+extern void tree_operand_check_failed PARAMS ((int, enum tree_code,
+ const char *, int, const char *))
+ ATTRIBUTE_NORETURN;
+
#else /* not ENABLE_TREE_CHECKING, or not gcc */
#define TREE_CHECK(t, code) (t)
@@ -341,6 +379,9 @@ extern void tree_vec_elt_check_failed PARAMS ((int, int, const char *,
#define CST_OR_CONSTRUCTOR_CHECK(t) (t)
#define EXPR_CHECK(t) (t)
#define TREE_VEC_ELT_CHECK(t, i) ((t)->vec.a[i])
+#define TREE_OPERAND_CHECK(t, i) ((t)->exp.operands[i])
+#define TREE_OPERAND_CHECK_CODE(t, code, i) ((t)->exp.operands[i])
+#define TREE_RTL_OPERAND_CHECK(t, code, i) (*(rtx *) &((t)->exp.operands[i]))
#endif
@@ -826,8 +867,9 @@ struct tree_vec GTY(())
/* Define fields and accessors for some nodes that represent expressions. */
/* In a SAVE_EXPR node. */
-#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND (SAVE_EXPR_CHECK (NODE), 1)
-#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
+#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND_CHECK_CODE (NODE, SAVE_EXPR, 1)
+#define SAVE_EXPR_RTL(NODE) TREE_RTL_OPERAND_CHECK (NODE, SAVE_EXPR, 2)
+
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
both in normal code and in a handler. (Normally, in a handler, all
@@ -836,42 +878,41 @@ struct tree_vec GTY(())
#define SAVE_EXPR_PERSISTENT_P(NODE) TREE_ASM_WRITTEN (SAVE_EXPR_CHECK (NODE))
/* In a RTL_EXPR node. */
-#define RTL_EXPR_SEQUENCE(NODE) \
- (*(rtx *) &RTL_EXPR_CHECK (NODE)->exp.operands[0])
-#define RTL_EXPR_RTL(NODE) (*(rtx *) &RTL_EXPR_CHECK (NODE)->exp.operands[1])
+#define RTL_EXPR_SEQUENCE(NODE) TREE_RTL_OPERAND_CHECK (NODE, RTL_EXPR, 0)
+#define RTL_EXPR_RTL(NODE) TREE_RTL_OPERAND_CHECK (NODE, RTL_EXPR, 1)
/* In a WITH_CLEANUP_EXPR node. */
#define WITH_CLEANUP_EXPR_RTL(NODE) \
- (*(rtx *) &WITH_CLEANUP_EXPR_CHECK (NODE)->exp.operands[2])
+ TREE_RTL_OPERAND_CHECK (NODE, WITH_CLEANUP_EXPR, 2)
/* In a CONSTRUCTOR node. */
-#define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (CONSTRUCTOR_CHECK (NODE), 1)
+#define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND_CHECK_CODE (NODE, CONSTRUCTOR, 1)
/* In ordinary expression nodes. */
-#define TREE_OPERAND(NODE, I) (EXPR_CHECK (NODE)->exp.operands[I])
+#define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I)
#define TREE_COMPLEXITY(NODE) (EXPR_CHECK (NODE)->exp.complexity)
/* In a LABELED_BLOCK_EXPR node. */
#define LABELED_BLOCK_LABEL(NODE) \
- TREE_OPERAND (LABELED_BLOCK_EXPR_CHECK (NODE), 0)
+ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0)
#define LABELED_BLOCK_BODY(NODE) \
- TREE_OPERAND (LABELED_BLOCK_EXPR_CHECK (NODE), 1)
+ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 1)
/* In an EXIT_BLOCK_EXPR node. */
#define EXIT_BLOCK_LABELED_BLOCK(NODE) \
- TREE_OPERAND (EXIT_BLOCK_EXPR_CHECK (NODE), 0)
-#define EXIT_BLOCK_RETURN(NODE) TREE_OPERAND (EXIT_BLOCK_EXPR_CHECK (NODE), 1)
+ TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 0)
+#define EXIT_BLOCK_RETURN(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 1)
/* In a LOOP_EXPR node. */
-#define LOOP_EXPR_BODY(NODE) TREE_OPERAND (LOOP_EXPR_CHECK (NODE), 0)
+#define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
/* In an EXPR_WITH_FILE_LOCATION node. */
#define EXPR_WFL_EMIT_LINE_NOTE(NODE) \
(EXPR_WITH_FILE_LOCATION_CHECK (NODE)->common.public_flag)
#define EXPR_WFL_NODE(NODE) \
- TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 0)
+ TREE_OPERAND_CHECK_CODE (NODE, EXPR_WITH_FILE_LOCATION, 0)
#define EXPR_WFL_FILENAME_NODE(NODE) \
- TREE_OPERAND (EXPR_WITH_FILE_LOCATION_CHECK (NODE), 1)
+ TREE_OPERAND_CHECK_CODE (NODE, EXPR_WITH_FILE_LOCATION, 1)
#define EXPR_WFL_FILENAME(NODE) \
IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (NODE))
/* ??? Java uses this in all expressions. */
@@ -882,9 +923,9 @@ struct tree_vec GTY(())
(EXPR_WFL_LINECOL(NODE) = ((LINE) << 12) | ((COL) & 0xfff))
/* In a TARGET_EXPR node. */
-#define TARGET_EXPR_SLOT(NODE) TREE_OPERAND (TARGET_EXPR_CHECK (NODE), 0)
-#define TARGET_EXPR_INITIAL(NODE) TREE_OPERAND (TARGET_EXPR_CHECK (NODE), 1)
-#define TARGET_EXPR_CLEANUP(NODE) TREE_OPERAND (TARGET_EXPR_CHECK (NODE), 2)
+#define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0)
+#define TARGET_EXPR_INITIAL(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 1)
+#define TARGET_EXPR_CLEANUP(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 2)
struct tree_exp GTY(())
{