On 10/27/20 7:23 AM, Christophe Lyon wrote:
Hi,
On Mon, 26 Oct 2020 at 22:51, Andrew MacLeod via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
In the core of gori_compute::logical_combine we are suppose to combine
the calculated true and false ranges on each side of the operation.
when encountering
[0,0] = c_3 | c_4
we know we only need to consider the FALSE values of the range carried
by c_3 and c_4, but it can be EITHER of those ranges, so we need to
union them together to get the correct result.
The code was performing an intersection instead, and in this particualr
case, we knew the range carried thru c_3 was alwasy [0,0] and it was
always varying through c_4.... instead of returning varying, we were
returning [0,0] which then caused some folding which was incorrect.
Fixed by correctly calling union...
Bootstrapped on x86_64-pc-linux-gnu, no regressions, and pushed.
I think you need to update the testcase and declare
long long g = 4073709551615
instead of just long, as it causes a warning on 32-bit targets:
/gcc/testsuite/gcc.dg/pr97567.c:7:12: warning: overflow in conversion
from 'long long int' to 'long int' changes value from '4073709551615'
to '2080555007' [-Woverflow]
Christophe
Andrew
ah, didn't realize the testcase didnt work properly on non 64 bit
targets... I'll switch it to long long, that seems to make it work.
thanks
Andrew
commit 3af44504d40d688cafc43d1b850a55ef794b443a
Author: Andrew MacLeod <amacl...@redhat.com>
Date: Tue Oct 27 10:13:18 2020 -0400
Combine logical OR ranges properly. pr97567
update testcase to work on 32 bit targets
gcc/testsuite
* gcc.dg/pr97567.c: Update to work with 32 bit targets.
diff --git a/gcc/testsuite/gcc.dg/pr97567.c b/gcc/testsuite/gcc.dg/pr97567.c
index b2b72a4d2a7..8922f277214 100644
--- a/gcc/testsuite/gcc.dg/pr97567.c
+++ b/gcc/testsuite/gcc.dg/pr97567.c
@@ -4,7 +4,7 @@
int a, b, c, d;
void k() {
unsigned f = 1;
- long g = 4073709551615;
+ long long g = 4073709551615;
for (; a; a++)
for (;;) {
d = 0;
@@ -16,7 +16,7 @@ void k() {
;
g || f;
int i = 0 - f || g;
- long j = g - f;
+ long long j = g - f;
if (j || f) {
if (g < 4073709551615)
for (;;)