On Jun 30, 2014, at 12:50 PM, Jeff Law <l...@redhat.com> wrote: > On 03/04/14 09:40, Marek Polacek wrote: >> This should fix ICE on insane alignment. Normally, check_user_alignment >> detects e.g. alignment 1 << 32, but not 1 << 28. However, record_align >> is in bits, so it's actually 8 * (1 << 28) and that's greater than >> INT_MAX. This patch rejects such code. >> >> In the middle hunk, we should give up when an error occurs, we don't >> want to call finalize_type_size in that case -- we'd ICE in there. >> >> Regtested/bootstrapped on x86_64-linux, ok for trunk? >> >> 2014-03-04 Marek Polacek <pola...@redhat.com> >> >> PR middle-end/60226 >> * stor-layout.c (layout_type): Return if alignment of array elements >> is greater than element size. Error out if requested alignment is too >> large. >> cp/ >> * class.c (layout_class_type): Error out if requested alignment is too >> large. >> testsuite/ >> * c-c++-common/pr60226.c: New test. > Is this still applicable after the wide-int changes? I haven't looked > closely.
I glanced at it: (gdb) p/x TYPE_ALIGN (type) $1 = 2147483648 (gdb) p/x TYPE_ALIGN (type) $2 = 0x80000000 The callee is int, the caller uses unsigned int. The assert I see is because the routines are not type correct: => TYPE_SIZE (type) = round_up (TYPE_SIZE (type), TYPE_ALIGN (type)); (gdb) ptype TYPE_ALIGN (type) type = unsigned int tree round_up_loc (location_t loc, tree value, int divisor) { tree div = NULL_TREE; =>gcc_assert (divisor > 0); Would be nice if the routine was type correct (wrt unsigned).