This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Alignment error in CVS version, ia64
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Re: Alignment error in CVS version, ia64
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Fri, 4 Aug 2000 18:29:36 -0400 (EDT)
Forwarded message:
From - Fri Aug 4 18:24:10 2000
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Message-ID: <398B4284.B973B1C1@hiauly1.hia.nrc.ca>
Date: Fri, 04 Aug 2000 18:24:06 -0400
From: John David Anglin <dave@hiauly1.hia.nrc.ca>
Reply-To: dave.anglin@nrc.ca
Organization: National Research Council of Canada
X-Mailer: Mozilla 4.7 [en] (X11; U; HP-UX B.10.20 9000/735)
X-Accept-Language: en
MIME-Version: 1.0
To: gcc-bugs@hiauly1.hia.nrc.ca, schepler@math.berkeley.edu
Subject: Re: Alignment error in CVS version, ia64
Content-Type: multipart/mixed;
boundary="------------157D77AB60411D301CAD8E83"
This is a multi-part message in MIME format.
--------------157D77AB60411D301CAD8E83
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
You might try the enclosed patch and see if it resolves your problem.
Field declaration offset alignments are stored in a 8 bit field and hold
the bit offset of the field. I know that specifying an alignment
greater
than 16 exceeds what can be stored in the field, resulting in an offset
alignment value of 0. Possibly, on the ia64, the upper limit is an
aligned
value of 8. The enclosed patch stores the alignment value in more or
less log2 format, circumventing the problem.
Dave
--------------157D77AB60411D301CAD8E83
Content-Type: text/html; charset=us-ascii;
name="msg00121.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msg00121.html"
Content-Base: "http://gcc.gnu.org/ml/gcc-bugs/2000-08
/msg00121.html"
Content-Location: "http://gcc.gnu.org/ml/gcc-bugs/2000-08
/msg00121.html"
<!-- MHonArc v2.4.6 -->
<!--X-Subject: Alignment error in CVS version, ia64 -->
<!--X-From-R13: Rnavry Epurcyre <fpurcyreNzngu.orexryrl.rqh> -->
<!--X-Date: 4 Aug 2000 20:44:55 -0000 -->
<!--X-Message-Id: 871z04bvsz.fsf@adsl-63-193-247-253.dsl.snfc21.pacbell.net -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML//EN">
<HTML>
<HEAD>
<TITLE>Alignment error in CVS version, ia64</TITLE>
</HEAD>
<BODY>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--htdig_noindex-->
<p>This is the mail archive of the
<tt>gcc-bugs@gcc.gnu.org</tt>
mailing list for the <a href="/">GCC project</a>.
<!--/htdig_noindex-->
<!--X-User-Header-End-->
<!--X-TopPNI-->
<!--htdig_noindex-->
<HR>
<table border="0">
<tr><th align="left">Index Nav:</th>
<td colspan="2">
[<A HREF="index.html#00121">Date Index</A>] [<a href="subjects.html#00121">Subject Index</a>] [<a href="authors.html#00121">Author Index</a>] [<A HREF="threads.html#00121">Thread Index</A>]
</td>
</tr>
<tr><th align="left">Message Nav:</th>
<td>[<A HREF="msg00120.html">Date Prev</A>] [<A HREF="msg00122.html">Date Next</A>]</td>
<td>[Thread Prev] [<A HREF="msg00122.html">Thread Next</A>]</td>
</tr>
</table>
<!--/htdig_noindex-->
<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<h1>Alignment error in CVS version, ia64</h1>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: gcc-bugs at gcc dot gnu dot org</LI>
<LI><em>Subject</em>: Alignment error in CVS version, ia64</LI>
<LI><em>From</em>: Daniel Schepler <schepler at math dot berkeley dot edu></LI>
<LI><em>Date</em>: 04 Aug 2000 13:44:44 -0700</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
I have a very short test case:
typedef long bigarray[70] __attribute__((aligned(16)));
static bigarray foo;
which, when run through 'gcc -S align.c', results in:
.file "align.c"
.pred.safe_across_calls p1-p5,p16-p63
.bss
.align 8
.type foo#,@object
.size foo#,560
foo:
.skip 560
.ident "GCC: (GNU) 2.96 20000803 (experimental)"
I have no way to test whether this problem is ia64-specific. (This
bug is causing me big problems trying to run programs which use
setjmp.)
--
Daniel Schepler "Please don't disillusion me. I
schepler@math.berkeley.edu haven't had breakfast yet."
-- Orson Scott Card
</PRE>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<UL><LI><STRONG>Follow-Ups</STRONG>:
<UL>
<LI><STRONG><A NAME="00122" HREF="msg00122.html">Re: Alignment error in CVS version, ia64</A></STRONG>
<UL><LI><EM>From:</EM> Jim Wilson</LI></UL></LI>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<!--htdig_noindex-->
<table border="0">
<tr><th align="left">Index Nav:</th>
<td colspan="2">
[<A HREF="index.html#00121">Date Index</A>] [<a href="subjects.html#00121">Subject Index</a>] [<a href="authors.html#00121">Author Index</a>] [<A HREF="threads.html#00121">Thread Index</A>]
</td>
</tr>
<tr><th align="left">Message Nav:</th>
<td>[<A HREF="msg00120.html">Date Prev</A>] [<A HREF="msg00122.html">Date Next</A>]</td>
<td>[Thread Prev] [<A HREF="msg00122.html">Thread Next</A>]</td>
</tr>
</table>
<!--/htdig_noindex-->
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</BODY>
</HTML>
--------------157D77AB60411D301CAD8E83
Content-Type: text/plain; charset=us-ascii;
name="align.d"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="align.d"
2000-05-13 Geoffrey Keating <geoffk@cygnus.com>
* tree.h (DECL_OFFSET_ALIGN): Make the off_align field of
the tree structure an exponent rather than an explicit alignment
so it doesn't overflow.
(SET_DECL_OFFSET_ALIGN): New macro.
* stor-layout.c (place_union_field): Use SET_DECL_OFFSET_ALIGN
rather than DECL_OFFSET_ALIGN.
(place_field): Likewise.
--- stor-layout.c.orig Thu Jun 15 00:01:55 2000
+++ stor-layout.c Fri Jun 23 18:19:36 2000
@@ -584,7 +584,7 @@
DECL_FIELD_OFFSET (field) = size_zero_node;
DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;
- DECL_OFFSET_ALIGN (field) = BIGGEST_ALIGNMENT;
+ SET_DECL_OFFSET_ALIGN (field, BIGGEST_ALIGNMENT);
desired_align = DECL_ALIGN (field);
@@ -859,7 +859,7 @@
normalize_rli (rli);
DECL_FIELD_OFFSET (field) = rli->offset;
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
- DECL_OFFSET_ALIGN (field) = rli->offset_align;
+ SET_DECL_OFFSET_ALIGN (field, rli->offset_align);
/* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field
--- tree.h.orig Thu Jun 15 00:01:57 2000
+++ tree.h Fri Jun 23 19:58:36 2000
@@ -1300,8 +1300,15 @@
#define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit)
/* Holds the alignment required for the datum. */
#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.u1.a.align)
-/* For FIELD_DECLs, holds the alignment that DECL_FIELD_OFFSET has. */
-#define DECL_OFFSET_ALIGN(NODE) (FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align)
+/* For FIELD_DECLs, off_align holds the number of low-order bits of
+ DECL_FIELD_OFFSET which are known to be always zero.
+ DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
+ has. */
+#define DECL_OFFSET_ALIGN(NODE) \
+ ((unsigned int)1 << FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align)
+/* Specify that DECL_ALIGN(NODE) is a multiple of X. */
+#define SET_DECL_OFFSET_ALIGN(NODE, X) \
+ (FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align = ffs (X) - 1)
/* 1 if the alignment for this type was requested by "aligned" attribute,
0 if it is the default for this type. */
#define DECL_USER_ALIGN(NODE) (DECL_CHECK (NODE)->decl.user_align)
--------------157D77AB60411D301CAD8E83--
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)