Article View: gnu.gcc.help
Article #50718Need help fixing/overriding bug in character array alignment
From: thx
Date: Sat, 14 Aug 1993 03:15
Date: Sat, 14 Aug 1993 03:15
38 lines
2224 bytes
2224 bytes
Hi,
Gcc-2.4.5 aligns character arrays at 8-byte boundaries on the
sparc architecture.
Rms has explained to me that this is not a bug, it is a feature,
since it speeds up strcpy.
He also hinted that I could remove the feature by changing DATA_ALIGNMENT
and CONSTANT_ALIGNMENT. He also hinted that he did not have the time
to explain this any further.
Can someone Please help me to understand the above-mentioned macros,
so I can make this (irksome) feature go away? We have a dire need at
our site not to have the compiler put unrequested holes in the data
it is allocating.
Here is how the macros are defined in gcc-2.4.5/config/sparc/sparc.h:
=======================================================================
/* Make strings word-aligned so strcpy from constants will be faster. */
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
((TREE_CODE (EXP) == STRING_CST \
&& (ALIGN) < FASTEST_ALIGNMENT) \
? FASTEST_ALIGNMENT : (ALIGN))
/* Make arrays of chars word-aligned for the same reasons. */
#define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == ARRAY_TYPE \
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
&& (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
=======================================================================
If I just undefine the DATA_ALIGNMENT macro, will the problem go away?
Can anyone tell me how to make this behavior optional?
Thanks to anyone who can help.
tim werner
Technical Details
Message-ID:
<1993Aug13.174814.14186@news.csuohio.edu>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!europa.eng.gtefsd.com!howland.reston.ans.net!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!knuth.cba.csuohio.edu!thx1139Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,7a77db9ecdc21e16,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-08-13 20:46:42 PST Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!europa.eng.gtefsd.com!howland.reston.ans.net!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!knuth.cba.csuohio.edu!thx1139 From: thx1139@knuth.cba.csuohio.edu (thx) Newsgroups: gnu.gcc.help Subject: Need help fixing/overriding bug in character array alignment Date: 13 Aug 1993 23:15:58 -0400 Organization: Cleveland State University, Cleveland, Ohio Lines: 39 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <1993Aug13.174814.14186@news.csuohio.edu>