[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 Martin Sebor changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|---

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-16 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-16 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 Alexander Monakov changed: What|Removed |Added Status|RESOLVED|REOPENED Last reconfirmed|

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-15 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #9 from Paul Smith --- Sorry; Andrew's original reply seemed to say that the use-case is non-conforming so the issue was WONTFIX. I also thought your comment #6 was referring to my example in comment #5: I just wanted to clarify

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #8 from Martin Sebor --- There is no standard way to say "don't inline this function." It's up to the compiler to decide what to inline just so long as it doesn't violate the requirements. There is also no requirement that the

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-15 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #7 from Paul Smith --- Is there a way (in standard C++) to force non-inline? I'm not aware of one. So that means the only standard-conforming way to replace operator new is if it's in its own compilation unit all by itself? I

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #6 from Martin Sebor --- Inlining happens automatically unless it's disabled. The inlining of the operator results in the excessive constant argument (created by the C++ front-end) to propagate to the call to malloc(). That's what

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-15 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #5 from Paul Smith --- I simplified my example too much; I think this should be re-opened. In my real code, operator new[] does not invoke exit(); it invokes my own function (which is defined as noreturn, but that's not required).

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-14 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #4 from Paul Smith --- Well, clearly I disagree with this conclusion and feel this is a bug. At the very least, the fact that it's impossible to disable the warning needs to be considered a bug. The statement on the mailing list

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 Martin Sebor changed: What|Removed |Added Keywords||diagnostic

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-14 Thread psmith at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #2 from Paul Smith --- > Did you try: -Wno-alloc-size-larger-than ? Yes. cc1plus: error: unrecognized command line option '-Wno-alloc-size-larger-than' > Also in your code, numberFields is a signed int and then casted to size_t.

[Bug c++/85783] alloc-size-larger-than fires incorrectly with new[] and can't be disabled

2018-05-14 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783 --- Comment #1 from Andrew Pinski --- Did you try: -Wno-alloc-size-larger-than ? Also in your code, numberFields is a signed int and then casted to size_t. On LP64 targets (or rather sizeof(size_t) != sizeof(int)), then value is sign extended.