OSDN Git Service

2006-06-04 Eric Christopher <echristo@apple.com>
authorechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 4 Jun 2006 19:50:48 +0000 (19:50 +0000)
committerechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 4 Jun 2006 19:50:48 +0000 (19:50 +0000)
        * stor-layout.c (start_record_layout): Initialize remaining_in_alignment.
        (debug_rli): Output value for remaining_in_alignment.
        (update_alignment_for_field): Unconditionalize
        ms_bitfield_layout_p code. Handle non-bitfield fields. Remove
        extra alignment code.
        (place_field): Don't realign if ms_bitfield_layout_p. Unconditionalize
        ms_bitfield_layout_p code. Rewrite handling of structure fields.
        * tree.h (record_layout_info_s): Remove prev_packed.
        * doc/extend.texi (ms_struct): Add documentation of format.

2006-06-04 Eric Christopher <echristo@apple.com>

        * gcc.dg/attr-ms_struct-1.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114364 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/extend.texi
gcc/stor-layout.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/attr-ms_struct-1.c [new file with mode: 0644]
gcc/tree.h

index d7dcfd1..96f9cea 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-04 Eric Christopher <echristo@apple.com>
+
+       * stor-layout.c (start_record_layout): Initialize remaining_in_alignment.
+       (debug_rli): Output value for remaining_in_alignment.
+       (update_alignment_for_field): Unconditionalize
+       ms_bitfield_layout_p code. Handle non-bitfield fields. Remove
+       extra alignment code.
+       (place_field): Don't realign if ms_bitfield_layout_p. Unconditionalize
+       ms_bitfield_layout_p code. Rewrite handling of structure fields.
+       * tree.h (record_layout_info_s): Remove prev_packed.
+       * doc/extend.texi (ms_struct): Add documentation of format.
+
 2006-06-04  Mark Shinwell  <shinwell@codesourcery.com>
 
        * tree.h: Declare folding_initializer.
 
        PR c++/20103
        * gimplify.c (gimplify_decl_expr): Do not call gimple_add_tmp_var
-       for anonymous variables explicitly declared by front ends. 
+       for anonymous variables explicitly declared by front ends.
 
 2006-05-25  Eric Botcazou  <ebotcazou@adacore.com>
 
        * df-core.c: Added to header comments.
        * df.h (df_ru_bb_info, df_rd_bb_info, df_lr_bb_info,
        df_ur_bb_info, df_urec_bb_info): Added comments.
