diff options
author | Martin Sebor <msebor@redhat.com> | 2021-10-26 14:40:33 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-10-26 16:53:54 -0600 |
commit | 1ff4dbddcf74203a1e16316b18e12f9e1b5085f0 (patch) | |
tree | 5f6066e4ea74c6ac5a9a3e6e52ae5abb0a6cc95b /gcc/go | |
parent | 9a27acc30a34b7854db32eac562306cebac6fa1e (diff) | |
download | gcc-1ff4dbddcf74203a1e16316b18e12f9e1b5085f0.zip gcc-1ff4dbddcf74203a1e16316b18e12f9e1b5085f0.tar.gz gcc-1ff4dbddcf74203a1e16316b18e12f9e1b5085f0.tar.bz2 |
Improve/correct detection of overlapping aggregates [PR102238, PR102919].
Resolves:
PR tree-optimization/102238 - alias_offset in gimple-ssa-sprintf.c is broken
PR tree-optimization/102919 - spurious -Wrestrict warning for sprintf into the same member array as argument plus offset
gcc/ChangeLog:
PR tree-optimization/102238
PR tree-optimization/102919
* gimple-ssa-sprintf.c (get_string_length): Add an argument.
(array_elt_at_offset): Move to pointer-query.
(set_aggregate_size_and_offset): New function.
(field_at_offset): Move to pointer-query.
(get_origin_and_offset): Rename...
(get_origin_and_offset_r): this. Add an argument. Make aggregate
handling more robust.
(get_origin_and_offset): New.
(alias_offset): Add an argument.
(format_string): Use subobject size determined by get_origin_and_offset.
* pointer-query.cc (field_at_offset): Move from gimple-ssa-sprintf.c.
Improve/correct handling of aggregates.
(array_elt_at_offset): Same.
* pointer-query.h (field_at_offset): Declare.
(array_elt_at_offset): Declare.
gcc/testsuite/ChangeLog:
PR tree-optimization/102238
PR tree-optimization/102919
* gcc.dg/tree-ssa/builtin-sprintf-warn-23.c: Remove warnings.
* gcc.dg/Wrestrict-23.c: New test.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions