This is the mail archive of the
mailing list for the GCC project.
[lto] fix two spec issues
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com
- Date: Fri, 21 Dec 2007 07:17:29 -0800
- Subject: [lto] fix two spec issues
This patch fixes two issues with SPECint. The input_real fix is because
we'd occasionally the string table entry for the real we were supposed
to read would contain something like:
The indicated 3 did not belong to the hexadecimal float, but
real_from_string didn't know that and would happily read until it found
a non-decimal character. So we would occasionally read in numbers with
much larger exponents, with predictably bad results.
The input_expr_operand fix handles a case in 176.gcc:dwarfout.c where we
were faced with a construct like:
output_die (CONDITION ? output_one_way : output_differently, ...)
And OUTPUT_ONE_WAY and OUTPUT_DIFFERENTLY were never explicitly called
from anywhere else. cgraph would notice this and decide that the
functions weren't actually needed, leading to assembler errors.
Committed to the LTO branch.
2007-12-21 Nathan Froyd <firstname.lastname@example.org>
* lto-read.c (input_real): Use a separate null-terminated buffer
for calling real_from_string.
(input_expr_operand): If we take the address of a FUNCTION_DECL,
tell cgraph that it's needed.
--- lto/lto-read.c (revision 131119)
+++ lto/lto-read.c (working copy)
@@ -266,11 +266,16 @@ input_real (struct input_block *ib, stru
unsigned int len;
const char * str;
+ static char buffer;
loc = input_uleb128 (ib);
str = input_string_internal (data_in, loc, &len);
- real_from_string (&value, str);
+ /* Copy over to make sure real_from_string doesn't see peculiar
+ trailing characters in the exponent. */
+ memcpy (buffer, str, len);
+ buffer[len] = '\0';
+ real_from_string (&value, buffer);
return build_real (type, value);
@@ -1164,6 +1169,8 @@ input_expr_operand (struct input_block *
if (TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == PARM_DECL)
TREE_ADDRESSABLE (x) = 1;
+ else if (TREE_CODE (x) == FUNCTION_DECL)
+ cgraph_mark_needed_node (cgraph_node (x));