2014-11-14 21:45 GMT+01:00 Jason Merrill <ja...@redhat.com>: > On 11/14/2014 03:41 PM, Kai Tietz wrote: >> >> - gcc_assert (val1->v.val_unsigned == DWARF2_ADDR_SIZE); >> + gcc_assert (val1->v.val_unsigned >> + == (unsigned HOST_WIDE_INT) DWARF2_ADDR_SIZE); > > > These changes should not be necessary; the warning should check the folded > versions of the operands so it can tell that the rhs is constant and > non-negative. > > Jason >
How so? DWARF2_ADDR_SIZE is a macro defined as '((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT'. This might be constant for some targets, but eg for x86_64 it isn't. For this it is '(TARGET_X32 ? 32 : BITS_PER_WORD)'. So this comparison isn't constant, even if we can detect here that all result-brances of the condition are constant and bigger then zero. I will take a look if I find code looking into condition-branches for checking value-range of it .... Kai