This problem is from my structure reorganization optimization optimization code (simplified and cleaned to illustrate the problem.
Here's what happening below at the high level >From the user program: typedef struct type type_t; struct type { double x; double y; }: I'll be creating: typedef struct type_prime type_prime_t; struct type_prime { double x *; double y *; }; and type_prime_t base_for_type_prime; Later, when running partial redundancy elimination, PRE attempts to access the DECL_FIELD_OFFSET of field x and finds that the the DECL_FIELD_OFFSET is NULL. Note, I suppose I could run gdb to track down in the storage layout code what caused it to bypass place_field (where the offset probably should be initialized) but I'd still not know what I'm doing wrong below. Please, somebody have a look and let me know. Thanks, Gary Oblock ------------------------------------------------------------------------------------ // An alternate method of creating a record type // I tried both ways #define LANG_HOOKS 1 static void create_a_new_type_and_base_var ( Info_t *info, tree type) { // For the sake of this code "ri" is just a place with // interesting stuff about "type" ReorgType_t *ri = get_reorgtype_info ( type, info); if ( ri != NULL ) { #if FROM_HOOKS tree reorg_type_prime = lang_hooks.types.make_type (RECORD_TYPE); #else tree reorg_type_prime = build_variant_type_copy ( type MEM_STAT_DECL); #endif ri->reorg_ver_type = reorg_type_prime; // Code to create name of reorg_type_prime ... irrelevant // : TYPE_NAME ( reorg_type_prime) = get_identifier ( rec_name); // Build the new pointer type fields tree field; tree new_fields = NULL; for ( #if LANG_HOOKS field = TYPE_FIELDS ( type); #else field = TYPE_FIELDS ( reorg_type_prime); #endif field; field = DECL_CHAIN ( field)) { tree tree_type = TREE_TYPE ( field); tree new_fld_type = build_pointer_type ( tree_type); // I use the same name as the field of type tree new_decl = build_decl ( DECL_SOURCE_LOCATION (field), FIELD_DECL, DECL_NAME (field), new_fld_type); DECL_CONTEXT ( new_decl) = reorg_type_prime; layout_decl ( new_decl, 0); // I might be missing a bunch of attributes (see tree-nested.c:899) DECL_CHAIN ( new_decl) = new_fields; new_fields = new_decl; } // store reversed fields into reorg_type_prime (having them in the same // order in as in type makes sense.) TYPE_FIELDS ( reorg_type_prime) = NULL; tree next_fld; for ( field = new_fields; field; field = next_fld ) { next_fld = DECL_CHAIN ( field); DECL_CHAIN ( field) = TYPE_FIELDS ( reorg_type_prime); TYPE_FIELDS ( reorg_type_prime) = field; } // Fix-up the layout layout_type ( reorg_type_prime); // Create the base element for the transformed type. tree base_var = build_decl ( UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, reorg_type_prime); // More name creation code here... irrelevant // : DECL_NAME ( base_var) = get_identifier ( base_name); // Some attributes I really don't understand... TREE_STATIC ( base_var) = 1; TREE_ADDRESSABLE ( base_var) = 1; DECL_NONALIASED ( base_var) = 1; SET_DECL_ALIGN ( base_var, TYPE_ALIGN ( ri->reorg_ver_type)); // Is this necessary guys??? varpool_node::finalize_decl ( base_var); relayout_decl ( base_var); ri->base = base_var; } } CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.