Bug 97048 (Wstringop-overread) - [meta-bug] bogus/missing -Wstringop-overread warnings
Summary: [meta-bug] bogus/missing -Wstringop-overread warnings
Status: NEW
Alias: Wstringop-overread
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, meta-bug
Depends on: 93665 96725 97047 98548 98553 99673 100717 101042 101361 101778 101917 101919 102810 103145 105424 106709 107087 107395 108154 108197 109716 109968 109980 110884 111118 111499 81437 82456 98465 100516 110060
Blocks:
  Show dependency treegraph
 
Reported: 2020-09-14 16:23 UTC by Martin Sebor
Modified: 2023-09-20 16:12 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-09-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2020-09-14 16:23:21 UTC
This is a meta-bug to track false positives and negatives in the -Wstringop-overread warning, new in GCC 11 (formerly included in -Wstringop-overflow).
Comment 1 Tony Guilfoyle 2023-05-16 17:18:30 UTC
Source file foo.cpp:

#include <vector>
struct T
  {
  void* p ;
  std::vector<char> a[10] ;
  } ;
void f (T& t, const std::vector<char>& u, int i)
  {
  std::vector<char>& v = t.a[i] ;
  std::vector<char> w (u.begin(), u.end()) ;
  v.resize (v.size() - w.size()) ; // <-- Warning generated here
  }

Command line: g++ -std=c++20 -Wall -O3 -c -o foo.obj foo.cpp

g++ --version: g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0

Problem: Spurious warning emitted:

specified bound between 9223372036854775808 and 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
Comment 2 Jonathan Wakely 2023-05-16 17:28:46 UTC
Tony, this is just a meta-bug that has links to the real bugs. Please either add that as a comment to an existing bug (if it's the same as one of them) or file a new bug (and set "Blocks: 97048" so that it links back here). But since your one seems to be about -Wstringop-overflow not -Wstringop-overread I don't think it is actually related to this meta-bug at all. Maybe it's related to PR 97185 instead.
Comment 3 Tony Guilfoyle 2023-05-17 10:14:44 UTC
I jumped through enough hoops already, I think. You can take it from 
here if you want.

All the best,

Tony

On 16/05/2023 18:28, redi at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97048
>
> --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Tony, this is just a meta-bug that has links to the real bugs. Please either
> add that as a comment to an existing bug (if it's the same as one of them) or
> file a new bug (and set "Blocks: 97048" so that it links back here). But since
> your one seems to be about -Wstringop-overflow not -Wstringop-overread I don't
> think it is actually related to this meta-bug at all. Maybe it's related to PR
> 97185 instead.
>