diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-11-11 21:16:45 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-11-11 21:16:45 -0500 |
commit | 5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb (patch) | |
tree | f06accd1c2401b59cc964b54a4cc174512940b61 /gcc/dwarf2out.c | |
parent | 0f5f9ed5e5a041b636cc002451b1e8b2295f8e4f (diff) | |
download | gcc-5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb.zip gcc-5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb.tar.gz gcc-5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb.tar.bz2 |
analyzer: warn on invalid shift counts [PR97424]
This patch implements -Wanalyzer-shift-count-negative
and -Wanalyzer-shift-count-overflow, analogous to the C/C++
warnings -Wshift-count-negative and -Wshift-count-overflow, but
implemented via interprocedural path analysis rather than via parsing
in a front end, and thus capable of detecting interprocedural cases that the
warnings implemented in the front ends can miss.
gcc/analyzer/ChangeLog:
PR tree-optimization/97424
* analyzer.opt (Wanalyzer-shift-count-negative): New.
(Wanalyzer-shift-count-overflow): New.
* region-model.cc (class shift_count_negative_diagnostic): New.
(class shift_count_overflow_diagnostic): New.
(region_model::get_gassign_result): Complain about shift counts that
are negative or are >= the operand's type's width.
gcc/ChangeLog:
PR tree-optimization/97424
* doc/invoke.texi (Static Analyzer Options): Add
-Wno-analyzer-shift-count-negative and
-Wno-analyzer-shift-count-overflow.
(-Wno-analyzer-shift-count-negative): New.
(-Wno-analyzer-shift-count-overflow): New.
gcc/testsuite/ChangeLog:
PR tree-optimization/97424
* gcc.dg/analyzer/invalid-shift-1.c: New test.
Diffstat (limited to 'gcc/dwarf2out.c')
0 files changed, 0 insertions, 0 deletions