This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch PING^2: fix --enable-mapped-location build failures
- From: Per Bothner <per at bothner dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Mar 2005 16:57:42 -0800
- Subject: Patch PING^2: fix --enable-mapped-location build failures
- References: <420CF485.1000401@bothner.com> <42150A5E.9000708@bothner.com>
These patches fix various problems with boostrapping with
--enable-mapped-location. The orginal patch was posted 02/11.
Mark approved the C++ part, so I've checked that in.
No response on the other parts.
I have added two changes since then:
(1) The c_parser_for_statement is a fix for a local variable that may
be used uninitialized. I'm guessing the back-end doesn't catch that
when the location_t local is a structure as opposed to an int?
(2) I've ran into a problem dwarf2out.c crashing when passed a not-found
class. In mainline dwarf2out.c bypasses the class if DECL_IS_BUILTIN -
and a not-found class gets a zero line number. I think this is a jc1
bug, and I'm looking into it, but for now it's probably easiest to use
the old DECL_IS_BUILTIN definition.
As as inducement: As soon as I've checked this in, I'll post the
patches for correct column numbers of local variables, for C and C++.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2005-03-01 Per Bothner <per@bothner.com>
Various fixes to allow us to again build if --enable-mapped-location:
* c-decl.c (finish_function): Use SET_EXPR_LOCATION instead of
unavailable annotate_with_file_line, if USE_MAPPED_LOCATION.
* tree-cfg.c (remove_bb): If USE_MAPPED_LOCATION, change type of
local variable loc. Change logic appropriately.
* tree-vect-transform.c (vect_finish_stmt_generation): Use
EXPR_LOCATION rather than EXPR_LOCUS if USE_MAPPED_LOCATION.
* c-parser.c (c_parser_for_statement): Initialize loc variable.
* tree.h (DECL_IS_BUILTIN): Temporarily revert definition of
DECL_IS_BUILTIN in the USE_MAPPED_LOCATION because of jc1 issues.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.631
diff -u -p -r1.631 c-decl.c
--- c-decl.c 25 Feb 2005 23:20:35 -0000 1.631
+++ c-decl.c 2 Mar 2005 00:16:58 -0000
@@ -6335,7 +6335,11 @@ finish_function (void)
/* Hack. We don't want the middle-end to warn that this
return is unreachable, so put the statement on the
special line 0. */
+#ifdef USE_MAPPED_LOCATION
+ SET_EXPR_LOCATION (stmt, UNKNOWN_LOCATION);
+#else
annotate_with_file_line (stmt, input_filename, 0);
+#endif
}
}
}
Index: c-parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parser.c,v
retrieving revision 2.2
diff -u -p -r2.2 c-parser.c
--- c-parser.c 28 Feb 2005 19:22:26 -0000 2.2
+++ c-parser.c 2 Mar 2005 00:16:59 -0000
@@ -3760,7 +3760,7 @@ static void
c_parser_for_statement (c_parser *parser)
{
tree block, cond, incr, save_break, save_cont, body;
- location_t loc;
+ location_t loc = UNKNOWN_LOCATION;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR));
c_parser_consume_token (parser);
block = c_begin_compound_stmt (flag_isoc99);
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.152
diff -u -p -r2.152 tree-cfg.c
--- tree-cfg.c 28 Feb 2005 18:18:25 -0000 2.152
+++ tree-cfg.c 2 Mar 2005 00:17:08 -0000
@@ -2013,7 +2013,11 @@ static void
remove_bb (basic_block bb)
{
block_stmt_iterator i;
+#ifdef USE_MAPPED_LOCATION
+ source_location loc = UNKNOWN_LOCATION;
+#else
source_locus loc = 0;
+#endif
if (dump_file)
{
@@ -2052,15 +2056,15 @@ remove_bb (basic_block bb)
program that are indeed unreachable. */
if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_HAS_LOCATION (stmt) && !loc)
{
- source_locus t;
-
#ifdef USE_MAPPED_LOCATION
- t = EXPR_LOCATION (stmt);
+ if (EXPR_HAS_LOCATION (stmt))
+ loc = EXPR_LOCATION (stmt);
#else
+ source_locus t;
t = EXPR_LOCUS (stmt);
-#endif
if (t && LOCATION_LINE (*t) > 0)
loc = t;
+#endif
}
}
@@ -2068,10 +2072,11 @@ remove_bb (basic_block bb)
block is unreachable. We walk statements backwards in the
loop above, so the last statement we process is the first statement
in the block. */
- if (warn_notreached && loc)
#ifdef USE_MAPPED_LOCATION
+ if (warn_notreached && loc != UNKNOWN_LOCATION)
warning ("%Hwill never be executed", &loc);
#else
+ if (warn_notreached && loc)
warning ("%Hwill never be executed", loc);
#endif
Index: tree-vect-transform.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-transform.c,v
retrieving revision 2.2
diff -u -p -r2.2 tree-vect-transform.c
--- tree-vect-transform.c 1 Mar 2005 13:44:46 -0000 2.2
+++ tree-vect-transform.c 2 Mar 2005 00:17:10 -0000
@@ -661,7 +661,7 @@ vect_finish_stmt_generation (tree stmt,
#endif
#ifdef USE_MAPPED_LOCATION
- SET_EXPR_LOCATION (vec_stmt, EXPR_LOCUS (stmt));
+ SET_EXPR_LOCATION (vec_stmt, EXPR_LOCATION (stmt));
#else
SET_EXPR_LOCUS (vec_stmt, EXPR_LOCUS (stmt));
#endif
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.694
diff -u -p -r1.694 tree.h
--- tree.h 28 Feb 2005 18:18:26 -0000 1.694
+++ tree.h 2 Mar 2005 00:17:12 -0000
@@ -1957,7 +1957,11 @@ struct tree_binfo GTY (())
#define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus)
#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
-#ifdef USE_MAPPED_LOCATION
+#if 0
+/* Should be: #ifdef USE_MAPPED_LOCATION
+ However, there appears to be a jc1 bug that this would expose.
+ (It prevents bookstrapping because dwarf2out tries to emit a
+ non-found class.) FIXME. */
#define DECL_IS_BUILTIN(DECL) \
(DECL_SOURCE_LOCATION (DECL) <= BUILTINS_LOCATION)
#else