From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id BE6983858C78 for ; Tue, 28 May 2024 06:49:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE6983858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BE6983858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716878961; cv=none; b=H+f9LNbHvy0y42bSM74c5OJUmCNxonEhdxEm6TRWTddhMz523GeeBsDkjYWLKcyOxH9KpuEh6zPJ1T29/sA4SzRxekMAIMrw/vv79HPnamPllPQtayG5cPJvXMOmJ/FcxuDIkz9hRktUXPwm+x5YB5I4mWGhWST2cb/bDXkKrX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716878961; c=relaxed/simple; bh=bMqkEcU4jEzmXoPZXTOad3d0ptlbpSVFFawScVP2k0M=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=YKfH8ZE+xWbY4Nn7EqaIOzd/rFGxNbe114SctN09LUg2oU7wMEm8kW2iuUHB3Si906tSeZXWCGzaa0nFni8kskEzaMeEKQkdwkDmuvggrsyzf5w5o4TZj0jTj7OwUFm2X6jUYCVNBRs7ChDAkkD7U7tkvWlnruTGx76v0J9FGRI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e95a1d5ee2so7522641fa.0 for ; Mon, 27 May 2024 23:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716878954; x=1717483754; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4QZs9562lEGO7KdEyugcqZrT9oG1qzGKf1F112E+OJk=; b=MkHmgPDpTEH8wAN0bbPMpo0ulmupvm1fJ2VDNAGkrSUvU+2IHvFoXOfDAQ8uZNE8Il 2EwvTMIqCdHufwKIroaEL/gtgyct/kZ8N8y1oLzDSVdlSBNVp5luIB1ww9rpQtYnX242 m9SnpOewpbuQvWbCDAk0zrNB/LUAJ2cw9g69pTshQbC7rruHHQi2QBll4nZa+D3WhDrr ySngnFHSsTx//pki+4YB3MvmtastvNlmLeXQTQ0WLs+bIZflpKNIUhg+d5yP4TUvv0mq 8rY4qtGQwXGD6R3eIryFJvSbCTQ+I2+/t7G08ZrgcnRc0UQHvUeKOPg6RMGb9Jm+PKqA Fzog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716878954; x=1717483754; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4QZs9562lEGO7KdEyugcqZrT9oG1qzGKf1F112E+OJk=; b=QSSiu2kas7ZX2Q4h4yl/Hk2EDo6ea+AJUfPl/s8kpkVALKVOwRjyrQgDiP/eOcmAg8 r5XWlWDeyuElzNyn0tjO3u1KZaewhh8wnAtMl3bog3YYqNmbR9hcoN7vZfHoKwrKDGjK gxecEl7UnuPvdDRikdX/ybRraDo+bdlDdr2HtkDmnusV9LRjU0/s001c3HOuDoWhftof WIGSKC7CEHRnWfgBLjCmZIbvywUfpbtrES+7ly81/BI9JXCHrkXKALA/mSO7QjMB072w vLpPa7j3oG9wgR6MM03QfpdfPQ1nh15v6GV1Xh8acmJ3pjC/iKeXmPIWmuhTJbiieaBp mREQ== X-Gm-Message-State: AOJu0YyD87eDticTAkD/b2qw138hUhXanqNxT+Zf7LeFa4P92Rj72SWt F6zxZcpj/s8qN7i1dIMlDyPAGtQbzoUA/Tixvv+Jy4PH0V5JugsF8sXYw3x+2jPqu4PQaExVD6x yy7ZcFWCQKXT5tq8X2J+T+U6j0DbsZA== X-Google-Smtp-Source: AGHT+IEQzx6bGm09nyJiRHcCS2S4Y45or9DqLRXX2xb+snn8Kn0j4DuL0i+kXUT0Y2QV67llyRJ/pEyG6JzofGvNJVw= X-Received: by 2002:ac2:5111:0:b0:523:772c:2c1c with SMTP id 2adb3069b0e04-52966005f5emr8330608e87.38.1716878954023; Mon, 27 May 2024 23:49:14 -0700 (PDT) MIME-Version: 1.0 References: <75656f1e-4e82-4987-aea1-d0c5602f094c@redhat.com> In-Reply-To: <75656f1e-4e82-4987-aea1-d0c5602f094c@redhat.com> From: Richard Biener Date: Tue, 28 May 2024 08:49:03 +0200 Message-ID: Subject: Re: [PATCH] Strlen pass should set current range query. To: Andrew MacLeod Cc: gcc-patches , "hernandez, aldy" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: On Tue, May 28, 2024 at 1:24=E2=80=AFAM Andrew MacLeod wrote: > > The strlen pass currently has a local ranger instance, but when it > invokes SCEV or any other shared component, SCEV will not be able to > access to this ranger as it uses get_range_query(). They will be stuck > with global ranges. > > Enable/disable ranger should be used instead of a local version which > allows other components to use the current range_query. > > Bootstraps on 86_64-pc-linux-gnu, but there is one regression. The > regression is from gcc.dg/Wstringop-overflow-10.c. the function in > question: > > void > baz (char *a) > { > char b[16] =3D "abcdefg"; > __builtin_strncpy (a, b, __builtin_strnlen (b, 7)); /* { dg-bogus > "specified bound depends on the length of the source argument" } */ > } > > when compiled with -O2 -Wstringop-overflow -Wstringop-truncation > > it now spits out: > > b2.c: In function =E2=80=98baz=E2=80=99: > b2.c:24:3: warning: =E2=80=98__builtin_strncpy=E2=80=99 output 2 truncate= d before > terminating nul copying bytes from a string of the same length > [-Wstringop-truncation] > 24 | __builtin_strncpy (a, b, __builtin_strnlen (b, 7)); /* { > dg-bogus "specified bound depends on the length of the source argument" }= */ > > It seems like maybe something got smarter by setting the current range > query and this is a legitimate warning for this line of code? There > will indeed not be a NULL copied as there are 7 characters in the string.= .. > > Is this a testcase issue where this warning should have been issued > before, or am I misunderstanding the warning? I think the warning makes sense in this case. But I'm not sure why the dg-bogus is there, that looks like a valid complaint as well?! I think the patch is OK. Richard. > Andrew > > PS im afraid of adjusting the status quo in this pass... :-P Not > allowing sSCEV to access the current ranger is causing me other issues > with the fix for 115221. This *should* have been a harmless change > sigh. :-( The whole mechanism should just use the current range-query > instad of passing a ranger pointer aorund. But that a much bigger > issue. one thing at a time. > > >