Re: [PATCH] libstdc++: Remove UB from operator+ of months and weekdays.

2023-11-17 Thread Jonathan Wakely
On Fri, 17 Nov 2023 at 01:34, Cassio Neri wrote: > > The following functions invoke signed integer overflow (UB) for some extreme > values of days and months [1]: > > weekday operator+(const weekday& x, const days& y); // #1 > month operator+(const month& x, const months& y); // #2 > > For

[PATCH] libstdc++: Remove UB from operator+ of months and weekdays.

2023-11-16 Thread Cassio Neri
The following functions invoke signed integer overflow (UB) for some extreme values of days and months [1]: weekday operator+(const weekday& x, const days& y); // #1 month operator+(const month& x, const months& y); // #2 For #1, the crux of the problem is that, in libstdc++, days::rep is