From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 7FF1E3858286 for ; Sun, 11 Sep 2022 08:21:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7FF1E3858286 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id y17so8517125ejo.6 for ; Sun, 11 Sep 2022 01:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:to:from:date:from:to:cc:subject:date; bh=qNS9y7ctGKNx4BrJqPo7xoM5DXaZs8hEmH7h/En4qvE=; b=UKautrgof2H8fQaViTVnPbHFXrHQCbiubUiD7gXI3W2jE/R4O9C/YAYj5R5FmRrmI4 38TWL5HmKT+DSpSpF+daCSYYfmj7cQuRYNyA2uF6VBu1XlmLQUdbmAjVTBJHk2rAC2o1 24ngdsPV+7PpWH0EVNpn98WGr1oyBaQPdgbAstLJ5LfhrjbYPHJIWcWgdHRhpIpGWAZQ Sn2X/G51a2RtbIqWHR3FCWlHYTaJVhosV6WxKv7x/GLJ5zqW7xX0rPK5gqkhmoqGbuFB gasX5pXN7kCzo8pXM7aJi8uu3Takv5y1/6/EWBI/BnhhDm0KQ2se5o3JMgFE7Sj1+Fzi SUwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=qNS9y7ctGKNx4BrJqPo7xoM5DXaZs8hEmH7h/En4qvE=; b=wPMRee/rATRm6JxmHG4JwAFVMKea6S6d0S7+Br4ptW6sXf+Km0rVpphWnCg0GmRDne W2vBl0th4PEaMEnt0unmfuLjnKmkJr7S/HKo4wAyqIecZ9CYrvdnCG0vSiuwrU52fXUv H6sQ3ZbXCQtN9AkEQKNrNgFwjFJenWtGED2roY7bqB0DAuSQpoc27SghwwIvGNPwqSP+ rPKM3mbPxghtsUZTp+qYM9jhUsGawrPhoST+vavcoGD5KGqqRAzzPUIB2t+efl1nhjh9 26L8Y1ig/wNkx1eywA5DkPuynJXqBfIQxzytnDjM9ZpKOaZ//q348cuOUOpiOhjTJPac 0OLw== X-Gm-Message-State: ACgBeo3UookCm9suF0bFKoeeRl5WEkxyJruueJEWS0EcwbJBF98UK1wM OjSG9bYOhzsEw2GbYNL4R3Q= X-Google-Smtp-Source: AA6agR4otow/cV4zTj55DYCedgmfaEZ1l2zl8V4T6kq5oPCX5Fuyiw/yOREJuBhxdvbgnox2DUks+A== X-Received: by 2002:a17:907:9717:b0:77b:6f08:9872 with SMTP id jg23-20020a170907971700b0077b6f089872mr3582609ejc.629.1662884472129; Sun, 11 Sep 2022 01:21:12 -0700 (PDT) Received: from ?IPv6:::1? ([2001:871:227:1d92:c45a:1750:2dea:9f89]) by smtp.gmail.com with ESMTPSA id v26-20020a17090606da00b0073dd8e5a39fsm2686946ejb.156.2022.09.11.01.21.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Sep 2022 01:21:11 -0700 (PDT) Date: Sun, 11 Sep 2022 10:21:06 +0200 From: Bernhard Reutner-Fischer To: David Malcolm , David Malcolm via Gcc-patches , Tim Lange , gcc-patches@gcc.gnu.org Subject: =?US-ASCII?Q?Re=3A_=5BPATCH=5D_analyzer=3A_consider_empty_r?= =?US-ASCII?Q?anges_and_zero_byte_accesses_=5BPR106845=5D?= In-Reply-To: <359c4cd9b3afcaffd974883847073bc41aae3e4e.camel@redhat.com> References: <20220910221952.99541-1-mail@tim-lange.me> <359c4cd9b3afcaffd974883847073bc41aae3e4e.camel@redhat.com> Message-ID: <2B5E71EE-0E60-4A19-9546-D0BA7377AD6D@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.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 11 September 2022 10:04:51 CEST, David Malcolm via Gcc-patches wrote: >> +++ b/gcc/testsuite/gcc=2Edg/analyzer/pr106845=2Ec >> @@ -0,0 +1,11 @@ >> +int buf_size; >> + >> +int >> +main (void) >> +{ >> +=C2=A0 char buf[buf_size]; >> + >> +=C2=A0 __builtin_memset (&buf[1], 0, buf_size); >> + >> +=C2=A0 return 0; >> +} > >=2E=2E=2Eit took me a moment to realize that the analyzer "sees" that thi= s is >"main", and thus buf_size is 0=2E Is this a valid assumption? What if I have a lib (preloaded maybe) that sets it to 42? BTW, do we handle -Wl,-init,youre_toast where main isn't the entry point? Just curious=2E=2E thanks, > >Interestingly, if I rename it to not be "main" (and thus buf_size could >be non-zero), we still don't complain: > https://godbolt=2Eorg/z/PezfTo9Mz >Presumably this is a known limitation of the symbolic bounds checking? > >Thanks >Dave >