From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49365 invoked by alias); 29 Sep 2015 06:41:41 -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 49354 invoked by uid 89); 29 Sep 2015 06:41:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 29 Sep 2015 06:41:39 +0000 Received: from HNOCHT02.corp.atmel.com (10.161.30.162) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 29 Sep 2015 08:41:32 +0200 Received: from jaguar.corp.atmel.com (10.161.30.18) by HNOCHT02.corp.atmel.com (10.161.30.162) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 29 Sep 2015 08:41:33 +0200 Date: Tue, 29 Sep 2015 08:18:00 -0000 From: Senthil Kumar Selvaraj To: Jeff Law CC: , , , Subject: Re: [Patch, testsuite] Skip addr_equal-1 if target keeps null pointer checks Message-ID: <20150929064109.GA23062@jaguar.corp.atmel.com> References: <20150928081559.GB14913@jaguar.corp.atmel.com> <5609972A.2020001@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5609972A.2020001@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg02168.txt.bz2 On Mon, Sep 28, 2015 at 01:38:18PM -0600, Jeff Law wrote: > On 09/28/2015 02:15 AM, Senthil Kumar Selvaraj wrote: > >Hi, > > > > The below patch skips gcc.dg/addr_equal-1.c if the target keeps null > > pointer checks. > > > > The test fails for such targets (avr, in my case) because the address > > comparison in the below code does not resolve to a constant, causing > > builtin_constant_p to return false and fail the test. > > > > /* Variables and functions do not share same memory locations otherwise. */ > > if (!__builtin_constant_p ((void *)undef_fn0 == (void *)&undef_var0)) > > abort (); > > > > For targets that delete null pointer checks, the equality comparison expression > > is optimized away to 0, as the code in match.pd knows they can only be > > equal if they are both NULL, which cannot be true since > > flag-delete-null-pointer-checks is on. > > > > For targets that keep null pointer checks, 0 is a valid address and the > > comparison expression is left as is, and that causes a later pass to > > fold the builtin_constant_p to a false value, resulting in the test failure. > This sounds like a failing in the compiler itself, not a testsuite issue. > > Even on a target where objects can be at address 0, you can't have a > variable and a function at the same address. Hmm, symtab_node::equal_address_to, which is where the address equality check happens, has a comment that contradicts your statement, and the function variable overlap check is done after the NULL possibility check. The current code looks like this /* If both symbols may resolve to NULL, we can not really prove them different. */ if (!nonzero_address () && !s2->nonzero_address ()) return 2; /* Except for NULL, functions and variables never overlap. */ if (TREE_CODE (decl) != TREE_CODE (s2->decl)) return 0; Does anyone know why? Regards Senthil