Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-30 Thread Simon Martin
[ Resending since this was somehow sent in HMTL mode and was scrubbed ] On 30 Oct 2024, at 17:16, Simon Martin wrote: > Hi, > > Just closing the loop on this... > > On 19 Oct 2024, at 11:57, Iain Sandoe wrote: > > On 19 Oct 2024, at 10:16, Simon Martin wrote: > > On 18 Oct 2024, at 10:55, Sam Ja

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-30 Thread Simon Martin
Hi, Just closing the loop on this... On 19 Oct 2024, at 11:57, Iain Sandoe wrote: On 19 Oct 2024, at 10:16, Simon Martin wrote: On 18 Oct 2024, at 10:55, Sam James wrote: Simon Martin writes: Hi Sam, Hi Simon, On 16 Oct 2024, at 22:06, Sam James wrote: Simon Martin writes: We ICE upon

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-19 Thread Iain Sandoe
> On 19 Oct 2024, at 10:16, Simon Martin wrote: > > On 18 Oct 2024, at 10:55, Sam James wrote: > >> Simon Martin writes: >> >>> Hi Sam, >> >> Hi Simon, >> >>> >>> On 16 Oct 2024, at 22:06, Sam James wrote: >>> Simon Martin writes: > We ICE upon the following invalid code

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-19 Thread Simon Martin
On 18 Oct 2024, at 10:55, Sam James wrote: > Simon Martin writes: > >> Hi Sam, > > Hi Simon, > >> >> On 16 Oct 2024, at 22:06, Sam James wrote: >> >>> Simon Martin writes: >>> We ICE upon the following invalid code because we end up calling finalize_nrv_r with a RETURN_EXPR with no ope

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-18 Thread Sam James
Simon Martin writes: > Hi Sam, Hi Simon, > > On 16 Oct 2024, at 22:06, Sam James wrote: > >> Simon Martin writes: >> >>> We ICE upon the following invalid code because we end up calling >>> finalize_nrv_r with a RETURN_EXPR with no operand. >>> >>> === cut here === >>> struct X { >>> ~X(); >

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-17 Thread Simon Martin
~X(); >> +}; >> + >> +X test(bool b) { >> + { >> +X x; >> +return x; >> + } >> + if (!(b)) return; // { dg-error "return-statement with no value" } >> +} >> -- >> 2.44.0 >> > > BTW, the line-endings on this seem a bit odd. Di

Re: [PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-16 Thread Sam James
Simon Martin writes: > We ICE upon the following invalid code because we end up calling > finalize_nrv_r with a RETURN_EXPR with no operand. > > === cut here === > struct X { > ~X(); > }; > X test(bool b) { > { > X x; > return x; > } > if (!(b)) return; > } > === cut here === >

[PATCH] c++: Fix crash during NRV optimization with invalid input [PR117099]

2024-10-16 Thread Simon Martin
We ICE upon the following invalid code because we end up calling finalize_nrv_r with a RETURN_EXPR with no operand. === cut here === struct X { ~X(); }; X test(bool b) { { X x; return x; } if (!(b)) return; } === cut here === This patch fixes this by simply returning error_mark_no