r315614 - [Sema] Diagnose tautological comparison with type's min/max values

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 14:35:08 PST 2017


On Tue, Nov 14, 2017 at 1:27 AM, Hans Wennborg <hans at chromium.org> wrote:
> On Sat, Nov 11, 2017 at 4:18 AM, Roman Lebedev <lebedev.ri at gmail.com> wrote:
>> On Fri, Nov 10, 2017 at 9:14 PM, Hans Wennborg <hans at chromium.org> wrote:
>>> On Thu, Oct 12, 2017 at 2:33 PM, Roman Lebedev via cfe-commits
>>> <cfe-commits at lists.llvm.org> wrote:
>>>> On Fri, Oct 13, 2017 at 12:12 AM, Nico Weber <thakis at chromium.org> wrote:
>>>>> Huh, I consider clang not warning on this a feature, not a bug. Why are we
>>>>> trying to match what gcc does here?
>>>> Because i have been bitten by this more than once.
>>>> It did result in big amount of wasted time, and this "thread":
>>>> https://lists.llvm.org/pipermail/llvm-dev/2017-August/116390.html
>>>>
>>>> As with all the clang diagnostics, you can disable them
>>>> I personally don't have any opinion on comparisons with
>>>> std::numeric_limits<...>::{min,max}()
>>
>>> To disable the new warning
>> Will the https://reviews.llvm.org/D39462 address the reasons for disabling it?
>
> Maybe..
>
> One of the first warnings we saw was on code like:
>
> if (static_cast<uint64_t>(aligned_size) >
> std::numeric_limits<size_t>::max()) { /* raise an error */ }

> From the description of your change, it sounds like it wouldn't warn
> on this anymore?
I believe so. You have explicitly-differently-spelled types on both of
the sides.

At least that is the idea, as the review shows,
the current proposed code needs work...


More information about the cfe-commits mailing list