-       * df-problems (df_ref_bitmap, ru, rd, lr, ur, 
+       * df-problems (df_ref_bitmap, ru, rd, lr, ur,
        urec, ri problems): Fixed header comments.
-       (df_ru_transfer_function): Fixed in-out set dyslexia when copying 
+       (df_ru_transfer_function): Fixed in-out set dyslexia when copying
        code from df_rd_transfer_function.
-       
+
 2006-05-23  Richard Sandiford  <richard@codesourcery.com>
 
        * libgcc2.c (LIBGCC2_MAX_UNITS_PER_WORD): New macro.
 2006-05-23  Andrew MacLeod  <amacleod@redhat.com>
 
        PR c++/26757
-       * tree-ssa-loop-im.c (determine_invariantness_stmt): Use 
+       * tree-ssa-loop-im.c (determine_invariantness_stmt): Use
        add_referenced_var instead of add_referenced_tmp_var.
        * tree-complex.c (create_one_component_var): Use add_referenced_var.
        * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
        isn't already in the hash table.
        (add_referenced_tmp_var): Remove.
        (find_new_referenced_vars_1): Use add_referenced_var.
-       * tree-ssa-pre.c (create_expression_by_pieces, 
+       * tree-ssa-pre.c (create_expression_by_pieces,
        insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
        Use add_referenced_var.
        * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
        * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
-       lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use 
+       lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
        add_referenced_var.
        * tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
        vect_create_data_ref_ptr, vect_create_destination_var,
-       vect_init_vector, vect_build_loop_niters, 
+       vect_init_vector, vect_build_loop_niters,
        vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
        vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
        Use add_referenced_var.
        * tree-outof-ssa.c (create_temp): Use add_referenced_var.
        * tree-flow.h (add_referenced_tmp_var): Remove prototype
        (add_referenced_var): Add prototype.
-       * tree-ssa-structalias.c (get_constraint_for, 
+       * tree-ssa-structalias.c (get_constraint_for,
        intra_create_variable_infos): Use add_referenced_var.
 
 2006-05-23  Alexandre Oliva  <aoliva@redhat.com>
        to gen set.
        (df_ru_bb_local_compute): Reversed statements and removed bogus
        comment explaining why they should be in wrong order.
-       (df_ru_dump, df_rd_dump): Enhanced debug info.     
+       (df_ru_dump, df_rd_dump): Enhanced debug info.
        * modulo-sched.c (sms_schedule, tree_opt_pass pass_sms): Enhanced
-       debug info.       
+       debug info.
        * ddg.c (add_deps_for_def): Converted use of reaching defs to
        reaching uses and fixed space problem.
 
 
        * config/avr/avr.c (avr_mcu_types): Add support for attiny261,
        attiny461, attiny861, attiny25, attiny45, attiny85, attiny24,
-       attiny44, attiny84, at90pwm2, at90pwm3, atmega165p, atmega169p, 
-       atmega164p, atmega324p, atmega644p, atmega644, atmega329, 
-       atmega3290, atmega649, atmega6490, atmega406, atmega640, 
-       atmega1280, atmega1281, at90can32, at90can64, at90usb646, 
-       at90usb647, at90usb1286 and at90usb1287 devices.  
+       attiny44, attiny84, at90pwm2, at90pwm3, atmega165p, atmega169p,
+       atmega164p, atmega324p, atmega644p, atmega644, atmega329,
+       atmega3290, atmega649, atmega6490, atmega406, atmega640,
+       atmega1280, atmega1281, at90can32, at90can64, at90usb646,
+       at90usb647, at90usb1286 and at90usb1287 devices.
        * config/avr/avr.h (LINK_SPEC, CRT_BINUTILS_SPECS): (Ditto.).
        * config/avr/t-avr (MULTILIB_MATCHES): (Ditto.).
 
        (df_ref_record_1): Changed DF_REF_CLOBBER into DF_REF_MUST_CLOBBER
        and set DF_REF_PARTIAL.
        (df_defs_record): Changed DF_REF_CLOBBER into DF_REF_MUST_CLOBBER.
-       (df_uses_record): Added DF_REF_PARTIAL for subreg. 
+       (df_uses_record): Added DF_REF_PARTIAL for subreg.
        (df_scan_add_problem): Added flags parameter.
        (df_ref_create_structure): Changed switching structure.
        (df_bb_refs_record): Fixed case where duplicate artificial refs
        (df_record_exit_block_uses, df_insn_refs_record): Changed location of flags.
        (df_set_state): Removed function.
        (df_grow_reg_info, df_reg_chain_unlink, df_ref_remove,
-       df_insn_create_insn_record, df_insn_refs_delete, 
-       df_ref_create_structure): Formatting changes.  
+       df_insn_create_insn_record, df_insn_refs_delete,
+       df_ref_create_structure): Formatting changes.
        * df-core.c (df_mvs_dump, df_set_flags, df_clear_flags,
        df_delete_basic_block): New function.
        (df_init): Changed location of flags.
        (df_prune_to_subcfg): Made public.
        (df_analyze_problem): Added blocks_to_init parameter and made
        public.
-       (df_ref_record, df_bb_refs_record, df_mark_reg, 
+       (df_ref_record, df_bb_refs_record, df_mark_reg,
         df_record_exit_block_uses): Whitespace changes.
        (df_dump): Whitespace changes.
        * df.h: Some reordering to remove forward references.
        * dwarf2out.c (dwarf2_name): Use the dwarf_name language hook.
        * ada/misc.c (gnat_dwarf_name): New function.
        (LANG_HOOKS_DWARF_NAME): Define to gnat_dwarf_name.
-       
+
 2006-05-19  Richard Sandiford  <richard@codesourcery.com>
 
        * libgcc2.c (MIN_UNITS_PER_WORD): Move default definition from
index 08e9443..47b1fce 100644 (file)
@@ -33,7 +33,7 @@ extensions, accepted by GCC in C89 mode and in C++.
 * Conditionals::        Omitting the middle operand of a @samp{?:} expression.
 * Long Long::          Double-word integers---@code{long long int}.
 * Complex::             Data types for complex numbers.
-* Decimal Float::      Decimal Floating Point. 
+* Decimal Float::      Decimal Floating Point.
 * Hex Floats::          Hexadecimal floating-point constants.
 * Zero Length::         Zero-length arrays.
 * Variable Length::     Arrays whose length is computed at run time.
@@ -3189,7 +3189,7 @@ attribute can also be applied to global C++ objects that are initialized
 by a constructor.  In this case, the static initialization and destruction
 code for the object is emitted in each translation defining the object,
 but the calls to the constructor and destructor are protected by a
-link-once guard variable. 
+link-once guard variable.
 
 The @code{selectany} attribute is only available on Microsoft Windows
 targets.  You can use @code{__declspec (selectany)} as a synonym for
@@ -3246,6 +3246,117 @@ either format.
 
 Currently @option{-m[no-]ms-bitfields} is provided for the Microsoft Windows X86
 compilers to match the native Microsoft compiler.
+
+The Microsoft structure layout algorithm is fairly simple with the exception
+of the bitfield packing:
+
+The padding and alignment of members of structures and whether a bit field
+can straddle a storage-unit boundary
+
+@enumerate
+@item Structure members are stored sequentially in the order in which they are
+declared: the first member has the lowest memory address and the last member
+the highest.
+
+@item Every data object has an alignment-requirement. The alignment-requirement
+for all data except structures, unions, and arrays is either the size of the
+object or the current packing size (specified with either the aligned attribute
+or the pack pragma), whichever is less. For structures,  unions, and arrays,
+the alignment-requirement is the largest alignment-requirement of its members.
+Every object is allocated an offset so that:
+
+offset %  alignment-requirement == 0
+
+@item Adjacent bit fields are packed into the same 1-, 2-, or 4-byte allocation
+unit if the integral types are the same size and if the next bit field fits
+into the current allocation unit without crossing the boundary imposed by the
+common alignment requirements of the bit fields.
+@end enumerate
+
+Handling of zero-length bitfields:
+
+MSVC interprets zero-length bitfields in the following ways:
+
+@enumerate
+@item If a zero-length bitfield is inserted between two bitfields that would
+normally be coalesced, the bitfields will not be coalesced.
+
+For example:
+
+@smallexample
+struct
+ @{
+   unsigned long bf_1 : 12;
+   unsigned long : 0;
+   unsigned long bf_2 : 12;
+ @} t1;
+@end smallexample
+
+The size of @code{t1} would be 8 bytes with the zero-length bitfield.  If the
+zero-length bitfield were removed, @code{t1}'s size would be 4 bytes.
+
+@item If a zero-length bitfield is inserted after a bitfield, @code{foo}, and the
+alignment of the zero-length bitfield is greater than the member that follows it,
+@code{bar}, @code{bar} will be aligned as the type of the zero-length bitfield.
+
+For example:
+
+@smallexample
+struct
+ @{
+   char foo : 4;
+   short : 0;
+   char bar;
+ @} t2;
+
+struct
+ @{
+   char foo : 4;
+   short : 0;
+   double bar;
+ @} t3;
+@end smallexample
+
+For @code{t2}, @code{bar} will be placed at offset 2, rather than offset 1.
+Accordingly, the size of @code{t2} will be 4.  For @code{t3}, the zero-length
+bitfield will not affect the alignment of @code{bar} or, as a result, the size
+of the structure.
+
+Taking this into account, it is important to note the following:
+
+@enumerate
+@item If a zero-length bitfield follows a normal bitfield, the type of the
+zero-length bitfield may affect the alignment of the structure as whole. For
+example, @code{t2} has a size of 4 bytes, since the zero-length bitfield follows a
+normal bitfield, and is of type short.
+
+@item Even if a zero-length bitfield is not followed by a normal bitfield, it may
+still affect the alignment of the structure:
+
+@smallexample
+struct
+ @{
+   char foo : 6;
+   long : 0;
+ @} t4;
+@end smallexample
+
+Here, @code{t4} will take up 4 bytes.
+@end enumerate
+
+@item Zero-length bitfields following non-bitfield members are ignored:
+
+@smallexample
+struct
+ @{
+   char foo;
+   long : 0;
+   char bar;
+ @} t5;
+@end smallexample
+
+Here, @code{t5} will take up 2 bytes.
+@end enumerate
 @end table
 
 @subsection Xstormy16 Variable Attributes
@@ -4820,7 +4931,7 @@ These builtins perform an atomic compare and swap.  That is, if the current
 value of @code{*@var{ptr}} is @var{oldval}, then write @var{newval} into
 @code{*@var{ptr}}.
 
-The ``bool'' version returns true if the comparison is successful and 
+The ``bool'' version returns true if the comparison is successful and
 @var{newval} was written.  The ``val'' version returns the contents
 of @code{*@var{ptr}} before the operation.
 
@@ -4844,7 +4955,7 @@ is implementation defined.
 This builtin is not a full barrier, but rather an @dfn{acquire barrier}.
 This means that references after the builtin cannot move to (or be
 speculated to) before the builtin, but previous memory stores may not
-be globally visible yet, and previous memory loads may not yet be 
+be globally visible yet, and previous memory loads may not yet be
 satisfied.
 
 @item void __sync_lock_release (@var{type} *ptr, ...)
@@ -9573,7 +9684,7 @@ aliases.
 @cindex pragma, weak
 This pragma declares @var{symbol} to be weak, as if the declaration
 had the attribute of the same name.  The pragma may appear before
-or after the declaration of @var{symbol}, but must appear before 
+or after the declaration of @var{symbol}, but must appear before
 either its first use or its definition.  It is not an error for
 @var{symbol} to never be defined at all.
 
index b95e075..c58237f 100644 (file)
@@ -300,10 +300,10 @@ layout_decl (tree decl, unsigned int known_align)
 
   if (code == CONST_DECL)
     return;
-  
+
   gcc_assert (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL
              || code == TYPE_DECL ||code == FIELD_DECL);
-  
+
   rtl = DECL_RTL_IF_SET (decl);
 
   if (type == error_mark_node)
@@ -538,6 +538,7 @@ start_record_layout (tree t)
   rli->prev_field = 0;
   rli->pending_statics = 0;
   rli->packed_maybe_necessary = 0;
+  rli->remaining_in_alignment = 0;
 
   return rli;
 }
@@ -549,7 +550,7 @@ tree
 bit_from_pos (tree offset, tree bitpos)
 {
   return size_binop (PLUS_EXPR, bitpos,
-                    size_binop (MULT_EXPR, 
+                    size_binop (MULT_EXPR,
                                 fold_convert (bitsizetype, offset),
                                 bitsize_unit_node));
 }
@@ -590,7 +591,7 @@ normalize_offset (tree *poffset, tree *pbitpos, unsigned int off_align)
 
       *poffset
        = size_binop (PLUS_EXPR, *poffset,
-                     size_binop (MULT_EXPR, 
+                     size_binop (MULT_EXPR,
                                  fold_convert (sizetype, extra_aligns),
                                  size_int (off_align / BITS_PER_UNIT)));
 
@@ -611,6 +612,11 @@ debug_rli (record_layout_info rli)
   fprintf (stderr, "\naligns: rec = %u, unpack = %u, off = %u\n",
           rli->record_align, rli->unpacked_align,
           rli->offset_align);
+
+  /* The ms_struct code is the only that uses this.  */
+  if (targetm.ms_bitfield_layout_p (rli->t))
+    fprintf (stderr, "remaning in alignment = %u\n", rli->remaining_in_alignment);
+
   if (rli->packed_maybe_necessary)
     fprintf (stderr, "packed may be necessary\n");
 
@@ -679,7 +685,7 @@ update_alignment_for_field (record_layout_info rli, tree field,
   /* Record must have at least as much alignment as any field.
      Otherwise, the alignment of the field within the record is
      meaningless.  */
-  if (is_bitfield && targetm.ms_bitfield_layout_p (rli->t))
+  if (targetm.ms_bitfield_layout_p (rli->t))
     {
       /* Here, the alignment of the underlying type of a bitfield can
         affect the alignment of a record; even a zero-sized field
@@ -687,11 +693,12 @@ update_alignment_for_field (record_layout_info rli, tree field,
         the type, except that for zero-size bitfields this only
         applies if there was an immediately prior, nonzero-size
         bitfield.  (That's the way it is, experimentally.) */
-      if (! integer_zerop (DECL_SIZE (field))
-         ? ! DECL_PACKED (field)
-         : (rli->prev_field
-            && DECL_BIT_FIELD_TYPE (rli->prev_field)
-            && ! integer_zerop (DECL_SIZE (rli->prev_field))))
+      if (!is_bitfield
+         || (!integer_zerop (DECL_SIZE (field))
+             ? !DECL_PACKED (field)
+             : (rli->prev_field
+                && DECL_BIT_FIELD_TYPE (rli->prev_field)
+                && ! integer_zerop (DECL_SIZE (rli->prev_field)))))
        {
          unsigned int type_align = TYPE_ALIGN (type);
          type_align = MAX (type_align, desired_align);
@@ -699,18 +706,6 @@ update_alignment_for_field (record_layout_info rli, tree field,
            type_align = MIN (type_align, maximum_field_alignment);
          rli->record_align = MAX (rli->record_align, type_align);
          rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
-         /* If we start a new run, make sure we start it properly aligned.  */
-         if ((!rli->prev_field
-              || integer_zerop (DECL_SIZE (field))
-              || integer_zerop (DECL_SIZE (rli->prev_field))
-              || !host_integerp (DECL_SIZE (rli->prev_field), 0)
-              || !host_integerp (TYPE_SIZE (type), 0)
-              || !simple_cst_equal (TYPE_SIZE (type),
-                                    TYPE_SIZE (TREE_TYPE (rli->prev_field)))
-              || (rli->remaining_in_alignment
-                  < tree_low_cst (DECL_SIZE (field), 0)))
-             && desired_align < type_align)
-           desired_align = type_align;
        }
     }
 #ifdef PCC_BITFIELD_TYPE_MATTERS
@@ -779,7 +774,7 @@ place_union_field (record_layout_info rli, tree field)
   DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;
   SET_DECL_OFFSET_ALIGN (field, BIGGEST_ALIGNMENT);
 
-  /* If this is an ERROR_MARK return *after* having set the 
+  /* If this is an ERROR_MARK return *after* having set the
      field at the start of the union. This helps when parsing
      invalid fields. */
   if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK)
@@ -857,7 +852,7 @@ place_field (record_layout_info rli, tree field)
       return;
     }
 
-  else if (TREE_CODE (type) == ERROR_MARK) 
+  else if (TREE_CODE (type) == ERROR_MARK)
     {
       /* Place this field at the current allocation position, so we
         maintain monotonicity.  */
@@ -904,8 +899,10 @@ place_field (record_layout_info rli, tree field)
     }
 
   /* Does this field automatically have alignment it needs by virtue
-     of the fields that precede it and the record's own alignment?  */
-  if (known_align < desired_align)
+     of the fields that precede it and the record's own alignment?
+     We already align ms_struct fields, so don't re-align them.  */
+  if (known_align < desired_align
+      && !targetm.ms_bitfield_layout_p (rli->t))
     {
       /* No, we need to skip space before this field.
         Bump the cumulative size to multiple of field alignment.  */
@@ -1022,17 +1019,12 @@ place_field (record_layout_info rli, tree field)
      Note: for compatibility, we use the type size, not the type alignment
      to determine alignment, since that matches the documentation */
 
-  if (targetm.ms_bitfield_layout_p (rli->t)
-       && ((DECL_BIT_FIELD_TYPE (field) && ! DECL_PACKED (field))
-         || (rli->prev_field && ! DECL_PACKED (rli->prev_field))))
+  if (targetm.ms_bitfield_layout_p (rli->t))
     {
-      /* At this point, either the prior or current are bitfields,
-        (possibly both), and we're dealing with MS packing.  */
       tree prev_saved = rli->prev_field;
 
-      /* Is the prior field a bitfield?  If so, handle "runs" of same
-        type size fields.  */
-      if (rli->prev_field /* necessarily a bitfield if it exists.  */)
+      /* This is a bitfield if it exists.  */
+      if (rli->prev_field)
        {
          /* If both are bitfields, nonzero, and the same size, this is
             the middle of a run.  Zero declared size fields are special
@@ -1051,34 +1043,22 @@ place_field (record_layout_info rli, tree field)
              /* We're in the middle of a run of equal type size fields; make
                 sure we realign if we run out of bits.  (Not decl size,
                 type size!) */
-             HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 0);
+             HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 1);
 
              if (rli->remaining_in_alignment < bitsize)
                {
-                 /* If PREV_FIELD is packed, and we haven't lumped
-                    non-packed bitfields with it, treat this as if PREV_FIELD
-                    was not a bitfield.  This avoids anomalies where a packed
-                    bitfield with long long base type can take up more
-                    space than a same-size bitfield with base type short.  */
-                 if (rli->prev_packed)
-                   rli->prev_field = prev_saved = NULL;
-                 else
-                   {
-                     /* out of bits; bump up to next 'word'.  */
-                     rli->offset = DECL_FIELD_OFFSET (rli->prev_field);
-                     rli->bitpos
-                       = size_binop (PLUS_EXPR, TYPE_SIZE (type),
-                                     DECL_FIELD_BIT_OFFSET (rli->prev_field));
-                     rli->prev_field = field;
-                     rli->remaining_in_alignment
-                       = tree_low_cst (TYPE_SIZE (type), 0) - bitsize;
-                   }
+                 /* out of bits; bump up to next 'word'.  */
+                 rli->offset = DECL_FIELD_OFFSET (rli->prev_field);
+                 rli->bitpos
+                   = size_binop (PLUS_EXPR, TYPE_SIZE (type),
+                                 DECL_FIELD_BIT_OFFSET (rli->prev_field));
+                 rli->prev_field = field;
+                 rli->remaining_in_alignment
+                   = tree_low_cst (TYPE_SIZE (type), 1);
                }
-             else
-               rli->remaining_in_alignment -= bitsize;
+
+             rli->remaining_in_alignment -= bitsize;
            }
-         else if (rli->prev_packed)
-           rli->prev_field = prev_saved = NULL;
          else
            {
              /* End of a run: if leaving a run of bitfields of the same type
@@ -1090,18 +1070,12 @@ place_field (record_layout_info rli, tree field)
                 Note: since the beginning of the field was aligned then
                 of course the end will be too.  No round needed.  */
 
-             if (!integer_zerop (DECL_SIZE (rli->prev_field)))
+             if (!integer_zerop (DECL_SIZE (rli->prev_field))
+                 && rli->remaining_in_alignment)
                {
-                 tree type_size = TYPE_SIZE (TREE_TYPE (rli->prev_field));
-
-                 /* If the desired alignment is greater or equal to TYPE_SIZE,
-                    we have already adjusted rli->bitpos / rli->offset above.
-                  */
-                 if ((unsigned HOST_WIDE_INT) tree_low_cst (type_size, 0)
-                     > desired_align)
-                   rli->bitpos
-                     = size_binop (PLUS_EXPR, type_size,
-                                   DECL_FIELD_BIT_OFFSET (rli->prev_field));
+                 rli->bitpos
+                   = size_binop (PLUS_EXPR, rli->bitpos,
+                                 bitsize_int (rli->remaining_in_alignment));
                }
              else
                /* We "use up" size zero fields; the code below should behave
@@ -1115,7 +1089,6 @@ place_field (record_layout_info rli, tree field)
                rli->prev_field = NULL;
            }
 
-         rli->prev_packed = 0;
          normalize_rli (rli);
         }
 
@@ -1148,21 +1121,11 @@ place_field (record_layout_info rli, tree field)
              && host_integerp (TYPE_SIZE (TREE_TYPE (field)), 0)
              && host_integerp (DECL_SIZE (field), 0))
            rli->remaining_in_alignment
-             = tree_low_cst (TYPE_SIZE (TREE_TYPE(field)), 0)
-               - tree_low_cst (DECL_SIZE (field), 0);
+             = tree_low_cst (TYPE_SIZE (TREE_TYPE(field)), 1)
+               - tree_low_cst (DECL_SIZE (field), 1);
 
          /* Now align (conventionally) for the new type.  */
-         if (!DECL_PACKED(field))
-           type_align = MAX(TYPE_ALIGN (type), type_align);
-
-         if (prev_saved
-             && DECL_BIT_FIELD_TYPE (prev_saved)
-             /* If the previous bit-field is zero-sized, we've already
-                accounted for its alignment needs (or ignored it, if
-                appropriate) while placing it.  */
-             && ! integer_zerop (DECL_SIZE (prev_saved)))
-           type_align = MAX (type_align,
-                             TYPE_ALIGN (TREE_TYPE (prev_saved)));
+         type_align = TYPE_ALIGN (TREE_TYPE (field));
 
          if (maximum_field_alignment != 0)
            type_align = MIN (type_align, maximum_field_alignment);
@@ -1202,49 +1165,8 @@ place_field (record_layout_info rli, tree field)
   if (known_align != actual_align)
     layout_decl (field, actual_align);
 
-  if (DECL_BIT_FIELD_TYPE (field))
-    {
-      unsigned int type_align = TYPE_ALIGN (type);
-      unsigned int mfa = maximum_field_alignment;
-
-      if (integer_zerop (DECL_SIZE (field)))
-        mfa = initial_max_fld_align * BITS_PER_UNIT;
-
-      /* Only the MS bitfields use this.  We used to also put any kind of
-        packed bit fields into prev_field, but that makes no sense, because
-        an 8 bit packed bit field shouldn't impose more restriction on
-        following fields than a char field, and the alignment requirements
-        are also not fulfilled.
-        There is no sane value to set rli->remaining_in_alignment to when
-        a packed bitfield in prev_field is unaligned.  */
-      if (mfa != 0)
-       type_align = MIN (type_align, mfa);
-      gcc_assert (rli->prev_field
-                 || actual_align >= type_align || DECL_PACKED (field)
-                 || integer_zerop (DECL_SIZE (field))
-                 || !targetm.ms_bitfield_layout_p (rli->t));
-      if (rli->prev_field == NULL && actual_align >= type_align
-         && !integer_zerop (DECL_SIZE (field)))
-       {
-         rli->prev_field = field;
-         /* rli->remaining_in_alignment has not been set if the bitfield
-            has size zero, or if it is a packed bitfield.  */
-         rli->remaining_in_alignment
-           = (tree_low_cst (TYPE_SIZE (TREE_TYPE (field)), 0)
-              - tree_low_cst (DECL_SIZE (field), 0));
-         rli->prev_packed = DECL_PACKED (field);
-
-       }
-      else if (rli->prev_field && DECL_PACKED (field))
-       {
-         HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 0);
-
-         if (rli->remaining_in_alignment < bitsize)
-           rli->prev_field = NULL;
-         else
-           rli->remaining_in_alignment -= bitsize;
-       }
-    }
+  if (rli->prev_field == NULL && DECL_BIT_FIELD_TYPE (field))
+    rli->prev_field = field;
 
   /* Now add size of this field to the size of the record.  If the size is
      not constant, treat the field as being a multiple of bytes and just
@@ -1268,6 +1190,21 @@ place_field (record_layout_info rli, tree field)
       rli->bitpos = bitsize_zero_node;
       rli->offset_align = MIN (rli->offset_align, desired_align);
     }
+  else if (targetm.ms_bitfield_layout_p (rli->t))
+    {
+      rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field));
+
+      /* If we ended a bitfield before the full length of the type then
+        pad the struct out to the full length of the last type.  */
+      if ((TREE_CHAIN (field) == NULL
+          || TREE_CODE (TREE_CHAIN (field)) != FIELD_DECL)
+         && DECL_BIT_FIELD_TYPE (field)
+         && !integer_zerop (DECL_SIZE (field)))
+       rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos,
+                                 bitsize_int (rli->remaining_in_alignment));
+
+      normalize_rli (rli);
+    }
   else
     {
       rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field));
@@ -1796,7 +1733,7 @@ layout_type (tree type)
              length = size_binop (MAX_EXPR, length, size_zero_node);
 
            TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
-                                          fold_convert (bitsizetype, 
+                                          fold_convert (bitsizetype,
                                                         length));
 
            /* If we know the size of the element, calculate the total
@@ -1994,11 +1931,11 @@ set_sizetype (tree type)
   TREE_TYPE (TYPE_CACHED_VALUES (t)) = type;
   TYPE_UID (t) = TYPE_UID (sizetype);
   TYPE_IS_SIZETYPE (t) = 1;
-  
+
   /* Replace our original stub sizetype.  */
   memcpy (sizetype, t, tree_size (sizetype));
   TYPE_MAIN_VARIANT (sizetype) = sizetype;
-  
+
   t = make_node (INTEGER_TYPE);
   TYPE_NAME (t) = get_identifier ("bit_size_type");
   /* We do want to use bitsizetype's cache, as we will be replacing that
@@ -2012,7 +1949,7 @@ set_sizetype (tree type)
   /* Replace our original stub bitsizetype.  */
   memcpy (bitsizetype, t, tree_size (bitsizetype));
   TYPE_MAIN_VARIANT (bitsizetype) = bitsizetype;
-  
+
   if (TYPE_UNSIGNED (type))
     {
       fixup_unsigned_type (bitsizetype);
@@ -2158,14 +2095,14 @@ fixup_unsigned_type (tree type)
    larger than LARGEST_MODE (usually SImode).
 
    If no mode meets all these conditions, we return VOIDmode.
-   
+
    If VOLATILEP is false and SLOW_BYTE_ACCESS is false, we return the
    smallest mode meeting these conditions.
 
    If VOLATILEP is false and SLOW_BYTE_ACCESS is true, we return the
    largest mode (but a mode no wider than UNITS_PER_WORD) that meets
    all the conditions.
-   
+
    If VOLATILEP is true the narrow_volatile_bitfields target hook is used to
    decide which of the above modes should be used.  */
 
index a1f5273..43d0d66 100644 (file)
@@ -1,3 +1,7 @@
+2006-06-04 Eric Christopher <echristo@apple.com>
+
+       * gcc.dg/attr-ms_struct-1.c: New.
+
 2006-06-04  Mark Shinwell  <shinwell@codesourcery.com>
 
        * gcc.c-torture/compile/builtin_constant_p.c: New test.
diff --git a/gcc/testsuite/gcc.dg/attr-ms_struct-1.c b/gcc/testsuite/gcc.dg/attr-ms_struct-1.c
new file mode 100644 (file)
index 0000000..eafab93
--- /dev/null
@@ -0,0 +1,164 @@
+/* Test for MS structure sizes.  */
+/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } }
+/* { dg-options "-std=gnu99" } */
+
+extern void abort ();
+
+#define ATTR __attribute__((__ms_struct__))
+
+#define size_struct_0 1
+#define size_struct_1 4
+#define size_struct_2 24
+#define size_struct_3 8
+#define size_struct_4 32
+#define size_struct_5 12
+#define size_struct_6 40
+#define size_struct_7 8
+#define size_struct_8 20
+#define size_struct_9 32
+
+struct _struct_0
+{
+  char member_0;
+} ATTR;
+typedef struct _struct_0 struct_0;
+
+struct _struct_1
+{
+  char member_0;
+  short member_1:13;
+} ATTR;
+typedef struct _struct_1 struct_1;
+
+struct _struct_2
+{
+  double member_0;
+  unsigned char member_1:8;
+  long member_2:32;
+  unsigned char member_3:5;
+  short member_4:14;
+  short member_5:13;
+  unsigned char:0;
+} ATTR;
+typedef struct _struct_2 struct_2;
+
+struct _struct_3
+{
+  unsigned long member_0:26;
+  unsigned char member_1:2;
+
+} ATTR;
+typedef struct _struct_3 struct_3;
+
+struct _struct_4
+{
+  unsigned char member_0:7;
+  double member_1;
+  double member_2;
+  short member_3:5;
+  char member_4:2;
+
+} ATTR;
+typedef struct _struct_4 struct_4;
+
+struct _struct_5
+{
+  unsigned short member_0:12;
+  long member_1:1;
+  unsigned short member_2:6;
+
+} ATTR;
+typedef struct _struct_5 struct_5;
+
+struct _struct_6
+{
+  unsigned char member_0:7;
+  unsigned long member_1:25;
+  char member_2:1;
+  double member_3;
+  short member_4:9;
+  double member_5;
+
+} ATTR;
+typedef struct _struct_6 struct_6;
+
+struct _struct_7
+{
+  double member_0;
+
+} ATTR;
+typedef struct _struct_7 struct_7;
+
+struct _struct_8
+{
+  unsigned char member_0:7;
+  long member_1:11;
+  long member_2:5;
+  long:0;
+  char member_4:8;
+  unsigned short member_5:4;
+  unsigned char member_6:3;
+  long member_7:23;
+
+} ATTR;
+typedef struct _struct_8 struct_8;
+
+struct _struct_9
+{
+  double member_0;
+  unsigned long member_1:6;
+  long member_2:17;
+  double member_3;
+  unsigned long member_4:22;
+
+} ATTR;
+typedef struct _struct_9 struct_9;
+
+struct_0 test_struct_0 = { 123 };
+struct_1 test_struct_1 = { 82, 1081 };
+struct_2 test_struct_2 = { 20.0, 31, 407760, 1, 14916, 6712 };
+struct_3 test_struct_3 = { 64616999, 1 };
+struct_4 test_struct_4 = { 61, 20.0, 20.0, 12, 0 };
+struct_5 test_struct_5 = { 909, 1, 57 };
+struct_6 test_struct_6 = { 12, 21355796, 0, 20.0, 467, 20.0 };
+struct_7 test_struct_7 = { 20.0 };
+struct_8 test_struct_8 = { 126, 1821, 22, 125, 6, 0, 2432638 };
+struct_9 test_struct_9 = { 20.0, 3, 23957, 20.0, 1001631 };
+
+
+int
+main (void)
+{
+
+  if (size_struct_0 != sizeof (struct_0))
+    abort ();
+
+  if (size_struct_1 != sizeof (struct_1))
+    abort ();
+
+  if (size_struct_2 != sizeof (struct_2))
+    abort ();
+
+  if (size_struct_3 != sizeof (struct_3))
+    abort ();
+
+  if (size_struct_4 != sizeof (struct_4))
+    abort ();
+
+  if (size_struct_5 != sizeof (struct_5))
+    abort ();
+
+  if (size_struct_6 != sizeof (struct_6))
+    abort ();
+
+  if (size_struct_7 != sizeof (struct_7))
+    abort ();
+
+  if (size_struct_8 != sizeof (struct_8))
+    abort ();
+
+  if (size_struct_9 != sizeof (struct_9))
+    abort ();
+
+  return 0;
+}
index b377e38..9c11818 100644 (file)
@@ -107,7 +107,7 @@ extern const enum tree_code_class tree_code_type[];
   (TREE_CODE (CODE) == STRUCT_FIELD_TAG                \
    || TREE_CODE (CODE) == NAME_MEMORY_TAG      \
    || TREE_CODE (CODE) == SYMBOL_MEMORY_TAG)
-        
+
 
 /* Nonzero if DECL represents a VAR_DECL or FUNCTION_DECL.  */
 
@@ -293,7 +293,7 @@ enum omp_clause_code
   /* OpenMP clause: reduction (operator:variable_list).
      OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator.
      Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var.
-     Operand 2: OMP_CLAUSE_REDUCTION_MERGE: Stmt-list to merge private var 
+     Operand 2: OMP_CLAUSE_REDUCTION_MERGE: Stmt-list to merge private var
                 into the shared one.
      Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER: A dummy VAR_DECL
                 placeholder used in OMP_CLAUSE_REDUCTION_MERGE.  */
@@ -773,7 +773,7 @@ enum tree_node_structure_enum {
     &__t->exp.operands[__i]; }))
 
 extern void tree_contains_struct_check_failed (const tree,
-                                              const enum tree_node_structure_enum,                                  
+                                              const enum tree_node_structure_enum,
                                               const char *, int, const char *)
   ATTRIBUTE_NORETURN;
 
