Bug 28808 - Alignment problem in __gthread_once_t in vxWorks
Summary: Alignment problem in __gthread_once_t in vxWorks
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.1
: P3 minor
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2006-08-22 18:40 UTC by Aaron Graham
Modified: 2021-08-15 04:49 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-vxworks-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-03 05:37:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Graham 2006-08-22 18:40:10 UTC
The __gthread_once_t struct should use aligned ints instead of chars.  This allows the values to be manipulated on PowerPC using the stwcx and lwarx instructions (as is done in the vxTas() function call) without causing alignment issues.  The fix is probably applicable to other architectures (SH4?) as well.

--- old/gcc/gthr-vxworks.h  2006-08-22 09:26:05.000000000 -0400
+++ new/gcc/gthr-vxworks.h  2006-08-22 09:26:15.000000000 -0400
@@ -103,8 +103,8 @@


typedef struct
{
-  volatile unsigned char busy;
-  volatile unsigned char done;
+  volatile unsigned int busy;
+  volatile unsigned int done;
}
__gthread_once_t;
Comment 1 Aaron Graham 2006-08-22 18:43:24 UTC
Patch was submitted to gcc-patches earlier, which is the same as the patch already posted to the previous comment.

http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00786.html
Comment 2 Andrew Pinski 2006-09-03 05:37:03 UTC
Confirmed.
Comment 3 Aaron Graham 2009-10-29 15:53:50 UTC
It appears that this one is fixed as of SVN revision 146566:
http://gcc.gnu.org/viewcvs/trunk/gcc/gthr-vxworks.h?view=log
Comment 4 Andrew Pinski 2021-08-15 04:49:15 UTC
Fixed in r0-92956 .