https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92891
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Some offsets are narrower than others but sizes returned either by compute_objsize() or by compute_builtin_object_size() should always be sizetype. The wide_int APIs helpful abort when their arguments don't have the same precision. I fixed a bunch of problems of this kind before committing the patch by making sure that sizes are all sizetype and converting offsets to the same precision, but clearly not all of them. I have this change in my local copy: @@ -3826,8 +3827,14 @@ compute_objsize (tree dest, int ostype, tree *pdecl /* = NULL */, if (is_gimple_call (stmt)) { /* If STMT is a call to an allocation function get the size - from its argument(s). */ - return gimple_call_alloc_size (stmt); + from its argument(s). If successful, also set *PDECL to + DEST for the caller to include in diagnostics. */ + if (tree size = gimple_call_alloc_size (stmt)) + { + *pdecl = dest; + return fold_convert (sizetype, size); + } + return NULL_TREE; } if (!is_gimple_assign (stmt))