http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46635
--- Comment #1 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org>
2010-11-24 15:49:22 UTC ---
As Joseph S. Myers bentioned in comment 1 of PR46633, if
TREE_STRING_LENGTH is considered to be measured in BITS_PER_UNIT
rather than TYPE_PRECISION (char_type_node), fix_string_type actually
has one BITS_PER_UNIT uses too few rather than three to many.
The only other place I came up with in c-common also requires even more
BITS_PER_UNIT:
@@ -8541,8 +8544,14 @@ fold_offsetof_1 (tree expr, tree stop_re
tree
fold_offsetof (tree expr, tree stop_ref)
{
+ tree size = fold_offsetof_1 (expr, stop_ref);
+
+ /* Convert in case a char is more than one unit. */
+ size
+ = size_binop (CEIL_DIV_EXPR, size,
+ size_int (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT));
/* Convert back from the internal sizetype to size_t. */
- return convert (size_type_node, fold_offsetof_1 (expr, stop_ref));
+ return convert (size_type_node, size);
}
/* Warn for A ?: C expressions (with B omitted) where A is a boolean