https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
Keywords| |diagnostic
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Most warnings designed to detect invalid accesses (not just -Wstringop-overread
but also -Wstringop-overflow and -Wformat-overflow/-truncation, -Wrestrict, and
some forms of -Warray-bounds) use the same underlying code to determine the
identity of the accessed object, so they all should trigger if they see a
constant address.
But I tested the warning with the kernel when I implemented it months ago and
don't think I saw any instances of it (though I don't see sharpsl_param in any
of my logs). I still don't. How many do you see?
Here's the list of -Wstringop- warnings in my fresh build but I'm never sure I
use the right target. Is allyesconfig the right one?
$ grep Wstringop-over /src/linux-stable/gcc-master.log
arch/x86/mm/pgtable.c:437:13: warning: ‘preallocate_pmds.constprop’ accessing 8
bytes in a region of size 0 [-Wstringop-overflow=]
arch/x86/mm/pgtable.c:440:13: warning: ‘preallocate_pmds.constprop’ accessing 8
bytes in a region of size 0 [-Wstringop-overflow=]
arch/x86/mm/pgtable.c:462:9: warning: ‘free_pmds.constprop’ accessing 8 bytes
in a region of size 0 [-Wstringop-overflow=]
arch/x86/mm/pgtable.c:455:9: warning: ‘pgd_prepopulate_user_pmd’ accessing 8
bytes in a region of size 0 [-Wstringop-overflow=]
arch/x86/mm/pgtable.c:464:9: warning: ‘free_pmds.constprop’ accessing 8 bytes
in a region of size 0 [-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
mm/mempolicy.c:3001:26: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
drivers/gpu/drm/i915/intel_pm.c:3093:9: warning: ‘intel_read_wm_latency’
accessing 16 bytes in a region of size 10 [-Wstringop-overflow=]
drivers/gpu/drm/i915/intel_pm.c:3057:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3058:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3059:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3086:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3087:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3088:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3103:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3104:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/intel_pm.c:3105:9: warning: ‘intel_print_wm_latency’
reading 16 bytes from a region of size 10 [-Wstringop-overread]
drivers/gpu/drm/i915/display/intel_dp.c:4556:22: warning:
‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4
[-Wstringop-overread]
The full breakdown with the warnings forcefully disabled in the top-level
Makefile re-enabled is below:
Diagnostic Count Unique Files
-Wmissing-prototypes 759 248 114
-Wunused-const-variable= 391 233 31
-Wformat-truncation= 311 297 229
-Wmaybe-uninitialized 158 133 103
-Wunused-but-set-variable 143 137 88
-Warray-bounds 94 32 12
-Wzero-length-bounds 69 66 16
-Wsuggest-attribute=format 60 26 21
-Wnested-externs 41 1 1
-Woverride-init 36 22 15
-Wrestrict 23 14 10
-Wformat-overflow= 20 19 15
-Wempty-body 15 15 8
-Wstringop-overflow= 12 7 3
-Wmisleading-indentation 11 2 2
-Wcast-function-type 11 2 2
-Wstringop-overread 10 10 2
-Wenum-conversion 10 10 5
-Warray-parameter= 8 8 6
-Wpacked-not-aligned 5 3 2
-Wold-style-declaration 3 3 2
-Wignored-qualifiers 1 1 1
-Wconflicts-sr 1 1 1
-Wconflicts-rr 1 1 1