@@ -1160,7 +1160,7 @@ extern void omp_clause_range_check_failed (const tree, const char *, int,
 /* Nonzero in a _DECL if the name is used in its scope.
    Nonzero in an expr node means inhibit warning if value is unused.
    In IDENTIFIER_NODEs, this means that some extern decl for this name
-   was used.  
+   was used.
    In a BLOCK, this means that the block contains variables that are used.  */
 #define TREE_USED(NODE) ((NODE)->common.used_flag)
 
@@ -1730,10 +1730,10 @@ struct tree_ssa_name GTY(())
 \f
 /* In a PHI_NODE node.  */
 
-/* These 2 macros should be considered off limits for use by developers.  If 
-   you wish to access the use or def fields of a PHI_NODE in the SSA 
-   optimizers, use the accessor macros found in tree-ssa-operands.h.  
-   These two macros are to be used only by those accessor macros, and other 
+/* These 2 macros should be considered off limits for use by developers.  If
+   you wish to access the use or def fields of a PHI_NODE in the SSA
+   optimizers, use the accessor macros found in tree-ssa-operands.h.
+   These two macros are to be used only by those accessor macros, and other
    select places where we *absolutely* must take the address of the tree.  */
 
 #define PHI_RESULT_TREE(NODE)          PHI_NODE_CHECK (NODE)->phi.result
@@ -2310,7 +2310,7 @@ struct tree_decl_minimal GTY(())
 /* When computing aliasing information, we represent the memory pointed-to
    by pointers with artificial variables called "memory tags" (MT).  There
    are two kinds of tags, namely symbol and name:
-   
+
    Symbol tags (SMT) are used in flow-insensitive alias analysis, they
    represent all the pointed-to locations and variables pointed-to by
    the same pointer symbol.  Usually, this set is computed using
@@ -2347,10 +2347,10 @@ struct tree_memory_tag GTY(())
 struct tree_struct_field_tag GTY(())
 {
   struct tree_memory_tag common;
-  
+
   /* Parent variable.  */
   tree parent_var;
+
   /* Offset inside structure.  */
   unsigned HOST_WIDE_INT offset;
 
@@ -2391,7 +2391,7 @@ struct tree_struct_field_tag GTY(())
    values for parameters are encoded in the type of the function,
    not in the PARM_DECL slot.
    For a FIELD_DECL, this is used for enumeration values and the C
-   frontend uses it for temporarily storing bitwidth of bitfields. 
+   frontend uses it for temporarily storing bitwidth of bitfields.
 
    ??? Need to figure out some way to check this isn't a PARM_DECL.  */
 #define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial)
@@ -2424,7 +2424,7 @@ struct tree_struct_field_tag GTY(())
   (DECL_COMMON_CHECK (NODE)->decl_common.debug_expr_is_from)
 
 /* Nonzero for a given ..._DECL node means that the name of this node should
-   be ignored for symbolic debug purposes.  */ 
+   be ignored for symbolic debug purposes.  */
 #define DECL_IGNORED_P(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.ignored_flag)
 
 /* Nonzero for a given ..._DECL node means that this node represents an
@@ -2500,7 +2500,7 @@ struct tree_struct_field_tag GTY(())
    This indicates compiler tools that this decl needs to be preserved.  */
 #define DECL_PRESERVE_P(DECL) \
   DECL_COMMON_CHECK (DECL)->decl_common.preserve_flag
+
 /* For function local variables of COMPLEX type, indicates that the
    variable is not aliased, and that all modifications to the variable
    have been adjusted so that they are killing assignments.  Thus the
@@ -2539,24 +2539,24 @@ struct tree_decl_common GTY(())
   unsigned lang_flag_5 : 1;
   unsigned lang_flag_6 : 1;
   unsigned lang_flag_7 : 1;
+
   /* In LABEL_DECL, this is DECL_ERROR_ISSUED.
      In VAR_DECL and PARM_DECL, this is DECL_REGISTER.  */
   unsigned decl_flag_0 : 1;
   /* In FIELD_DECL, this is DECL_PACKED.  */
   unsigned decl_flag_1 : 1;
   /* In FIELD_DECL, this is DECL_BIT_FIELD
-     In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL. 
-     In TYPE_DECL, this is TYPE_DECL_SUPRESS_DEBUG.  */  
-  unsigned decl_flag_2 : 1;  
+     In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL.
+     In TYPE_DECL, this is TYPE_DECL_SUPRESS_DEBUG.  */
+  unsigned decl_flag_2 : 1;
   /* In FIELD_DECL, this is DECL_NONADDRESSABLE_P
      In VAR_DECL and PARM_DECL, this is DECL_HAS_VALUE_EXPR.  */
-  unsigned decl_flag_3 : 1;  
-  /* Logically, these two would go in a theoretical base shared by var and 
+  unsigned decl_flag_3 : 1;
+  /* Logically, these two would go in a theoretical base shared by var and
      parm decl. */
   unsigned gimple_reg_flag : 1;
   unsigned call_clobbered_flag : 1;
-  
+
   union tree_decl_u1 {
     /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
        DECL_FUNCTION_CODE.  */
@@ -2576,8 +2576,8 @@ struct tree_decl_common GTY(())
   tree initial;
   tree attributes;
   tree abstract_origin;
-  
-  HOST_WIDE_INT pointer_alias_set; 
+
+  HOST_WIDE_INT pointer_alias_set;
   /* Points to a structure whose details depend on the language in use.  */
   struct lang_decl *lang_specific;
 };
@@ -2592,7 +2592,7 @@ extern void decl_value_expr_insert (tree, tree);
 #define DECL_HAS_VALUE_EXPR_P(NODE) \
   (TREE_CHECK2 (NODE, VAR_DECL, PARM_DECL)->decl_common.decl_flag_3)
 #define DECL_VALUE_EXPR(NODE) \
-  (decl_value_expr_lookup (DECL_WRTL_CHECK (NODE))) 
+  (decl_value_expr_lookup (DECL_WRTL_CHECK (NODE)))
 #define SET_DECL_VALUE_EXPR(NODE, VAL)                 \
   (decl_value_expr_insert (DECL_WRTL_CHECK (NODE), VAL))
 
@@ -2681,12 +2681,12 @@ struct tree_field_decl GTY(())
 {
   struct tree_decl_common common;
 
-  tree offset; 
-  tree bit_field_type; 
+  tree offset;
+  tree bit_field_type;
   tree qualifier;
   tree bit_offset;
   tree fcontext;
+
 };
 
 /* A numeric unique identifier for a LABEL_DECL.  The UID allocation is
@@ -2703,7 +2703,7 @@ struct tree_label_decl GTY(())
 {
   struct tree_decl_with_rtl common;
   /* Java's verifier has some need to store information about labels,
-     and was using fields that no longer exist on labels.  
+     and was using fields that no longer exist on labels.
      Once the verifier doesn't need these anymore, they should be removed.  */
   tree java_field_1;
   tree java_field_2;
@@ -2733,7 +2733,7 @@ struct tree_const_decl GTY(())
 struct tree_parm_decl GTY(())
 {
   struct tree_decl_with_rtl common;
-  rtx incoming_rtl;  
+  rtx incoming_rtl;
 };
 
 
@@ -2793,7 +2793,7 @@ extern void decl_restrict_base_insert (tree, tree);
    as DECL_NAME.  It is an IDENTIFIER_NODE.  */
 #define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE)
 
-/* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME. 
+/* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME.
    This is true of all DECL nodes except FIELD_DECL.  */
 #define HAS_DECL_ASSEMBLER_NAME_P(NODE) \
   (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WITH_VIS))
