diff options
author | David Malcolm <dmalcolm@redhat.com> | 2022-03-10 09:04:03 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2022-03-10 09:04:03 -0500 |
commit | b6eaf90c64f91553c8002f6ee401785a8bc6f94c (patch) | |
tree | 62ead60a21c9cc25db4ba9f9b11a5433657ffeef /gcc/fortran | |
parent | 708646de75cba2e3855bde09d21816ca66239a67 (diff) | |
download | gcc-b6eaf90c64f91553c8002f6ee401785a8bc6f94c.zip gcc-b6eaf90c64f91553c8002f6ee401785a8bc6f94c.tar.gz gcc-b6eaf90c64f91553c8002f6ee401785a8bc6f94c.tar.bz2 |
analyzer: check for writes to consts via access attr [PR104793]
This patch extends:
-Wanalyzer-write-to-const
-Wanalyzer-write-to-string-literal
so that they will check for __attribute__ ((access, ....) on calls to
externally-defined functions, and complain about read-only regions
pointed to by arguments marked with a "write_only" or "read_write"
attribute.
gcc/analyzer/ChangeLog:
PR analyzer/104793
* region-model.cc
(region_model::check_external_function_for_access_attr): New.
(region_model::handle_unrecognized_call): Call it.
* region-model.h
(region_model::check_external_function_for_access_attr): New decl.
(region_model::handle_unrecognized_call): New decl.
gcc/testsuite/ChangeLog:
PR analyzer/104793
* gcc.dg/analyzer/write-to-const-2.c: New test.
* gcc.dg/analyzer/write-to-function-1.c: New test.
* gcc.dg/analyzer/write-to-string-literal-2.c: New test.
* gcc.dg/analyzer/write-to-string-literal-3.c: New test.
* gcc.dg/analyzer/write-to-string-literal-4.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions