aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/region.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2022-02-09 19:06:15 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2022-02-10 13:00:58 -0500
commit2ac7b19f1e9219f46ccf55f25d8acb3e02e9a2d4 (patch)
treef0b2beadb7c47003a45bf9cba95784980ed14165 /gcc/analyzer/region.h
parentb32305b41dcafc5fb6974c0da3ce2f62251afdbf (diff)
downloadgcc-2ac7b19f1e9219f46ccf55f25d8acb3e02e9a2d4.zip
gcc-2ac7b19f1e9219f46ccf55f25d8acb3e02e9a2d4.tar.gz
gcc-2ac7b19f1e9219f46ccf55f25d8acb3e02e9a2d4.tar.bz2
analyzer: handle more casts of string literals [PR98797]
gcc/analyzer/ChangeLog: PR analyzer/98797 * region-model-manager.cc (region_model_manager::maybe_fold_sub_svalue): Generalize getting individual chars of a STRING_CST from element_region to any subregion which is a concrete access of a single byte from its parent region. * region.cc (region::get_relative_concrete_byte_range): New. * region.h (region::get_relative_concrete_byte_range): New decl. gcc/testsuite/ChangeLog: PR analyzer/98797 * gcc.dg/analyzer/casts-1.c: Mark xfails as fixed; add further test coverage for casts of string literals. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/region.h')
-rw-r--r--gcc/analyzer/region.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h
index 5311217..2f987e4 100644
--- a/gcc/analyzer/region.h
+++ b/gcc/analyzer/region.h
@@ -182,6 +182,12 @@ public:
Otherwise return false. */
virtual bool get_relative_concrete_offset (bit_offset_t *out) const;
+ /* Attempt to get the position and size of this region expressed as a
+ concrete range of bytes relative to its parent.
+ If successful, return true and write to *OUT.
+ Otherwise return false. */
+ bool get_relative_concrete_byte_range (byte_range *out) const;
+
void
get_subregions_for_binding (region_model_manager *mgr,
bit_offset_t start_bit_offset,