@@ -2843,19 +2843,19 @@ struct tree_decl_with_vis GTY(())
  struct tree_decl_with_rtl common;
  tree assembler_name;
  tree section_name;
-  
+
  /* Belong to VAR_DECL exclusively.  */
  unsigned defer_output:1;
  unsigned hard_register:1;
  unsigned thread_local:1;
- unsigned common_flag:1; 
+ unsigned common_flag:1;
  unsigned in_text_section : 1;
  unsigned gimple_formal_temp : 1;
- unsigned dllimport_flag : 1; 
+ unsigned dllimport_flag : 1;
  unsigned based_on_restrict_p : 1;
  /* Used by C++.  Might become a generic decl flag.  */
  unsigned shadowed_for_var_p : 1;
+
  /* Don't belong to VAR_DECL exclusively.  */
  unsigned in_system_header_flag : 1;
  unsigned weak_flag:1;
@@ -2936,7 +2936,7 @@ struct tree_var_decl GTY(())
    is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
    function.  When the class is laid out, this pointer is changed
    to an INTEGER_CST node which is suitable for use as an index
-   into the virtual function table.  
+   into the virtual function table.
    C++ also uses this field in namespaces, hence the DECL_NON_COMMON_CHECK.  */
 #define DECL_VINDEX(NODE) (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.vindex)
 
