diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2022-10-02 18:43:35 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2022-10-03 10:02:34 -0400 |
commit | f41d1b39a6443fad38c36af34b1baa384954ca80 (patch) | |
tree | 4beeb7c95436222ae9255b76f83be08542998de1 /gcc | |
parent | 06aa66af7d0dacc1b247d9e38175e789ef159191 (diff) | |
download | gcc-f41d1b39a6443fad38c36af34b1baa384954ca80.zip gcc-f41d1b39a6443fad38c36af34b1baa384954ca80.tar.gz gcc-f41d1b39a6443fad38c36af34b1baa384954ca80.tar.bz2 |
Don't process undefined range.
No need to continue processing an undefined range.
gcc/
PR tree-optimization/107109
* range-op.cc (adjust_op1_for_overflow): Don't process undefined.
gcc/testsuite/
* gcc.dg/pr107109.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/range-op.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr107109.c | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 7ef9803..4f647ab 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -1370,6 +1370,8 @@ static void adjust_op1_for_overflow (irange &r, const irange &op2, relation_kind rel, bool add_p) { + if (r.undefined_p ()) + return; tree type = r.type (); // Check for unsigned overflow and calculate the overflow part. signop s = TYPE_SIGN (type); diff --git a/gcc/testsuite/gcc.dg/pr107109.c b/gcc/testsuite/gcc.dg/pr107109.c new file mode 100644 index 0000000..e3036f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr107109.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +int printf(const char *, ...); +int a, b; +void c() { + int d, e; + L: + a = (b && a) ^ 2756578370; + d = ~a + (e ^ d) ^ 2756578370; + if (!d) + printf("%d", a); + d = a / e; + goto L; +} +int main() { + if (a) + c(); + return 0; +} + |