diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2026-02-04 11:25:01 +0100 |
|---|---|---|
| committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2026-02-04 11:25:01 +0100 |
| commit | 2149eda29e2628d31faf44da060139a856c47b3f (patch) | |
| tree | 4025d7031aa8e9d58a4c7a647e8d418822cd8ce6 /libjava/classpath/java/sql | |
| parent | 9c24b4d7df324cd2041ad16c810d6b4ca9dab0eb (diff) | |
| download | gcc-2149eda29e2628d31faf44da060139a856c47b3f.zip gcc-2149eda29e2628d31faf44da060139a856c47b3f.tar.gz gcc-2149eda29e2628d31faf44da060139a856c47b3f.tar.bz2 | |
bitint: Don't try to extend PHI in the min_prec == prec case [PR122689]
The following testcase is miscompiled on aarch64-linux, the problem is that
the PHI argument is lowered to
VIEW_CONVERT_EXPR<unsigned long[196]>(y) = VIEW_CONVERT_EXPR<unsigned long[196]>(*.LC0);
MEM <unsigned long[1]> [(unsigned _BitInt(12419) *)&y + 1568B] = {};
on the edge, where for aarch64 unsigned _BitInt(12419) the size of the type
is already 1568 bytes (aka 196 DImode limbs, 98 TImode ABI limbs), so the
fir stmt copies everything and the second stmt clobbers random unrelated memory
after it.
Usually when min_prec == prec (otherwise we guarantee that min_prec is either 0,
or a single limb (which doesn't have padding bits) or something without any
padding bits (multiple of abi_limb_prec)) we take the
if (c)
{
if (VAR_P (v1) && min_prec == prec)
{
tree v2 = build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (v1), c);
g = gimple_build_assign (v1, v2);
gsi_insert_on_edge (e, g);
edge_insertions = true;
break;
}
path and need nothing else, but in this case v1 is a PARM_DECL, so we need to
take the code path with VCE on the lhs side as well. But after the assignment
we fall through into the handling of the extension, but for min_prec == prec
that isn't needed and is actually harmful, we've already copied everything
and the code later on assumes there are no padding bits and uses just
TYPE_SIZE_UNIT.
So, this patch just avoids the rest after we've copied all the bits for
min_prec == prec.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR middle-end/122689
* gimple-lower-bitint.cc (gimple_lower_bitint): For the PHI handling
if min_prec == prec, break after emitting assignment from c.
* gcc.dg/bitint-127.c: New test.
Diffstat (limited to 'libjava/classpath/java/sql')
0 files changed, 0 insertions, 0 deletions
