Bug 91741 - Implement new warning -Wsizeof-array-div
Summary: Implement new warning -Wsizeof-array-div
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: diagnostic, patch
Depends on:
Blocks: new-warning, new_warning
  Show dependency treegraph
 
Reported: 2019-09-11 15:41 UTC by Marek Polacek
Modified: 2020-10-23 19:17 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-09-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2019-09-11 15:41:05 UTC
... to detect things like: https://www.viva64.com/en/examples/v706/
Comment 1 Jonathan Wakely 2019-09-11 16:05:46 UTC
Looks like a good idea for a warning.

But please don't make the diagnostic say "every element", since I hope all the elements of an array have the same size, so you don't need to consider every one of them ;-)
Comment 2 Eric Gallager 2019-09-11 16:06:36 UTC
I thought we already had this, but I guess I was thinking of -Wsizeof-pointer-div instead...
Comment 4 Marek Polacek 2020-10-23 19:17:07 UTC
Implemented in r11-4328.