builtins.c (c_getstr): Correct thinko in last change and further cleanup.

* builtins.c (c_getstr): Correct thinko in last change and further
	cleanup.

From-SVN: r45519
This commit is contained in:
Richard Kenner 2001-09-10 20:23:35 +00:00 committed by Richard Kenner
parent a623ef6e71
commit bf06b5d841
2 changed files with 12 additions and 14 deletions

View File

@ -1,3 +1,8 @@
Mon Sep 10 16:26:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* builtins.c (c_getstr): Correct thinko in last change and further
cleanup.
2001-09-10 Tim Freeman <tim@fungibole.com>
* dwarf2out.c (incomplete_types, decl_scope_table): Make them

View File

@ -296,29 +296,22 @@ c_getstr (src)
{
tree offset_node;
HOST_WIDE_INT offset;
int max;
const char *ptr;
src = string_constant (src, &offset_node);
if (src == 0)
return 0;
max = TREE_STRING_LENGTH (src) - 1;
ptr = TREE_STRING_POINTER (src);
if (offset_node == 0 || !host_integerp (offset_node, 0))
return ptr;
offset = tree_low_cst (offset_node, 0);
if (offset < 0 || offset > max)
if (offset_node == 0)
return TREE_STRING_POINTER (src);
else if (!host_integerp (offset_node, 1)
|| compare_tree_int (offset_node, TREE_STRING_LENGTH (src) - 1) > 0)
return 0;
return ptr + offset;
return TREE_STRING_POINTER (src) + tree_low_cst (offset_node, 1);
}
/* Return a CONST_INT or CONST_DOUBLE corresponding to target
reading GET_MODE_BITSIZE (MODE) bits from string constant
STR. */
/* Return a CONST_INT or CONST_DOUBLE corresponding to target reading
GET_MODE_BITSIZE (MODE) bits from string constant STR. */
static rtx
c_readstr (str, mode)