]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/6522 ([x86] incorrect struct offset for unaligned 64-bit fields in debug...
authorJakub Jelinek <jakub@redhat.com>
Fri, 3 May 2002 20:35:39 +0000 (22:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 3 May 2002 20:35:39 +0000 (22:35 +0200)
PR target/6522
* dwarf2out.c (simple_decl_align_in_bits): Renamed to...
(simple_field_decl_align_in_bits): this.  Apply
BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN if defined.

From-SVN: r53125

gcc/ChangeLog
gcc/dwarf2out.c

index 1ffa167623506693f0876a06cff4145ded0799dc..4afc04fd44bbd6ca2b37cdc36153e1cf8f7a4d6f 100644 (file)
@@ -1,3 +1,10 @@
+2002-05-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/6522
+       * dwarf2out.c (simple_decl_align_in_bits): Renamed to...
+       (simple_field_decl_align_in_bits): this.  Apply
+       BIGGEST_FIELD_ALIGNMENT and ADJUST_FIELD_ALIGN if defined.
+
 2002-05-03  Richard Henderson  <rth@redhat.com>
 
        PR opt/6534
index e99665fa42588ade4e6b4efe960b3442d66ed303..24a272021daa53837f3f36418da320c7c61b0c0c 100644 (file)
@@ -3592,7 +3592,7 @@ static dw_loc_descr_ref loc_descriptor_from_tree PARAMS ((tree, int));
 static HOST_WIDE_INT ceiling           PARAMS ((HOST_WIDE_INT, unsigned int));
 static tree field_type                 PARAMS ((tree));
 static unsigned int simple_type_align_in_bits PARAMS ((tree));
-static unsigned int simple_decl_align_in_bits PARAMS ((tree));
+static unsigned int simple_field_decl_align_in_bits PARAMS ((tree));
 static unsigned HOST_WIDE_INT simple_type_size_in_bits PARAMS ((tree));
 static HOST_WIDE_INT field_byte_offset PARAMS ((tree));
 static void add_AT_location_description        PARAMS ((dw_die_ref,
@@ -8355,10 +8355,28 @@ simple_type_align_in_bits (type)
 }
 
 static inline unsigned
-simple_decl_align_in_bits (decl)
-     tree decl;
+simple_field_decl_align_in_bits (field)
+     tree field;
 {
-  return (TREE_CODE (decl) != ERROR_MARK) ? DECL_ALIGN (decl) : BITS_PER_WORD;
+  unsigned align;
+
+  if (TREE_CODE (field) == ERROR_MARK)
+    return BITS_PER_WORD;
+
+  align = DECL_ALIGN (field);
+
+#ifdef BIGGEST_FIELD_ALIGNMENT
+  /* Some targets (i.e. i386) limit union field alignment
+     to a lower boundary than alignment of variables unless
+     it was overridden by attribute aligned.  */
+  if (! DECL_USER_ALIGN (field))
+    align = MIN (align, (unsigned) BIGGEST_FIELD_ALIGNMENT);
+#endif
+
+#ifdef ADJUST_FIELD_ALIGN
+  align = ADJUST_FIELD_ALIGN (field, align);
+#endif
+  return align;                          
 }
 
 /* Given a pointer to a tree node, assumed to be some kind of a ..._TYPE
@@ -8432,7 +8450,7 @@ field_byte_offset (decl)
 
   type_size_in_bits = simple_type_size_in_bits (type);
   type_align_in_bits = simple_type_align_in_bits (type);
-  decl_align_in_bits = simple_decl_align_in_bits (decl);
+  decl_align_in_bits = simple_field_decl_align_in_bits (decl);
 
   /* The GCC front-end doesn't make any attempt to keep track of the starting
      bit offset (relative to the start of the containing structure type) of the