From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27918 invoked by alias); 10 Apr 2003 20:13:23 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 27540 invoked from network); 10 Apr 2003 20:12:55 -0000 Received: from unknown (HELO faui11.informatik.uni-erlangen.de) (131.188.31.2) by sources.redhat.com with SMTP; 10 Apr 2003 20:12:55 -0000 Received: (from weigand@localhost) by faui11.informatik.uni-erlangen.de (8.9.1/8.1.4-FAU) id WAA11822; Thu, 10 Apr 2003 22:09:35 +0200 (MET DST) From: Ulrich Weigand Message-Id: <200304102009.WAA11822@faui11.informatik.uni-erlangen.de> Subject: Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT To: kenner@vlsi1.ultra.nyu.edu (Richard Kenner) Date: Thu, 10 Apr 2003 20:28:00 -0000 Cc: weigand@immd1.informatik.uni-erlangen.de, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org In-Reply-To: <10304101940.AA01772@vlsi1.ultra.nyu.edu> from "Richard Kenner" at Apr 10, 2003 03:40:53 PM MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2003-04/txt/msg00448.txt.bz2 Richard Kenner wrote: > After extensive discussion, I think the proper thing is for the Ada > front end to set TYPE_USER_ALIGN on all (or nearly all) types, but > not to set DECL_USER_ALIGN on any decls. However, when I looked, I see > that is indeed what it *does* do, so I'm now confused about the problem > you are seeing. Well, it looks like DECL_USER_ALIGN is copied from TYPE_USER_ALIGN in do_type_align (stor-layout.c), called via this call chain: #0 do_type_align (type=0x100001ff000, decl=0x1000025a680) at ../../gcc-head/gcc/stor-layout.c:369 #1 0x0000000080685996 in layout_decl (decl=0x1000025a680, known_align=0) at ../../gcc-head/gcc/stor-layout.c:429 #2 0x00000000806ae7b8 in build_decl (code=VAR_DECL, name=0x10000258438, type=0x100001ff000) at ../../gcc-head/gcc/tree.c:2428 #3 0x0000000080038a88 in create_var_decl (var_name=0x10000258438, asm_name=0x10000258438, type=0x100001ff000, var_init=0x100001ccb40, const_flag=0, public_flag=1, extern_flag=0, static_flag=0, attr_list=0x0) at ../../gcc-head/gcc/ada/utils.c:1290 #4 0x000000008000ae98 in gnat_to_gnu_entity (gnat_entity=1370, gnu_expr=0x100001ccb40, definition=1) at ../../gcc-head/gcc/ada/decl.c:1021 #5 0x0000000080064864 in tree_transform (gnat_node=1376) at ../../gcc-head/gcc/ada/trans.c:773 #6 0x00000000800625b4 in gnat_to_code (gnat_node=1376) at ../../gcc-head/gcc/ada/trans.c:238 #7 0x0000000080075d72 in process_decls (gnat_decls=-99999987, gnat_decls2=0, gnat_end_list=0, pass1p=1, pass2p=1) at ../../gcc-head/gcc/ada/trans.c:4332 #8 0x00000000800712fa in tree_transform (gnat_node=1355) at ../../gcc-head/gcc/ada/trans.c:3229 #9 0x00000000800625b4 in gnat_to_code (gnat_node=1355) at ../../gcc-head/gcc/ada/trans.c:238 #10 0x000000008006256a in gigi (gnat_root=1355, max_gnat_node=1874, number_name=1117, nodes_ptr=0x1000023f010, next_node_ptr=0x100003f7010, prev_node_ptr=0x10000428010, elists_ptr=0x80c4f450, elmts_ptr=0x80c4faa0, strings_ptr=0x80cb1c90, string_chars_ptr=0x80cb0900, list_headers_ptr=0x80cd33b0, number_units=2, file_info_ptr=0x1ffffffee28 "\021á¦0", standard_integer=42, standard_long_long_float=66, standard_exception_type=1033, gigi_operating_mode=0) at ../../gcc-head/gcc/ada/trans.c:221 internal error - unimplemented function unk_lang_create_fundamental_type called. (looks like my gdb doesn't like Ada ...) What happens is that build_decl calls make_node (VAR_DECL), which returns a node with DECL_ALIGN == 1, and subsequently calls layout_decl, which calls do_type_align: static inline void do_type_align (tree type, tree decl) { if (TYPE_ALIGN (type) > DECL_ALIGN (decl)) { DECL_ALIGN (decl) = TYPE_ALIGN (type); DECL_USER_ALIGN (decl) = TYPE_USER_ALIGN (type); } } and since TYPE_ALIGN is 8 and DECL_ALIGN is 1, DECL_USER_ALIGN gets set to TYPE_USER_ALIGN (which is set). Bye, Ulrich -- Dr. Ulrich Weigand weigand@informatik.uni-erlangen.de