[Bug c++/42129] ICE in pointer difference with sizeof(int)>sizeof(void *)
froydnj at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 7 00:06:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42129
Nathan Froyd <froydnj at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-11-07
Ever Confirmed|0 |1
--- Comment #2 from Nathan Froyd <froydnj at gcc dot gnu.org> 2011-11-07 00:06:11 UTC ---
I can confirm that the problem still happens with the given options (-mh -mn
-mint32). I don't know much about this target, but the equivalent C front-end
code has:
/* Determine integer type to perform computations in. This will usually
be the same as the result type (ptrdiff_t), but may need to be a wider
type if pointers for the address space are wider than ptrdiff_t. */
if (TYPE_PRECISION (restype) < TYPE_PRECISION (TREE_TYPE (op0)))
inttype = lang_hooks.types.type_for_size
(TYPE_PRECISION (TREE_TYPE (op0)), 0);
else
inttype = restype;
and uses that as the result of the division, with a conversion to restype
(ptrdiff_type_node) as in Paolo's patch.
I think it'd be better to try to make the C and C++ front-ends as close as
possible on this; I can try a patch that combines the above and Paolo's, but
I'm not sure I'd get to it before stage 1 closes.
More information about the Gcc-bugs
mailing list