From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114538 invoked by alias); 31 May 2018 16:26:43 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 114525 invoked by uid 89); 31 May 2018 16:26:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=H*i:OYe6SX, H*r:4.86_2, computable, H*i:sk:OAnNnDR X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 May 2018 16:26:41 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1fOQPP-0005sg-1G from joseph_myers@mentor.com ; Thu, 31 May 2018 09:26:39 -0700 Received: from digraph.polyomino.org.uk (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 31 May 2018 17:26:35 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.86_2) (envelope-from ) id 1fOQPL-00018z-2n; Thu, 31 May 2018 16:26:35 +0000 Date: Thu, 31 May 2018 16:26:00 -0000 From: Joseph Myers To: Richard Biener CC: , GCC Development Subject: Re: not computable at load time In-Reply-To: Message-ID: References: <1A72BAC7-9DFB-4F98-9191-DDE896021A41@comcast.net> <5D1DB310-D460-4A04-A0ED-8C9941D8A9F9@comcast.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2018-05/txt/msg00306.txt.bz2 On Tue, 29 May 2018, Richard Biener wrote: > The testcase dates back to some repository creation rev. (egcs?) and > I'm not sure we may compute the difference of addresses of structure > members. So that GCC accepts this is probably not required. Joseph > may have a definitive answer here. My model of constant expressions for GNU C says this sort of subtraction (of two address constants based on the same object or function address) is a symbolic difference constant expression, which should be accepted as constant in initializers as an extension; it should be folded like other offsetof-like constructs. That should not depend on whether the result gets converted to a type of different width. However, the result of converting an address constant pointer to an integer type is only expected to be a constant expression if the resulting type *is* the same width as pointers. -- Joseph S. Myers joseph@codesourcery.com