]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding releases/gcc-12 65/head
authorRichard Biener <rguenther@suse.de>
Wed, 31 Jan 2024 13:40:24 +0000 (14:40 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 17 May 2024 09:40:15 +0000 (11:40 +0200)
commit65e5547e5468ce404d0f9ebd646a1d63abf3a772
treec497d34a97779966499f8c32aa42370ec5014fc6
parent47e6bff94d980e2fcb6bcb42df04d3b73bd67da7
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]