<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Jonathan,</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for the review.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I used an LLM as an additional review tool, but I wrote both the</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
change and the test myself. I thought the added copyright</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
block was needed. I have removed it in v2 and added the</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
explicit return from main.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I was not expecting a measurable regression on the normal path, because</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
the added recovery code only runs when the comparator throws, but I</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
benchmarked it to confirm.  With the default comparator, the generated</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
code was identical and timings were within noise.  With an external</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
potentially-throwing comparator, the worst result was about 1.9% slower.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I kept the benchmark local, but I can send it if useful.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Outlook sent the v1 patch as application/octet-stream, so I have</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
attached v2 as PR124051-v2.patch.txt instead.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Odysseas</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<b>From:</b> Jonathan Wakely <jwakely@redhat.com><br>
<b>Sent:</b> 19 August 2026 12:19<br>
<b>To:</b> Odysseas Georgoudis <odygrd@hotmail.com><br>
<b>Cc:</b> libstdc++@gcc.gnu.org <libstdc++@gcc.gnu.org>; gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org><br>
<b>Subject:</b> Re: [PATCH] libstdc++: Make forward_list::sort exception-safe [PR124051]</div>
<div style="direction: ltr;"> </div>
</div>
<div style="font-size: 11pt;">On Sun, 16 Aug 2026 at 20:43 +0000, Odysseas Georgoudis wrote:<br>
>If a comparison called by forward_list::sort throws, the current<br>
>implementation can leave the list corrupted, which may cause a later<br>
>crash.<br>
><br>
>This patch restores valid links before allowing the same exception to<br>
>continue.  The element order remains unspecified, as permitted by the<br>
>standard, while iterators and references remain valid.<br>
><br>
>Tested on x86_64-pc-linux-gnu.<br>
><br>
>Thanks,<br>
>Odysseas<br>
<br>
Thanks for the patch to fix this.<br>
<br>
Have you tested whether this affects performance of the sort function?<br>
I hope it doesn't make much difference.<br>
<br>
Please don't attach patches as application/octet-stream - patches are<br>
plain text, not binary data. It makes it hard to review the patch by<br>
replying inline.<br>
<br>
Please read<br>
<a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/test.html#test.new_tests" data-auth="NotApplicable" id="OWA9802586c-1620-d96d-3a50-1b9234aeee96" class="OWAAutoLink">https://gcc.gnu.org/onlinedocs/libstdc++/manual/test.html#test.new_tests</a><br>
and adjust the new test accordingly. Based on the copyright notice in<br>
the test, it seems likely this was produced with the assistance of an<br>
LLM, is that correct?<br>
<br>
</div>
</body>
</html>