From patchwork Fri Dec 21 13:09:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 207810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6F11B2C0094 for ; Sat, 22 Dec 2012 00:10:18 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356700219; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=VQhtrxA G9svuuyzjYQqQjdULEZY=; b=V45oCIyFdWEMIQicAw6/Q8o1QBHLnP5GwTsm5/k FB1NABRoiFAhpdHmBTMOCn9jdOJhy9ctwE+1GvPXtTy8aIFFKRHnGH/a3fKSUUV1 m37toXFcHU64hwlRqVFpRUHsIPfDqdP25NLAKpBOQrZ862QrFtTCdos6ViKOewfZ ZjYs= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iuQs/nZ3xAG0yfhW3GY4aKdgEQcqJZ3uiQsGp/elPXDeHFQjCpGtnCrSYOlo8Q I9WzERxigDBYo38zQv8BVvqggUBOoFzOAwvDEoW5z3wSN4DSdIYNQXXUj26dhvyG Uy6Jz64IptPMjt2t17dkxUcld8/eI5zBLm8odg8B1Qhjs=; Received: (qmail 17128 invoked by alias); 21 Dec 2012 13:10:10 -0000 Received: (qmail 17028 invoked by uid 22791); 21 Dec 2012 13:10:09 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KHOP_RCVD_TRUST, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_TD X-Spam-Check-By: sourceware.org Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 13:10:00 +0000 Received: by mail-wi0-f169.google.com with SMTP id hq12so1925509wib.4 for ; Fri, 21 Dec 2012 05:09:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.122.98 with SMTP id lr2mr23506352wjb.55.1356095398865; Fri, 21 Dec 2012 05:09:58 -0800 (PST) Received: by 10.216.153.132 with HTTP; Fri, 21 Dec 2012 05:09:58 -0800 (PST) Date: Fri, 21 Dec 2012 14:09:58 +0100 Message-ID: Subject: [patch c++]: Fix type_info struct for llp64 targets From: Kai Tietz To: GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, this patch fixes the layout of the info_type-s for llp64 target. We used here 'long' type instead of pointer-scalar-witdth type. That's an issue for llp64 targets. I introduced for that the LONGPTR_T helper-macro, which has either scalar-size of 'long' type, or of 'long long' type's size, if pointer is larger then scalar-size of 'long' type. ChangeLog 2012-12-21 Kai Tietz * rtti.c (LONGPTR_T): New helper-macro. (get_pseudo_ti_init): Initialize offset_type by LONGPTR_T type instead of 'long' type. (create_tinfo_types): Use for offset/flags field LONGPTR_T type instead of 'long' type. Tested for x86_64-w64-mingw32, i686-w64-mingw32, and x86_64-unknown-linux-gnu. Ok for apply? Regards, Kai Index: rtti.c =================================================================== --- rtti.c (Revision 194660) +++ rtti.c (Arbeitskopie) @@ -89,6 +89,12 @@ typedef enum tinfo_kind /* ... abi::__vmi_type_info */ } tinfo_kind; +/* Helper macro to get maximum scalar-width of pointer or of the 'long'-type. + This of interest for llp64 targets. */ +#define LONGPTR_T \ + integer_types[(POINTER_SIZE <= TYPE_PRECISION (integer_types[itk_long]) \ + ? itk_long : itk_long_long)] + /* A vector of all tinfo decls that haven't yet been emitted. */ vec *unemitted_tinfo_decls; @@ -1116,7 +1122,7 @@ get_pseudo_ti_init (tree type, unsigned tk_index) tree binfo = TYPE_BINFO (type); int nbases = BINFO_N_BASE_BINFOS (binfo); vec *base_accesses = BINFO_BASE_ACCESSES (binfo); - tree offset_type = integer_types[itk_long]; + tree offset_type = LONGPTR_T; tree base_inits = NULL_TREE; int ix; vec *init_vec = NULL; @@ -1413,14 +1419,15 @@ create_tinfo_types (void) /* Base class internal helper. Pointer to base type, offset to base, flags. */ { - tree field, fields; + tree field, fields, offset_flags_type; field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE, type_info_ptr_type); fields = field; + offset_flags_type = LONGPTR_T; field = build_decl (BUILTINS_LOCATION, - FIELD_DECL, NULL_TREE, integer_types[itk_long]); + FIELD_DECL, NULL_TREE, offset_flags_type); DECL_CHAIN (field) = fields; fields = field;