]> gcc.gnu.org Git - gcc.git/commit
middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding
authorRichard Biener <rguenther@suse.de>
Wed, 31 Jan 2024 13:40:24 +0000 (14:40 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 6 Feb 2024 12:17:34 +0000 (13:17 +0100)
commitd4216cc2c879ecbdc4df6a2db67f6b6afd7a7d68
treedfc0f07007c23abe6a369b5c7e9e0365cc0cb4da
parentaaf64d9321cd4c7210d6cbc31f2996a01340565c
middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding

The following fixes a wrong pattern that didn't match the behavior
of the original fold_widened_comparison in that get_unwidened
returned a constant always in the wider type.  But here we're
using (int) 4294967295u without the conversion applied.  Fixed
by doing as earlier in the pattern - matching constants only
if the conversion was actually applied.

PR middle-end/110176
* match.pd (zext (bool) <= (int) 4294967295u): Make sure
to match INTEGER_CST only without outstanding conversion.

* gcc.dg/torture/pr110176.c: New testcase.

(cherry picked from commit 22dbfbe8767ff4c1d93e39f68ec7c2d5b1358beb)
gcc/match.pd
gcc/testsuite/gcc.dg/torture/pr110176.c [new file with mode: 0644]
This page took 0.078315 seconds and 5 git commands to generate.