This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa mudflap] missing locus
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 Jan 2004 13:14:35 -0500
- Subject: [tree-ssa mudflap] missing locus
Hi -
The following patch lets mudflap not choke on gimple nodes
coming from optimization passes that don't fill in the
EXPR_LOCUS fields for all relevant nodes they synthesize.
I haven't found a small test case for this though.
+2004-01-19 Frank Ch. Eigler <fche@redhat.com>
+
+ * tree-mudflap.c (mf_build_check_statement_for): Tolerate
+ incoming locus NULL pointer.
+
Index: tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-mudflap.c,v
retrieving revision 1.1.2.67
diff -u -w -s -p -r1.1.2.67 tree-mudflap.c
--- tree-mudflap.c 15 Jan 2004 22:46:52 -0000 1.1.2.67
+++ tree-mudflap.c 19 Jan 2004 18:04:17 -0000
@@ -397,6 +397,7 @@ mf_file_function_line_tree (location_t *
tree result;
/* Add FILENAME. */
+ if (locus != NULL)
file = locus->file;
if (file == NULL && current_function_decl != NULL_TREE)
file = DECL_SOURCE_FILE (current_function_decl);
@@ -404,7 +405,7 @@ mf_file_function_line_tree (location_t *
file = "<unknown file>";
/* Add :LINENUMBER. */
- if (locus->line > 0)
+ if (locus != NULL && locus->line > 0)
{
sprintf (linebuf, "%d", locus->line);
colon = ":";
@@ -448,6 +449,7 @@ mf_build_check_statement_for (tree addr,
/* Build: __mf_value = <address expression>. */
stmt = build (MODIFY_EXPR, void_type_node, mf_value, addr);
+ if (locus != NULL)
annotate_with_locus (stmt, *locus);
gimplify_stmt (&stmt);
tsi_link_before (iter, stmt, TSI_SAME_STMT);
@@ -455,6 +457,7 @@ mf_build_check_statement_for (tree addr,
/* Build: __mf_base = (uintptr_t)__mf_value. */
stmt = build (MODIFY_EXPR, void_type_node, mf_base,
build1 (NOP_EXPR, mf_uintptr_type, mf_value));
+ if (locus != NULL)
annotate_with_locus (stmt, *locus);
gimplify_stmt (&stmt);
tsi_link_before (iter, stmt, TSI_SAME_STMT);
@@ -470,6 +473,7 @@ mf_build_check_statement_for (tree addr,
mf_cache_array_decl, t);
t = build1 (ADDR_EXPR, mf_cache_structptr_type, t);
stmt = build (MODIFY_EXPR, void_type_node, mf_elem, t);
+ if (locus != NULL)
annotate_with_locus (stmt, *locus);
gimplify_stmt (&stmt);
tsi_link_before (iter, stmt, TSI_SAME_STMT);
@@ -534,6 +538,7 @@ mf_build_check_statement_for (tree addr,
}
stmt = build (COND_EXPR, void_type_node, cond, stmt, build_empty_stmt ());
+ if (locus != NULL)
annotate_with_locus (stmt, *locus);
gimplify_to_stmt_list (&stmt);
lower_stmt_body (stmt, NULL);