On Thu, Mar 09, 2017 at 11:25:49PM +0100, Marek Polacek wrote:
> We are crashing left and right with enumerators in attribute nonnull
> arguments.
> Albeit handle_nonnull_attribute calls default_conversion to accept various
> integer constants (default_conversion calls scalar_constant_value which can
> turn CONST_DECLs into INTEGER_CSTs), it doesn't save the converted result to
> the attribute list, so those CONST_DECLs will stay in the list. But the code
> later in the game assumes that the list only contains INTEGER_CSTs, which
> causes trouble (e.g. get_nonnull_operand).
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2017-03-09 Marek Polacek <[email protected]>
>
> PR c++/79962
> PR c++/79984
> * c-attribs.c (handle_nonnull_attribute): Save the result of default
> conversion to the attribute list.
>
> * c-c++-common/nonnull-3.c: New test.
> * g++.dg/Wnonnull3.C: New test.
And this was meant to go to g++.dg/warn/. I'll fix it up before committing.
Marek