On 07/03/14 04:18, Marek Polacek wrote:
On Mon, Jun 30, 2014 at 03:40:18PM -0700, Mike Stump wrote:
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).
Yeah, I did that. One issue with that is that round_up now wraps
the value, so I had to add a check for huge size before rounding up,
otherwise we'd regress on e.g. PR42611.
How about the following?
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2014-07-03 Marek Polacek <pola...@redhat.com>
PR c/60226
* fold-const.c (round_up_loc): Change the parameter type.
Remove assert.
* fold-const.h (round_up_loc): Adjust declaration.
* stor-layout.c (finalize_record_size): Check for too large types.
* c-c++-common/pr60226.c: New test.
OK.
Jeff