From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72866 invoked by alias); 16 Oct 2019 07:38:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 72858 invoked by uid 89); 16 Oct 2019 07:38:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=complaints, INTEGRAL X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2019 07:38:45 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DABD8535C for ; Wed, 16 Oct 2019 07:38:43 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id z205so784336wmb.7 for ; Wed, 16 Oct 2019 00:38:43 -0700 (PDT) Received: from abulafia.quesejoda.com (136.red-2-139-5.dynamicip.rima-tde.net. [2.139.5.136]) by smtp.gmail.com with ESMTPSA id v16sm25484247wrt.12.2019.10.16.00.38.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Oct 2019 00:38:39 -0700 (PDT) Subject: Re: [patch] canonicalize unsigned [1,MAX] ranges into ~[0,0] To: Jakub Jelinek Cc: Rainer Orth , Jeff Law , gcc-patches , Andrew MacLeod References: <995b4560-6a76-6742-888f-eadbfb9ff9cc@redhat.com> <74fb2cf8-6312-6ae2-b620-3d36deb61080@redhat.com> <6a557c4c-d86b-7b7f-70c2-483fff2d5f59@redhat.com> <4a1ab265-cd1d-71b3-c2c7-31cd3667fa54@redhat.com> <20191015181614.GJ2116@tucnak> From: Aldy Hernandez Message-ID: <39cc5730-f2b1-4320-7e21-8d71cc3c76f5@redhat.com> Date: Wed, 16 Oct 2019 07:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20191015181614.GJ2116@tucnak> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg01151.txt.bz2 On 10/15/19 2:16 PM, Jakub Jelinek wrote: > On Tue, Oct 15, 2019 at 08:35:07AM -0400, Aldy Hernandez wrote: >>> I'm seeing this on 32-bit i386-pc-solaris2.11 and sparc-sun-solaris2.11, >>> with more reports for armv8l, pru, and s390x. >>> >>> Comparing the dumps between 64 and 32-bit, I see >>> >>> -_1: int * [1B, -1B] >>> +_1: int * [1B, 4294967295B] >> >> I wonder why 32-bit targets at displaying 4294967295 instead of -1. Or are >> pointers 64-bits here? > > Because the dump method does: > if (INTEGRAL_TYPE_P (ttype) > && vrp_val_is_max (max ()) > && TYPE_PRECISION (ttype) != 1) > fprintf (file, "+INF"); > else > print_generic_expr (file, max ()); > so for integral types and maximum value, it prints +INF, but not for > pointers. Ah, I see. > Perhaps we want to print +INF also for pointers, > if ((INTEGRAL_TYPE_P (ttype) || POINTER_TYPE_P (ttype)) > && vrp_val_is_max (max (), true) > && TYPE_PRECISION (ttype) != 1) > fprintf (file, "+INF"); > else > print_generic_expr (file, max ()); That sounds reasonable, though I would use supports_type_p() instead of open-coding the check for INTEGRAL and POINTER. Would you take care of this, or shall I? > but maybe vrp_val_is_{min,max} should be rewritten for pointer types to be > more efficient, don't create trees, for min just use integer_zerop and for > max just compare wide_int? That sounds like a separate issue, but sure. No complaints. Note, that I highly dislike the whole handle_pointers=bool argument in vrp_*val*, even though I added it. I think it should default to the handle_pointers behavior, though I was unsure what would break, so I kept existing behavior gated by a bool (yuck). Thanks. Aldy