From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1011) id 729B33858D38; Mon, 3 Oct 2022 14:14:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 729B33858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664806450; bh=a42hA85Mc9IoBBLTCxsWHF/5IibhgL6nDPu9oGkeRZ4=; h=From:To:Subject:Date:From; b=qkfRskJZU1U96jh7zZx1xNRGWWtjkvVLBdneDuZsN2lINp8QwCtKjJ+IiJQx6ZslZ P/g89nGmH8s8PLH1bVIwYgWkxJbERR/JPetKYTH5INy/LEFtLbKX1LzFu1aNxYQip8 307WrogYsNvgMzY2By6GBOnK7qD9ivMAzMQH6nkk= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Macleod To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3031] Don't process undefined range. X-Act-Checkin: gcc X-Git-Author: Andrew MacLeod X-Git-Refname: refs/heads/master X-Git-Oldrev: 06aa66af7d0dacc1b247d9e38175e789ef159191 X-Git-Newrev: f41d1b39a6443fad38c36af34b1baa384954ca80 Message-Id: <20221003141410.729B33858D38@sourceware.org> Date: Mon, 3 Oct 2022 14:14:10 +0000 (GMT) List-Id: https://gcc.gnu.org/g:f41d1b39a6443fad38c36af34b1baa384954ca80 commit r13-3031-gf41d1b39a6443fad38c36af34b1baa384954ca80 Author: Andrew MacLeod Date: Sun Oct 2 18:43:35 2022 -0400 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. Diff: --- gcc/range-op.cc | 2 ++ gcc/testsuite/gcc.dg/pr107109.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 7ef980315b6..4f647abd91c 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 00000000000..e3036f6ff22 --- /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; +} +