public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <msebor@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2171] Use Object Size Type zero for -Warray-bounds [PR101374]. Date: Thu, 8 Jul 2021 17:44:26 +0000 (GMT) [thread overview] Message-ID: <20210708174426.717993AA9420@sourceware.org> (raw) https://gcc.gnu.org/g:9bf9f27ac6db4823628c435da9b242fd82bf8d68 commit r12-2171-g9bf9f27ac6db4823628c435da9b242fd82bf8d68 Author: Martin Sebor <msebor@redhat.com> Date: Thu Jul 8 11:34:27 2021 -0600 Use Object Size Type zero for -Warray-bounds [PR101374]. Resolves: PR bootstrap/101374 - -Warray-bounds accessing a member subobject as derived gcc/cp/ChangeLog: PR bootstrap/101374 * module.cc (module_state::read_macro_maps): Temporarily disable -Warray-bounds. (module_state::install_macros): Same. gcc/ChangeLog: PR bootstrap/101374 * gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Use Object Size Type 0 instead of 1. gcc/testsuite/ChangeLog: PR bootstrap/101374 * c-c++-common/Warray-bounds-3.c: Xfail assertion. * c-c++-common/Warray-bounds-4.c: Same. Diff: --- gcc/cp/module.cc | 13 +++++++++++++ gcc/gimple-array-bounds.cc | 2 +- gcc/testsuite/c-c++-common/Warray-bounds-3.c | 2 +- gcc/testsuite/c-c++-common/Warray-bounds-4.c | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index f259515a498..8a890c167cf 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -16301,11 +16301,18 @@ module_state::read_macro_maps () } if (count) sec.set_overrun (); + + /* FIXME: Re-enable or fix after root causing. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" + dump (dumper::LOCATION) && dump ("Macro:%u %I %u/%u*2 locations [%u,%u)", ix, identifier (node), runs, n_tokens, MAP_START_LOCATION (macro), MAP_START_LOCATION (macro) + n_tokens); + +#pragma GCC diagnostic pop } location_t lwm = sec.u (); macro_locs.first = lwm - slurp->loc_deltas.second; @@ -16911,6 +16918,10 @@ module_state::install_macros () macro_import::slot &slot = imp.append (mod, flags); slot.offset = sec.u (); + /* FIXME: Re-enable or fix after root causing. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" + dump (dumper::MACRO) && dump ("Read %s macro %s%s%s %I at %u", imp.length () > 1 ? "add" : "new", @@ -16931,6 +16942,8 @@ module_state::install_macros () exp.def = cur; dump (dumper::MACRO) && dump ("Saving current #define %I", identifier (node)); + +#pragma GCC diagnostic pop } } diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc index 83b8db9755e..8dfd6f9500a 100644 --- a/gcc/gimple-array-bounds.cc +++ b/gcc/gimple-array-bounds.cc @@ -427,7 +427,7 @@ array_bounds_checker::check_mem_ref (location_t location, tree ref, axssize = wi::to_offset (access_size); access_ref aref; - if (!compute_objsize (ref, 1, &aref, ranges)) + if (!compute_objsize (ref, 0, &aref, ranges)) return false; if (aref.offset_in_range (axssize)) diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-3.c b/gcc/testsuite/c-c++-common/Warray-bounds-3.c index 3d7c7687374..75f9a496eae 100644 --- a/gcc/testsuite/c-c++-common/Warray-bounds-3.c +++ b/gcc/testsuite/c-c++-common/Warray-bounds-3.c @@ -178,7 +178,7 @@ void test_memcpy_bounds_memarray_range (void) TM (ma.a5, ma.a5 + i, ma.a5, 1); TM (ma.a5, ma.a5 + i, ma.a5, 3); - TM (ma.a5, ma.a5 + i, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" } */ + TM (ma.a5, ma.a5 + i, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" "pr101374" { xfail *-*-* } } */ TM (ma.a5, ma.a5 + i, ma.a5, 7); /* diagnosed with -Warray-bounds=2 */ } diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-4.c b/gcc/testsuite/c-c++-common/Warray-bounds-4.c index 1f73f11943f..835c634fd27 100644 --- a/gcc/testsuite/c-c++-common/Warray-bounds-4.c +++ b/gcc/testsuite/c-c++-common/Warray-bounds-4.c @@ -52,7 +52,7 @@ void test_memcpy_bounds_memarray_range (void) = MEM <unsigned char[5]> [(char * {ref-all})&ma]; and could be improved. Just verify that one is issued but not its full text. */ - TM (ma.a5, ma.a5 + j, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" } */ + TM (ma.a5, ma.a5 + j, ma.a5, 5); /* { dg-warning "\\\[-Warray-bounds" "pr101374" { xfail *-*-* } } */ TM (ma.a5, ma.a5 + j, ma.a5, 7); /* { dg-warning "offset \\\[5, 7] from the object at .ma. is out of the bounds of referenced subobject .\(MA::\)?a5. with type .char ?\\\[5]. at offset 0" } */ TM (ma.a5, ma.a5 + j, ma.a5, 9); /* { dg-warning "offset \\\[5, 9] from the object at .ma. is out of the bounds of referenced subobject .\(MA::\)?a5. with type .char ?\\\[5]. at offset 0" } */
reply other threads:[~2021-07-08 17:44 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210708174426.717993AA9420@sourceware.org \ --to=msebor@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).