[Bug c++/110137] implement clang -fassume-sane-operator-new

2025-01-29 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 Sam James changed: What|Removed |Added Status|NEW |RESOLVED Target Milestone|---

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #35 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:27778979c9a1e32a6ca74e5b5f377385225449b1 commit r15-5595-g27778979c9a1e32a6ca74e5b5f377385225449b1 Author: Jakub Jelinek Date:

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-15 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #34 from rguenther at suse dot de --- On Fri, 15 Nov 2024, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 > > --- Comment #33 from Jakub Jelinek --- > (In reply to Richard Biener from comment

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #33 from Jakub Jelinek --- (In reply to Richard Biener from comment #32) > See PR101480 for a reason why to not do this. That testcase would be fine with "mP" rather than "mC". Sure, that PR is a reason not to do the stronger (C) ca

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-15 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #32 from Richard Biener --- (In reply to Jakub Jelinek from comment #31) > I believe to match clang++ behavior the needed change would be: > --- gcc/gimple.cc.jj 2024-11-14 18:26:16.877459015 +0100 > +++ gcc/gimple.cc 2024-11-15

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #31 from Jakub Jelinek --- I believe to match clang++ behavior the needed change would be: --- gcc/gimple.cc.jj2024-11-14 18:26:16.877459015 +0100 +++ gcc/gimple.cc 2024-11-15 13:40:43.484711373 +0100 @@ -1605,7 +1605,7 @@

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-11-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #30 from Jakub Jelinek --- I had further look and I must say I really don't know what if anything is clang++'s -fassume-sane-operator-new vs. -fno-assume-sane-operator-new option doing. Initially when that option has been added the

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #29 from Jan Hubicka --- For completeness note that we can also stick info into FUNCTION_DECLs (i.e. by an attribute) to avoid flags pollution. Then it could be TU sensitive since lto-symtab knows that in certain cases it should not

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #27 from Jan Hubicka --- This is somewhat weird testcase which makes two allocations which compiler can track as non-escaping and tests its ability to disambiguate them: int test3(int *data) { int *val = new int; *va

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #28 from Jan Hubicka --- We could make -fassume-sane-operator-new optimization attribute, but then we would need to prevent inlining functions with insane operators to functions with sane operators, or drop the sanity on caller.

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #26 from rguenther at suse dot de --- On Thu, 31 Oct 2024, jason at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 > > --- Comment #25 from Jason Merrill --- > (In reply to Jakub Jelinek from comment

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #25 from Jason Merrill --- (In reply to Jakub Jelinek from comment #24) > Well, to be precise, it would need to be a per-call property if we want to > allow people to redefine those and don't use those call flags within the TUs > whe

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #24 from Jakub Jelinek --- (In reply to Jason Merrill from comment #22) > But as Jonathan says in comment 10, the replaceable operator new is shared > by the whole program, so I don't see why we would need a per-call flag for > the g

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #23 from Jakub Jelinek --- I've just tried: int i, j, k; void * foo () { i = 1; j = 2; void *p = __builtin_operator_new (32); j = 3; k = i; return p; } void * bar () { i = 1; j = 2; void *p = __builtin_malloc (32)

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #22 from Jason Merrill --- But as Jonathan says in comment 10, the replaceable operator new is shared by the whole program, so I don't see why we would need a per-call flag for the global memory aliasing property; either the function

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #21 from Jason Merrill --- (In reply to Richard Biener from comment #20) > It still uses/clobbers global memory though. Hmm, I guess that's a separate issue from being able to elide the calls entirely, which is what CALL_FROM_NEW_OR

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #20 from Richard Biener --- Whether a call clobbers or uses memory is controlled by fnspec these days and a malloc attribute does _not_ indicate this. It works for malloc/free because we make it so via the builtins in builtin_fnspec

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #19 from Jason Merrill --- As I was suggesting on IRC, I think CALL_FROM_NEW_OR_DELETE_P already has the semantics we want, we could also set it on direct calls when assuming sane op new/delete. And maybe rename it to something like

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-10-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org,

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-09-09 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 Sam James changed: What|Removed |Added Keywords||patch --- Comment #17 from Sam James --- (

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-23 Thread user202729 at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #16 from user202729 --- Hi, I tried to implement patches that fix the two issues mentioned. Comments would be appreciated. 1. The operator new flag with many of the mentioned issues fixed: https://gcc.gnu.org/pipermail/gcc-patches/

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-05 Thread hubicka at ucw dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #15 from Jan Hubicka --- > As pointed out in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110035#c13 , > gcc > already assume operator new's retuned pointer cannot alias any existing > pointer. So no change is needed there. Seems yo

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-05 Thread user202729 at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #14 from user202729 --- Regarding alias analysis. The current implementaion is such that: compiler | flag | can alias?| can modify global?| gcc | sane | no| no| << NEW

