GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization

Forward propagation now preserves alignment for LHS assignments.

A bug in forward propagation that missed updating alignment for assignments to the left-hand side has been fixed.

This commit fixes a bug in GCC’s forward propagation pass where the alignment of expressions was not correctly preserved when propagating values into the left-hand side of an assignment. This oversight, introduced in a previous fix, could lead to incorrect assumptions about memory access alignment, potentially causing performance issues or incorrect code generation. The fix ensures that the original access alignment is maintained during such propagations.

In Details

This patch targets forward_propagate_addr_expr_1 in tree-ssa-forwprop.cc, specifically rectifying an omission from a previous bug fix related to PR125296. The issue arose because the alignment of an address expression was not being preserved when propagated to the LHS (left-hand side) of an assignment. This oversight could lead to subsequent optimization passes or code generation making incorrect alignment assumptions, potentially penalizing performance or generating suboptimal code. The fix ensures that the original alignment information is correctly transferred, maintaining the semantic…

For Context

Compilers like GCC try to optimize your code to make it run faster. One such optimization is called "forward propagation," where the compiler tracks how values change and tries to simplify expressions. When a program reads from memory, the location of that memory (its 'alignment') can be important for performance. This commit fixes a bug where, during an optimization, the compiler sometimes forgot to keep track of the correct alignment for certain memory operations, specifically when a value was being assigned to a memory location. This could cause the compiler to generate less efficient code, or in rare cases, incorrect code. The fix ensures that the compiler correctly preserves this alignment information, leading to more reliable and potentially faster optimized programs.

Filed Under: optimizationbugfixalignmentssa