[Bug tree-optimization/34127] [4.3 Regression] ICE: tree-ssa-operands.c:1688
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Nov 18 13:53:00 GMT 2007
------- Comment #5 from rguenth at gcc dot gnu dot org 2007-11-18 13:53 -------
Hm, this is an unlucky case because of the way fold_stmt works. What we have
is
(even more simplified):
void prepare_s(const char *fmt)
{
char ** f = (char **)&fmt;
*f = 0;
}
where it is not hard to see that for the store we can substitute
fmt = 0;
as a char * rhs can be trivially converted to a const char * lhs.
Now what happens is that forwprop decides for this reason that a
propagation of (char **)&fmt is worthwhile and asks fold_stmt_in_place
to fold
*(char **)&fmt = 0;
now the path goes through maybe_fold_stmt_indirect which only strips
same-type conversions (STRIP_TYPE_NOPS) and so fails to dispatch to
maybe_fold_offset_to_reference. Now, if we strip the conversion in
forwprop already then in turn maybe_fold_offset_to_reference fails to
do the conversion because it (even while it would strip all conversions)
asks if the conversion from const char * to char * is useless (which
it is not) and refuses to do the trivial folding.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34127
More information about the Gcc-bugs
mailing list