Messages in this thread | | | From | Arnd Bergmann <> | Date | Mon, 11 May 2020 13:11:53 +0200 | Subject | Re: I disabled more compiler warnings.. |
| |
On Mon, May 11, 2020 at 11:03 AM Arnd Bergmann <arnd@arndb.de> wrote: > > - There is a good chance that some trivial difference between > mainline and linux-next, or between linux-next and my test > branch (with a couple hundred fixup patches) is causing you > to see many warnings that I don't get. I'll try to reproduce and > bisect what I find.
Update: I found a bug in my own patches, one of them tried to disable the warning when CONFIG_GCOV_PROFILE_ALL is turned on, as that caused some false positives. Unfortunately I ended up turning it off unconditionally by testing for CONFIG_ARCH_HAS_GCOV_PROFILE_ALL instead.
I do see 36 such errors in my tree now with gcc-10 x86 allmodconfig, and there are probably a couple more in your tree that I had already fixed locally, e.g. when clang found the same thing. See full (abbreviated) list below.
Looking at some of those warnings, I find a roughly 50:50 split between code that gcc should have warned about all along when there is a path in which a variable is actually used without initialization (which may be impossible for reasons the compiler cannot know), and code that looks correct to me, but I can see exactly how gcc gets confused, especially now that it warns about the first class. It should be possible to avoid these 36 warnings while making the code more readable in most cases, or adding fake initializations for false positives without a better workaround.
For -O3, there are many more warnings (225 total in my tree), with additional valid bugs but also a higher ratio of false positives in the samples I looked at. gcc-9 -O3 had additional false positives and also a few extra somewhat sensible warnings, 273 warnings in total, though these had always been disabled already.
For the default -O2, gcc-9 prints only the three warnings from kernel/trace/ftrace.c, all of which are false positives that the compiler should have not warned about IMO.
Arnd
8<--- /* x86 allmodconfig gcc-10 -O2 warnings */ arch/x86/kvm/../../../virt/kvm/kvm_main.c:2441:42: error: 'nr_pages_avail' may be used uninitialized drivers/video/fbdev/i740fb.c:332:9: error: 'wm' may be used uninitialized lib/zstd/decompress.c:303:6: error: 'fParams.windowSize' may be used uninitialized lib/zstd/decompress.c:342:8: error: 'fParams.frameContentSize' may be used uninitialized kernel/trace/ftrace.c:7156:8: error: 'seq_ops' may be used uninitialized kernel/trace/ftrace.c:7234:8: error: 'filtered_pids' may be used uninitialized kernel/trace/ftrace.c:7251:22: error: 'other_pids' may be used uninitialized drivers/i3c/device.c:227:41: error: 'devinfo.dcr' may be used uninitialized include/linux/i3c/device.h:80:49: error: 'devinfo.pid' may be used uninitialized fs/ext4/ext4_extents.h:226:8: error: 'zero_ex1.ee_start_lo' may be used uninitialized fs/ext4/ext4_extents.h:227:12: error: 'zero_ex1.ee_start_hi' may be used uninitialized fs/ext4/extents.c:3083:9: error: 'zero_ex1.ee_block' may be used uninitialized drivers/input/touchscreen/hideep.c:373:14: error: 'unmask_code' may be used uninitialized drivers/media/i2c/tvp7002.c:691:11: error: 'val' may be used uninitialized include/linux/spinlock.h:289:3: error: 'flags' may be used uninitialized drivers/gpu/drm/amd/amdgpu/df_v3_6.c:571:2: error: 'hi_base_addr' may be used uninitialized drivers/gpu/drm/amd/amdgpu/df_v3_6.c:571:2: error: 'lo_base_addr' may be used uninitialized drivers/gpu/drm/i915/gt/selftest_lrc.c:2959:28: error: 'rq' may be used uninitialized drivers/gpu/drm/i915/gt/selftest_workarounds.c:492:17: error: 'rsvd' may be used uninitialized drivers/firmware/arm_scmi/driver.c:502:12: error: 't' may be used uninitialized drivers/usb/serial/cp210x.c:948:8: error: 'bits' may be used uninitialized drivers/usb/serial/cp210x.c:1194:8: error: 'bits' may be used uninitialized drivers/platform/x86/acer-wmi.c:1440:9: error: 'value' may be used uninitialized drivers/net/wireless/rsi/rsi_91x_sdio.c:1340:7: error: 'data' may be used uninitialized drivers/net/wireless/rsi/rsi_91x_sdio.c:238:12: error: 'resp' may be used uninitialized drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c:160:45: error: 'stat' may be used uninitialized drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c:160:45: error: 'stat' may be used uninitialized drivers/ata/ahci_imx.c:369:30: error: 'dac_ctl_reg' may be used uninitialized drivers/ata/ahci_imx.c:377:33: error: 'rtune_ctl_reg' may be used uninitialized drivers/ata/ahci_imx.c:375:42: error: 'mpll_test_reg' may be used uninitialized include/linux/printk.h:360:2: error: 'abs_ppfid' may be used uninitialized drivers/media/dvb-frontends/drxk_hard.c:1026:5: error: 'wait_cmd' may be used uninitialized drivers/iio/imu/bmi160/bmi160_core.c:577:47: error: 'int_out_ctrl_shift' may be used uninitialized include/linux/dev_printk.h:104:2: error: 'pin_name' may be used uninitialized drivers/iio/imu/bmi160/bmi160_core.c:606:8: error: 'int_map_mask' may be used uninitialized drivers/iio/imu/bmi160/bmi160_core.c:599:8: error: 'int_latch_mask' may be used uninitialized
| |