This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82309] Compiled binary received SIGSEGV when -g
- From: "sergio_nsk at yahoo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 24 Sep 2017 06:49:06 +0000
- Subject: [Bug c++/82309] Compiled binary received SIGSEGV when -g
- Auto-submitted: auto-generated
- References: <bug-82309-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82309
--- Comment #6 from Sergey Markelov <sergio_nsk at yahoo dot de> ---
(In reply to Andrew Pinski from comment #5)
> The temp variable goes out if scope is the result of v0 + v1. And not the
> auto. IIRC -fsanitize=undefined will catch this.
Yes, I agree, I understood it from your previous comment. Sorry, I was mistaken
with the extra minimized bug.cpp, so you can not see Vector constructor from
'VectorSum'.
'auto sum = v0 + v1 + v2' deduces the type VectorSum<VectorSum<Vector, Vector>
Vector> with a reference to a temp variable of the type VectorSum<Vector,
Vector>.
'Vector sum = v0 + v1 + v2' sums and copies values during the temp scope is
valid.
Unfortunately -fsanitize=undefined does not catch this. Thank you for your
help.