[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2024-04-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 Andrew Pinski changed: What|Removed |Added Last reconfirmed|2020-01-28 00:00:00 |2024-4-7 --- Comment #10 from Andrew

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2022-01-15 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #9 from Martin Sebor --- This still isn't diagnosed by GCC 12 even with its -Wuse-after-free and -Wdangling-pointer.

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2020-01-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #8 from Martin Sebor --- Right. The warning pass sees this: [local count: 1073612976]: __dnew ={v} {CLOBBER}; D.29156 ={v} {CLOBBER}; D.29152 ={v} {CLOBBER}; if (_M_local_buf != _23) goto ; [53.47%] else goto ;

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #7 from Marc Glisse --- (In reply to Martin Sebor from comment #6) > With str being a local (non-reference) variable this should be diagnosed > because of the str.D.28972._M_local_buf(12): > > # _47 = PHI <_59(9), _M_local_buf(12),

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #6 from Martin Sebor --- With str being a local (non-reference) variable this should be diagnosed because of the str.D.28972._M_local_buf(12): # _47 = PHI <_59(9), _M_local_buf(12), _59(8)> str ={v} {CLOBBER}; return _47; In

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #5 from Marc Glisse --- struct A { char*p; char c[13]; }; void f(A,bool b){ a.p=b?a.c:(char*)__builtin_malloc(13); __builtin_memcpy(a.p, "hello world!", 12); a.p[12]=0; } gives if (b_4(D) != 0) goto ; [67.00%] else

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #4 from Martin Sebor --- I meant for f1 not to see the string pointed to by p. The warning usually triggers either for the "must return" and "may return" case but in f1 it's too complicated for it to see that the return pointer may

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-18 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #3 from Marc Glisse --- > compiling both functions in the samne translatin unit suppresses the warning > for f0. It is quite common for extra code to change inlining decisions. You still get the warning at -O3. > const char *p =

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 --- Comment #2 from Martin Sebor --- The separate enhancement is pr90906.

[Bug tree-optimization/90905] missing -Wreturn-local-addr returning a local std::string::c_str()

2019-06-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90905 Martin Sebor changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill