[Bug libstdc++/120367] [15 Regression] C++23 ranges::transform | ranges::to exception catching (segfault)

2025-05-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120367

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #8 from Jonathan Wakely  ---
Fixed for 15.2, thanks for the report.

[Bug libstdc++/120367] [15 Regression] C++23 ranges::transform | ranges::to exception catching (segfault)

2025-05-27 Thread lexa.nf at yandex dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120367

--- Comment #9 from Arkhipov Alexey (Архипов Алексей)  ---
(In reply to Jonathan Wakely from comment #8)
> Fixed for 15.2, thanks for the report.

You're welcome! Thanks for quick fix.

[Bug libstdc++/120367] [15 Regression] C++23 ranges::transform | ranges::to exception catching (segfault)

2025-05-27 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120367

--- Comment #7 from GCC Commits  ---
The releases/gcc-15 branch has been updated by Jonathan Wakely
:

https://gcc.gnu.org/g:ae1c59c8de43a2cae494ce2212f44be08a629216

commit r15-9735-gae1c59c8de43a2cae494ce2212f44be08a629216
Author: Jonathan Wakely 
Date:   Wed May 21 15:29:02 2025 +0100

libstdc++: Fix vector(from_range_t, R&&) for exceptions [PR120367]

Because this constructor delegates to vector(a) the object has been
fully constructed and the destructor will run if an exception happens.
That means we need to set _M_finish == _M_start so that the destructor
doesn't try to destroy any elements.

libstdc++-v3/ChangeLog:

PR libstdc++/120367
* include/bits/stl_vector.h (_M_range_initialize): Initialize
_M_impl._M_finish.
* testsuite/23_containers/vector/cons/from_range.cc: Check with
a type that throws on construction.
exceptions during construction.

Reviewed-by: Patrick Palka 
(cherry picked from commit 04f2be72b1deecd6c6d454e000cfc0cb16db957c)