[PATCH] Have HasSideEffects() return false for __attribute__((const)) functions

Aaron Ballman aaron.ballman at gmail.com
Mon Mar 23 09:01:00 PDT 2015


On Mon, Mar 23, 2015 at 11:47 AM, Michael Kuperstein
<michael.m.kuperstein at intel.com> wrote:
> Also, there's something a bit odd about the warning text for an assume with side-effects.
>
> "the argument to '__assume' has side effects that will be discarded" suggests that only the side effects will be discarded.

Which is correct. The side effects are unevaluated, but __assume is
not. Think: sizeof(i++). i will not be incremented, but sizeof is
still evaluated and produces a result.

> This:
> (a) doesn't make a lot of sense to me, and
> (b) doesn't imply that nothing at all will be emitted.
> That is, for "assume(a > 0 && i++)", the warning would make me expect that what I ended up with was equivalent to "assume(a > 0)" or perhaps "assume(a > 0 && i)".

The latter is correct, not the former.

>
> Is this just a problem with how I'm reading the warning? If not, any suggestions for alternative text?

I'm not certain where the confusion lies, but if there is alternative
text that would be more clear, then great!

~Aaron

>
>
> http://reviews.llvm.org/D8548
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



More information about the cfe-commits mailing list