@@ -2947,9 +2947,9 @@ struct tree_decl_non_common GTY(())
   /* C++ uses this in namespaces.  */
   tree saved_tree;
   /* C++ uses this in templates.  */
-  tree arguments;      
+  tree arguments;
   /* Almost all FE's use this.  */
-  tree result; 
+  tree result;
   /* C++ uses this in namespaces.  */
   tree vindex;
 };
@@ -3048,7 +3048,7 @@ struct tree_decl_non_common GTY(())
 struct tree_function_decl GTY(())
 {
   struct tree_decl_non_common common;
-  
+
   unsigned static_ctor_flag : 1;
   unsigned static_dtor_flag : 1;
   unsigned uninlinable : 1;
@@ -3057,7 +3057,7 @@ struct tree_function_decl GTY(())
   unsigned returns_twice_flag : 1;
   unsigned malloc_flag : 1;
   unsigned pure_flag : 1;
-  
+
   unsigned declared_inline_flag : 1;
   unsigned regdecl_flag : 1;
   unsigned inline_flag : 1;
@@ -3177,7 +3177,7 @@ union tree_node GTY ((ptr_alias (union lang_tree_node),
   struct tree_value_handle GTY ((tag ("TS_VALUE_HANDLE"))) value_handle;
   struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor;
   struct tree_memory_tag GTY ((tag ("TS_MEMORY_TAG"))) mtag;
-  struct tree_struct_field_tag GTY ((tag ("TS_STRUCT_FIELD_TAG"))) sft; 
+  struct tree_struct_field_tag GTY ((tag ("TS_STRUCT_FIELD_TAG"))) sft;
   struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE"))) omp_clause;
 };
 \f
@@ -3533,7 +3533,7 @@ extern tree build_string (int, const char *);
 extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
 #define build_tree_list(t,q) build_tree_list_stat(t,q MEM_STAT_INFO)
 extern tree build_decl_stat (enum tree_code, tree, tree MEM_STAT_DECL);
-extern tree build_fn_decl (const char *, tree); 
+extern tree build_fn_decl (const char *, tree);
 #define build_decl(c,t,q) build_decl_stat (c,t,q MEM_STAT_INFO)
 extern tree build_block (tree, tree, tree, tree);
 #ifndef USE_MAPPED_LOCATION
@@ -3775,9 +3775,6 @@ typedef struct record_layout_info_s
   tree pending_statics;
   /* Bits remaining in the current alignment group */
   int remaining_in_alignment;
-  /* True if prev_field was packed and we haven't found any non-packed
-     fields that we have put in the same alignment group.  */
-  int prev_packed;
   /* True if we've seen a packed field that didn't have normal
      alignment anyway.  */
   int packed_maybe_necessary;