testsuite: Add C++ testcase for the recent PTA bug

On Wed, Jul 01, 2026 at 09:47:46AM +0200, Eric Botcazou wrote:
> this is a regression present on mainline, 16, 15 and 14 branches introduced by
> the fix for PR tree-optimization/112653 (PTA and return).  What happens is
> that DSE incorrectly eliminates a call to __builtin_memcpy, whose destination
> is obtained from (an equivalent of) malloc and is ultimately returned from the
> function.  But this happens only when the dynamic allocation is conditional.

For us Ada illiterate, here is a C++ testcase which got fixed by this too.

2026-07-05  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/opt/20260703-1.C: New test.

Reviewed-by: Richard Biener <rguenth@suse.de>
1 file changed