From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id D602138555A3 for ; Thu, 18 May 2023 17:44:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D602138555A3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f4ec041fc3so14832125e9.1 for ; Thu, 18 May 2023 10:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684431843; x=1687023843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vtETGNmnkDcGKOxk2B9qE1tfXiaIhbiA3WnHsGtE3Bc=; b=BjcQ0H6WjvHtBbTiUXDepgCpfprEyo0n2KVuCkv4c2aGCeK+PPEVeookgDpuC7Zxgs HuwW3bDpeT8zyti1Efor+3AfDoK8kqod8daSokLESToCtWvCJqypO43IMXOPqMqjjgT/ qp8M8FD9re4DHZ+GkrOT9Um+uAGzkPOCe+TacwzGPCMJthV3qmHMoEHpbzlB5RPCOS4j tfDgOHNx6l1/g0uqtVQUSSWA2DCAExewVQI3CADezHhqpmCL3xUYkH6oECuT9SXHYZ2N GO0NQGp2+mYBQD1N4OoDNqwFppBVRQcEXf8cF2GxGXD+tpyDGeHXkwq1ERrMy3jddY7l JCVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684431843; x=1687023843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vtETGNmnkDcGKOxk2B9qE1tfXiaIhbiA3WnHsGtE3Bc=; b=eHG/IaqK2wW7C8DyXsQVHQu8V/ZU0z6Vd/yhh/E9JCcsqZFxB1UH3rywCICeMkbZ1t jM8y+8CzWuSNQ3UnYqt12xA7P34RFVL9hJcS1w1M3YufZ/X5YribcR1sSD44x24JGyaD z61ikJZs2df+Qmol+QHbJgkzVu9RPKKkG+r17L/jyGDZIV/bXI/NBpYA9ZFXHNuXO0up 0xziBoJVYSl/5UoMGK4c4cpuubWIZ8oU20KQWvD2xbDC8L6Q3D93snjE7FL5s1BSXCRO lfVMvkD2QUryO+VTLSByOmirMvAVgGEHTjTyeCGN+oycie8YHQ5cb0x7pTXjJIP1hu1Y eQWw== X-Gm-Message-State: AC+VfDxRjcDbn6TeFWio6iPxeYJ1xaH5G4+oqtjvhtTi9YxSRlxWA2cj 64A+ORFpcTIo+M7LnIhB6IjLNw== X-Google-Smtp-Source: ACHHUZ4vkTywGk1wxyxRwHhohV+ZkxCQoLG6SEUmpulfiV/S7P2aycjg3z/y7aoMHub8XIuWiN5HYw== X-Received: by 2002:adf:f0cc:0:b0:306:2e48:6ded with SMTP id x12-20020adff0cc000000b003062e486dedmr2444268wro.13.1684431843632; Thu, 18 May 2023 10:44:03 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id 2-20020a05600c22c200b003f4e8530696sm2665910wmg.46.2023.05.18.10.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 10:44:03 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix internal error on small array with negative lower bound Date: Thu, 18 May 2023 19:44:02 +0200 Message-ID: <1897759.taCxCBeP46@fomalhaut> In-Reply-To: References: <4801877.GXAFRqVoOG@fomalhaut> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Would it be better to use > > wi::to_uhwi (wi::to_wide (local->index) - wi::to_wide (local->min_index)) > > to honor the actual sign of the indices? I think nothing forbids frontends > to use a signed TYPE_DOMAIN here? But the difference should be always > representable in an unsigned value of course. We use tree_to_uhwi everywhere else though, see categorize_ctor_elements_1: if (tree_fits_uhwi_p (lo_index) && tree_fits_uhwi_p (hi_index)) mult = (tree_to_uhwi (hi_index) - tree_to_uhwi (lo_index) + 1); or store_constructor this_node_count = (tree_to_uhwi (hi_index) - tree_to_uhwi (lo_index) + 1); so the proposed form looks better for the sake of consistency. -- Eric Botcazou