This is the mail archive of the
mailing list for the newlib project.
Re: Newlib 1.8.1 problem: strcat causes bus address error
- To: "Borkhuis, Johan" <Johan dot Borkhuis at peektraffic dot nl>
- Subject: Re: Newlib 1.8.1 problem: strcat causes bus address error
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Wed, 17 Nov 1999 10:51:07 -0500
- CC: "'newlib at sourceware dot cygnus dot com'" <newlib at sourceware dot cygnus dot com>
- Organization: Cygnus Solutions
- References: <FCF5ECA039A1D111A02808002BE647CB010ECC08@METEOOR>
"Borkhuis, Johan" wrote:
> We are using the GNU toolchain for m68k and newlib. When we are running our
> SW we get a bus address error. This error occurs in strcat. The code where
> the problem comes from is the following:
> /* Skip over the data in s1 as quickly as possible. */
> if (ALIGNED (s1))
> unsigned long *aligned_s1 = (unsigned long *)s1;
> while (!DETECTNULL (*aligned_s1))
> s1 = (char *)aligned_s1;
> with ALLIGNED replaced with the following:
> #define ALIGNED(X) (((long)X & (sizeof (long) - 1)))
> The error occured in the first assignement, because s1 is not alligned.
> The problems is created by the macro ALLIGNED. When X is not a multiple of 4
> (for a 32 bit long) this function returns TRUE when it should return FALSE.
> (BTW: this macro is also used in other modules, but there it is called
> Did anyone discover this problem, or is there a workaround for this?
This problem was fixed in December of 98. The ALIGNED macro was changed
#define ALIGNED(X) \
(((long)X & (sizeof (long) - 1)) == 0)
-- Jeff J.