From patchwork Fri May 8 09:09:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 469927 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 294CB14018C for ; Fri, 8 May 2015 19:10:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rFIUh8zt; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; q=dns; s=default; b=T5MCIw1Mcq8fhghQXx95rLkGqGXyG txEHlr4jvSD9HkiDtD5PJlflvqc8mvBBtS0IpA50VFZhSNwJgAWcx2hSCE5WI9tK NCZpqKIplvYYD3T8DtEZoK4OFAf/7iBoEaPeC3ZoIDSwQ+IO9fw3ozZlogeuqu3U AqgMo3WXTKEf6o= 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:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; s=default; bh=bkMlE0O6wOY7yLV3yHw0hG9SM40=; b=rFI Uh8ztkytg/oEafnXdy0UjXfD/OjPdEZS7t9Jr6sjHEvTHXJ4R9pgOi4huhH3rOHY 1w/iUhBxWWwhbPnfskivyesbiPr80iwO0DDJE0mepSKIraMhSvQxFNeUEXZYIIvv 0e3zFnuJt1wLPJPZz5t/QZEW0zVyXchXwNMsbDsQ= Received: (qmail 126059 invoked by alias); 8 May 2015 09:10:10 -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 126045 invoked by uid 89); 8 May 2015 09:10:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 May 2015 09:10:07 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YqeIF-0000Oq-Hz from Thomas_Schwinge@mentor.com ; Fri, 08 May 2015 02:10:03 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 8 May 2015 10:10:01 +0100 From: Thomas Schwinge To: Richard Sandiford , Subject: genrecog: Address -Wsign-compare diagnostics (was: Mostly rewrite genrecog) In-Reply-To: <87egn5yis1.fsf@e105548-lin.cambridge.arm.com> References: <87egn5yis1.fsf@e105548-lin.cambridge.arm.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Fri, 8 May 2015 11:09:52 +0200 Message-ID: <87twvntoyn.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Mon, 27 Apr 2015 11:20:30 +0100, Richard Sandiford wrote: > This patch [...] by replacing most of genrecog [...] OK to commit? Is it a bug that I'm seeing these warnings only in the stage 1 build with the bootstrap GCC 4.6 compiler, but not anymore later on? (I have not verified the C++ standard on the rules for »comparison between signed and unsigned integer expressions«.) commit efef4f38205a13da90ca19b6eec1a6526756b433 Author: Thomas Schwinge Date: Fri May 8 10:55:19 2015 +0200 genrecog: Address -Wsign-compare diagnostics. g++-4.6 [...] [...]/gcc/genrecog.c [...]/gcc/genrecog.c: In function 'state_size find_subroutines(routine_type, state*, vec&)': [...]/gcc/genrecog.c:3338:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] [...]/gcc/genrecog.c:3347:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] [...]/gcc/genrecog.c:3359:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] [...]/gcc/genrecog.c:3365:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 3305 state_size size; [...] 3337 state_size to_size = find_subroutines (type, trans->to, procs); 3338 if (d->next && to_size.depth > MAX_DEPTH) [...] 3347 if (to_size.num_statements < MIN_NUM_STATEMENTS) [...] 3359 if (size.num_statements > MAX_NUM_STATEMENTS) [...] 3365 && size.num_statements > MAX_NUM_STATEMENTS) 175 static const int MAX_DEPTH = 6; [...] 179 static const int MIN_NUM_STATEMENTS = 5; [...] 185 static const int MAX_NUM_STATEMENTS = 200; [...] 3258 struct state_size 3259 { [...] 3261 unsigned int num_statements; [...] 3265 unsigned int depth; 3266 }; gcc/ * genrecog.c (MAX_DEPTH, MIN_NUM_STATEMENTS, MAX_NUM_STATEMENTS): Change to unsigned int. --- gcc/genrecog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Grüße, Thomas diff --git gcc/genrecog.c gcc/genrecog.c index 73e7995..653f753 100644 --- gcc/genrecog.c +++ gcc/genrecog.c @@ -172,17 +172,17 @@ static const bool force_unique_params_p = true; /* The maximum (approximate) depth of block nesting that an individual routine or subroutine should have. This limit is about keeping the output readable rather than reducing compile time. */ -static const int MAX_DEPTH = 6; +static const unsigned int MAX_DEPTH = 6; /* The minimum number of pseudo-statements that a state must have before we split it out into a subroutine. */ -static const int MIN_NUM_STATEMENTS = 5; +static const unsigned int MIN_NUM_STATEMENTS = 5; /* The number of pseudo-statements a state can have before we consider splitting out substates into subroutines. This limit is about avoiding compile-time problems with very big functions (and also about keeping functions within --param optimization limits, etc.). */ -static const int MAX_NUM_STATEMENTS = 200; +static const unsigned int MAX_NUM_STATEMENTS = 200; /* The minimum number of pseudo-statements that can be used in a pattern routine. */