Re: [Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread Jan Hubicka via Gcc-bugs
> Is the option supposed to be only about the standard global scope operator > new/delete (_Znam etc.) or also user operator new/delete class methods? If > the > former, then I agree it is a global property (or at least a per shared > library/binary property, one can arrange stuff with symbol vis

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread hubicka at ucw dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #13 from Jan Hubicka --- > Is the option supposed to be only about the standard global scope operator > new/delete (_Znam etc.) or also user operator new/delete class methods? If > the > former, then I agree it is a global property

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #12 from Jakub Jelinek --- Is the option supposed to be only about the standard global scope operator new/delete (_Znam etc.) or also user operator new/delete class methods? If the former, then I agree it is a global property (or at

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #11 from Jonathan Wakely --- If a program really does need to ensure a particular TU assumes new can modify global memory (e.g. in the TU defining operator new, which makes use of some data structure) then that TU should probably be

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #10 from Jonathan Wakely --- But replacing operator new is a global property of the program. It seems to me that any translation unit claiming that operator new is sane must imply that it's sane globally. It doesn't make sense for a

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread hubicka at ucw dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #9 from Jan Hubicka --- Doing global flag has a problem since with LTO or using optimize attribute user may mix code compiled with and without sane operator new. When function with insane operator new gets inlined to a function wit

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-06-04 Thread user202729 at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #8 from user202729 --- (In reply to Jonathan Wakely from comment #7) > Thanks for the patch, but patch review happens on the mailing list, not in > bugzilla. Please repost to gcc-patches as documented in the submission > guidelines,

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-05-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #7 from Jonathan Wakely --- Thanks for the patch, but patch review happens on the mailing list, not in bugzilla. Please repost to gcc-patches as documented in the submission guidelines, thanks.

[Bug c++/110137] implement clang -fassume-sane-operator-new

2024-05-26 Thread user202729 at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 user202729 changed: What|Removed |Added CC||user202729 at protonmail dot com --- Comm

[Bug c++/110137] implement clang -fassume-sane-operator-new

2023-08-02 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #5 from rguenther at suse dot de --- On Wed, 2 Aug 2023, redi at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 > > --- Comment #4 from Jonathan Wakely --- > Why would that depend on this new option?

[Bug c++/110137] implement clang -fassume-sane-operator-new

2023-08-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #4 from Jonathan Wakely --- Why would that depend on this new option? It's a requirement of the standard, it has to be true always.

[Bug c++/110137] implement clang -fassume-sane-operator-new

2023-08-01 Thread hiraditya at msn dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 --- Comment #3 from AK --- 1. clang also has noalias on nothrow versions of operator new. will `-fassume-sane-operator-new` enable that as well? 2. as per: http://eel.is/c++draft/basic.stc.dynamic#allocation-2 """If the request succeeds, the

[Bug c++/110137] implement clang -fassume-sane-operator-new

2023-06-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 Jonathan Wakely changed: What|Removed |Added Ever confirmed|0 |1 CC|jwakely at redha

[Bug c++/110137] implement clang -fassume-sane-operator-new

2023-06-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110137 Richard Biener changed: What|Removed |Added Severity|normal |enhancement Keywords|