Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588133

Re: gcc7 log2 compile issues in kernel/time/timekeeping.c

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: gcc7 log2 compile issues in kernel/time/timekeeping.c
Date 2017-02-25 13:00 +0100
Message-ID <teJb3-7dx-1@gated-at.bofh.it> (permalink)
References (3 earlier) <texCV-7wi-5@gated-at.bofh.it> <teFKa-4VJ-5@gated-at.bofh.it> <teGGd-5Fx-1@gated-at.bofh.it> <teIyl-6Ye-1@gated-at.bofh.it> <teIRI-74O-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> On 25 Feb 2017, at 11:23, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> 
> On 25 February 2017 at 11:09, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
>> On 2017.02.25 at 09:11 +0000, Ard Biesheuvel wrote:
>>>> On 25 February 2017 at 08:18, Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
>>>> 
>>>> Why not simply get rid of the ____ilog2_NaN thing altogether?
>>>> 
>>> 
>>> That would remove the issue, sure. But we lose an opportunity to spot
>>> incorrect code at compile time.
>> 
>> In the case of kernel/time/timekeeping.c it is clearly a false positive.
>> Was ever incorrect code spotted by ____ilog2_NaN in the past?
>> 
>>> My concern is that it by not pushing back on changes to the semantics
>>> of __builtin_constant_p() such as this one, we may start seeing other
>>> issues where we can no longer use it, and we lose a very useful tool.
>> 
>> We had a long discussion in:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
>> As you can see there is no real consensus.
>> But ilog2 seems to be the only place where this ever popped up.
>> (There were several distro-wide mass rebuilds with gcc-7 and no other
>> __builtin_constant_p() issue was found yet.)
>> 
> 
> Well, given that it is really dead code that is being emitted, and
> that log2(0) is really undefined, perhaps we should simply replace
> ilog2_NaN() with __builtin_unreachable()?

... or perhaps it is better to just pass the constant == 0 to the runtime implementation?

The second ilog2_NaN is really unreachable, given that it deals with unsigned values >0 without a single bit set.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: gcc7 log2 compile issues in kernel/time/timekeeping.c John Stultz <john.stultz@linaro.org> - 2017-02-24 22:30 +0100
  Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-24 22:50 +0100
    Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Laura Abbott <labbott@redhat.com> - 2017-02-25 00:40 +0100
      Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-02-25 09:20 +0100
        Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-25 10:20 +0100
          Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-02-25 12:20 +0100
            Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-25 12:40 +0100
              Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-25 13:00 +0100
                Re: gcc7 log2 compile issues in kernel/time/timekeeping.c Laura Abbott <labbott@redhat.com> - 2017-03-01 02:20 +0100

csiph-web