From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id 03A8D3858C27 for ; Wed, 27 Oct 2021 13:30:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03A8D3858C27 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-e7mBW3IPNnOJzpKaZZQTdw-1; Wed, 27 Oct 2021 09:30:34 -0400 X-MC-Unique: e7mBW3IPNnOJzpKaZZQTdw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D3DB362FC; Wed, 27 Oct 2021 13:30:33 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9187860BF1; Wed, 27 Oct 2021 13:30:32 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 19RDUTE31020579 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 15:30:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 19RDUSdB1020578; Wed, 27 Oct 2021 15:30:28 +0200 Date: Wed, 27 Oct 2021 15:30:28 +0200 From: Jakub Jelinek To: Martin Sebor , "sunil.k.pandey" Cc: gcc-patches@gcc.gnu.org, gcc-regression@gcc.gnu.org Subject: Re: [r12-4725 Regression] FAIL: libgomp.c/doacross-1.c (test for excess errors) on Linux/x86_64 Message-ID: <20211027133028.GH304296@tucnak> Reply-To: Jakub Jelinek References: <20211027052219.DD6AF2864700@gskx-2.sc.intel.com> MIME-Version: 1.0 In-Reply-To: <20211027052219.DD6AF2864700@gskx-2.sc.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-regression@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-regression mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2021 13:30:43 -0000 On Tue, Oct 26, 2021 at 10:22:19PM -0700, sunil.k.pandey via Gcc-patches wrote: > FAIL: libgomp.c/doacross-1.c (test for excess errors) At least this one is a clear false positive. int a[256]; ... #pragma omp for schedule(static, 1) ordered (1) nowait for (i = 0; i < 256; i++) { #pragma omp atomic write a[i] = 1; #pragma omp ordered depend(sink: i - 1) if (i) { #pragma omp atomic read l = a[i - 1]; // <-------- Here is the false positive warning: '__atomic_load_4' writing 4 bytes into a region of size 0 overflows the destination [-Wstring-overflow=] // note: at offset [-8589934592, -8] into destination object ‘a’ of size 1024 if (l < 2) abort (); } The loop iterates i from 0 to 255 and the if body is guarded with i != 0, so __atomic_load_4 (&a[i - 1]. Due to the doacross loop vrp doesn't know that the loop iterates from 0 to 256, because different threads are given just some subset of that interval, so it is effectively VARYING. Perhaps it derives some quite useless range from the i - 1 or i + 1 expressions on signed integer, but that doesn't mean the warnings should assume the value is likely to be out of bounds. And there is no warning on the a[i] either (which is also in bounds, but if for the atomic load the warning code thinks i - 1 can be in [-8589934592, -8] range, why doesn't it think that i can be in [-8589934588, -4] range? Jakub