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: 378735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 56AD9140116 for ; Sat, 9 Aug 2014 22:33:59 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=I9Fjlu2qtR+0/y1cML/MamfVUAxVyt0pSOaEOxMLCig hE0zU+9dZppmGAtrNyv5RMGdoAyxZdYls7WXDeCqPQ6EgCos0/fLMaFCERADvBd1 tq1k26NmqFGoq1pFT5NngURpfigwF4ULYSOe0FrrBq/AxQMilX5yWJ0CHrLr6A1k = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=X2NVa2/XfN2HYCyQPuq8C9bd+yk=; b=G73kezLORAiMKi38z ArDgq5MPdL7oPrDJQ05Ktncz/6a/YY/q8q4b7YpUUn/HHXZ6gvLu+Z00eV7XJ+Ma c06t8p3BkeXDwrXMM+0AuDKjMJ8erP/rYti9VkNqLvFUkk5Ixi6CncdXKIKDeLTy wFsIVISPHZCQ/9rhTLbnrq9PaM= Received: (qmail 26407 invoked by alias); 9 Aug 2014 12:33:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk 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 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type; bh=TBlac3nQ3Pia5GdtYWcMm46X4WexFXv1Cps0DWsuKcA=; b=HWGB0Y+oaf64B/gQgjazogAE31whl8eufEB/NkUxl0fCTCpWJ4XfWPSQbsdlMmq5fw NVLX603o2sXywL53j0EJHCViJw5ldkuWrX8JMH+BTdTUWycJjXhEupHYqK9li+VDCfY9 StpsKWazfiCBEJqA8YqSUjHYT1qYdbZTlDLIlqcI77R13BNn2vZy3v7xlNUIEHkvw+YO UoGi4cSAZzP/kLwhl9FWDgG6I/VAtIaPyeOMdjthLR4txxPdDF5X8jN55zxSJhwgFjnl F55TOfHX8SZKiDUwUpPbLtwFqw3A7vVHYQGj/SNy/3xI7aB0PehEIcPlRODALo88Wro9 6osg== X-Gm-Message-State: ALoCoQkxdFolxG+9XWCWWSd+NFFjO6TjDcjF2ZtP3iSgHtto5qQbOPyDurFOIJT2bxrmVzGIA4Ty 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 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" } } */