linux/tools
Linus Torvalds 474c90156c give up on gcc ilog2() constant optimizations
gcc-7 has an "optimization" pass that completely screws up, and
generates the code expansion for the (impossible) case of calling
ilog2() with a zero constant, even when the code gcc compiles does not
actually have a zero constant.

And we try to generate a compile-time error for anybody doing ilog2() on
a constant where that doesn't make sense (be it zero or negative).  So
now gcc7 will fail the build due to our sanity checking, because it
created that constant-zero case that didn't actually exist in the source
code.

There's a whole long discussion on the kernel mailing about how to work
around this gcc bug.  The gcc people themselevs have discussed their
"feature" in

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

but it's all water under the bridge, because while it looked at one
point like it would be solved by the time gcc7 was released, that was
not to be.

So now we have to deal with this compiler braindamage.

And the only simple approach seems to be to just delete the code that
tries to warn about bad uses of ilog2().

So now "ilog2()" will just return 0 not just for the value 1, but for
any non-positive value too.

It's not like I can recall anybody having ever actually tried to use
this function on any invalid value, but maybe the sanity check just
meant that such code never made it out in public.

Reported-by: Laura Abbott <labbott@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>,
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-03-02 12:17:22 -08:00
..
accounting
arch Merge branch 'x86-cpufeature-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-02-20 14:37:08 -08:00
build perf build: Add special fixdep cleaning rule 2017-02-17 16:04:38 -03:00
cgroup
firewire
gpio gpio-hammer: fix make consumer_label suitable to work on gpio-nails 2017-01-26 16:29:09 +01:00
hv Char/Misc driver patches for 4.10-rc1 2016-12-13 12:11:01 -08:00
iio iio: Add channel for Gravity 2017-01-05 13:02:25 +00:00
include give up on gcc ilog2() constant optimizations 2017-03-02 12:17:22 -08:00
kvm/kvm_stat
laptop
leds tools/leds: Add led_hw_brightness_mon program 2017-02-14 22:20:23 +01:00
lguest
lib Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-02-28 11:38:18 -08:00
net
nfsd
objtool objtool, modules: Discard objtool annotation sections for modules 2017-03-01 20:32:25 +01:00
pcmcia
perf Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-02-28 11:38:18 -08:00
power linux-kselftest-4.11-rc1 2017-02-25 15:32:53 -08:00
scripts tools: Suppress request for warning options not existent in clang 2017-02-14 10:34:35 -03:00
spi spi: spidev_test: Fix input file check when transferring file 2016-11-04 09:56:09 -06:00
testing Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax 2017-02-28 20:29:41 -08:00
thermal/tmon
time
usb USB: changes for v4.11 2017-01-26 15:36:28 +01:00
virtio tools/virtio/ringtest: tweaks for s390 2017-01-19 23:46:32 +02:00
vm tools/vm: add missing Makefile rules 2017-02-22 16:41:26 -08:00
Makefile tools/leds: Add uledmon program for monitoring userspace LEDs 2016-11-22 12:07:02 +01:00