From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27454 invoked by alias); 21 Dec 2012 15:04:10 -0000 Received: (qmail 27436 invoked by uid 22791); 21 Dec 2012 15:04:09 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_05,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ea0-f174.google.com (HELO mail-ea0-f174.google.com) (209.85.215.174) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 15:04:05 +0000 Received: by mail-ea0-f174.google.com with SMTP id e13so1900524eaa.5 for ; Fri, 21 Dec 2012 07:04:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.221.65 with SMTP id q41mr32442863eep.30.1356102243784; Fri, 21 Dec 2012 07:04:03 -0800 (PST) Received: by 10.14.216.6 with HTTP; Fri, 21 Dec 2012 07:04:03 -0800 (PST) In-Reply-To: References: <50D42823.9030601@oracle.com> <50D42CAB.4090704@oracle.com> <50D42E31.30807@oracle.com> Date: Fri, 21 Dec 2012 15:04:00 -0000 Message-ID: Subject: Re: [patch libstdc++]: Fix LLP64 pointer-size issues for cxxabi, eh_alloc, and hash_bytes From: Gabriel Dos Reis To: Kai Tietz Cc: Paolo Carlini , GCC Patches , "libstdc++" Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2012-12/txt/msg01320.txt.bz2 On Fri, Dec 21, 2012 at 3:48 AM, Kai Tietz wrote: > 2012/12/21 Paolo Carlini : >> On 12/21/2012 10:36 AM, Kai Tietz wrote: >>> >>> well, issue isn't that 'long' is always 'ptrdiff_t'. >> >> But then, if we just change the type without paying attention to size (and >> alignment) aren't we looking for BIG ABI trouble?!? > > Huh? We have ABI-trouble due long is too small to hold a > pointer-diff for llp64. Intended is here 'pointer-size' AFAICS in > code, but with wrong assumption that a 'long' is always long enough. > > Btw I just checked all targets we have right now in gcc. The type > ptrdiff_t is always either 'long', or 'int' (ilp32, lp64), and 'long > long' for LLP64. Means ptrdiff_t gets always equal (or bigger) to > biggest pointer-size for target (AFAICS). > > Kai We must write the codes so that their intents are clear, without requiring lot of reverse engineering every time one looks at them. If we intend offset, then clearly ptrdiff_t is the first choice. Solid reasons must be provided why it can't be ptrdiff_t and such reasons must be part of the code as comments explaining why the obvious thing should be discounted. - Gaby