From patchwork Sat Aug 9 12:33:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 35182 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB0502136C for ; Sat, 9 Aug 2014 12:34:07 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf13305128pde.10 for ; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to:cc :subject:x-original-sender:x-original-authentication-results :content-type; bh=5J9r+d4qDau0nGZeVC3do9r+bBMdaR3um03ZaFrQOt0=; b=bedbFlYXSzfyNlXfPGGxwQ6NOONzAEoOrfZTh9Y3jvV09dQJ80JCwDSZQ9pJjF7k2I v9pnm7IBkf58J82pQQcqIx2b7FNEe9JxIB3CWZaxOjAtOxWnUlnNy6tY0ipKW8txDrGL ES3kT56UyPodhtn6RDb15YXFVkTlv0lF2y0NIiyn3IVimPLota/EFTHM7edwjaxpKcZB crUBalPc9gbvrYlSXCsXjv0x20E4vFRd/viwFwSHTv5YHO2WBOa4M8SkCDGa1O3/Vk2W doDDmZmCVAbm7iXz4N4LDkmxLkJRkQdi/B8Woe23698Tk31yz3Hdom6I6VBllfhM4+7a 1Meg== X-Gm-Message-State: ALoCoQlX1R4AVppty8yaXph1qmSMHo9lBBCyvaHEy+KhApAglJk1kRFkn7zuSBqUguHY4c82bK4w X-Received: by 10.66.136.71 with SMTP id py7mr1406305pab.35.1407587646601; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls883853qgt.60.gmail; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) X-Received: by 10.52.27.16 with SMTP id p16mr11084797vdg.14.1407587646496; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [2607:f8b0:400c:c03::22d]) by mx.google.com with ESMTPS id b11si3819556vdv.62.2014.08.09.05.34.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Aug 2014 05:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22d as permitted sender) client-ip=2607:f8b0:400c:c03::22d; Received: by mail-vc0-f173.google.com with SMTP id hy10so9567615vcb.4 for ; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) X-Received: by 10.52.106.198 with SMTP id gw6mr10847105vdb.23.1407587646258; Sat, 09 Aug 2014 05:34:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp27701vcb; Sat, 9 Aug 2014 05:34:05 -0700 (PDT) X-Received: by 10.68.252.229 with SMTP id zv5mr30504751pbc.16.1407587644816; Sat, 09 Aug 2014 05:34:04 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id sj10si8352243pac.108.2014.08.09.05.34.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Aug 2014 05:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-374738-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 26407 invoked by alias); 9 Aug 2014 12:33:52 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 26395 invoked by uid 89); 9 Aug 2014 12:33:51 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f174.google.com Received: from mail-pd0-f174.google.com (HELO mail-pd0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 09 Aug 2014 12:33:50 +0000 Received: by mail-pd0-f174.google.com with SMTP id fp1so8436035pdb.33 for ; Sat, 09 Aug 2014 05:33:48 -0700 (PDT) X-Received: by 10.68.201.167 with SMTP id kb7mr30372010pbc.38.1407587628005; Sat, 09 Aug 2014 05:33:48 -0700 (PDT) Received: from [10.1.1.8] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by mx.google.com with ESMTPSA id gi8sm5879108pbc.16.2014.08.09.05.33.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Aug 2014 05:33:46 -0700 (PDT) Message-ID: <53E6151A.203@linaro.org> Date: Sat, 09 Aug 2014 22:33:30 +1000 From: Kugan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Richard Biener Subject: PR tree-optimization/52904 testcase X-IsSubscribed: yes X-Original-Sender: kugan.vivekanandarajah@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904 Tescase was generating warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow] due to VRP missing the value range. This seems to have been fixed and the PR is now closed. However, as requested there in the PR, I am sending this patch to add the test-case to test-suite. Is this OK ? Thanks, Kugan gcc/testsuite 2014-08-09 Kugan Vivekanandarajah PR tree-optimization/52904 * gcc.dg/PR52904.c: New test. diff --git a/gcc/testsuite/gcc.dg/PR52904.c b/gcc/testsuite/gcc.dg/PR52904.c index e69de29..e490d23 100644 --- a/gcc/testsuite/gcc.dg/PR52904.c +++ b/gcc/testsuite/gcc.dg/PR52904.c @@ -0,0 +1,26 @@ + +/* { dg-do compile } */ +/* { dg-options "-S -Wstrict-overflow -O2 -fdump-tree-vrp2" } */ + +extern int foo (int); + + +int +wait_reading_process_output (void) +{ + int nfds = 0; + int channel; + for (channel = 0; channel < 1024; ++channel) + { + if (foo (channel)) + nfds++; + } + if (nfds < 0) + return 1; + return 0; +} + +/* { dg-bogus "assuming signed overflow does not occur when simplifying\ + conditional to constant" */ +/* { dg-final { scan-tree-dump "\\\[0, 1023\\\]" "vrp2" } } */ +/* { dg-final { cleanup-tree-dump "vrp2" } } */