GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
testsuite

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

Adds a C++ test case to cover a Pointer Analysis regression.

This commit adds a new C++ test case to the GCC testsuite. The testcase is designed to expose a regression related to Pointer Analysis (PTA) and function return values, specifically involving __builtin_memcpy and conditional memory allocation. This regression was introduced by a previous fix for PR tree-optimization/112653 and affects multiple GCC branches. The new test ensures this specific scenario is covered and verified.

In Details

Adds a C++ testcase (g++.dg/opt/20260703-1.C) to reproduce a regression in Pointer Analysis (PTA) and DSE (Dead Store Elimination). The regression, introduced by the fix for PR tree-optimization/112653, occurs when DSE incorrectly eliminates a call to __builtin_memcpy whose destination is an alloca'd buffer conditionally returned from a function.

For Context
Pointer Analysis (PTA)
A static analysis technique that determines the possible memory locations a pointer can refer to during program execution. Crucial for many optimizations.
DSE (Dead Store Elimination)
An optimization pass that removes stores to memory locations that are never read afterwards.
PR
Problem Report. GCC uses a bug tracking system where issues are filed as PRs.
Filed Under: testsuiteptaoptimization