On 11/20/2017 04:03 PM, Jakub Jelinek wrote:
Hi!
Not all INTEGER_CSTs satisfy tree_fits_uhwi_p, and those that don't
ICE in tree_to_uhwi. But, what the memmodel_base function actually
does is mask only the 16 low bits, the upper bits are reserved for
target dependent flags and -Winvalid-memory-model already warns
about those during expansion. So it makes no sense to warn about say
(-1 << 16) here, thus I'm using TREE_INT_CST_LOW instead of tree_to_*hwi,
because we really care just about the low 16 bits thereof.
- int i = tree_to_uhwi (p);
- if (i < 0 || (memmodel_base (i) >= MEMMODEL_LAST))
- {
- warning_at (loc, OPT_Winvalid_memory_model,
- "invalid memory model argument %d of %qE", x + 1,
- function);
- }
+ if (memmodel_base (TREE_INT_CST_LOW (p)) >= MEMMODEL_LAST)
+ warning_at (loc, OPT_Winvalid_memory_model,
+ "invalid memory model argument %d of %qE", x + 1,
+ function);
Ok with a comment mentioning memmodel_base only looks at low-order bits.
nathan
--
Nathan Sidwell