public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: kyle_s_hoyt@raytheon.com To: gcc-gnats@gcc.gnu.org Subject: c++/8464: Bus Error (SIGBUS) due to misaligned access Date: Tue, 05 Nov 2002 08:26:00 -0000 [thread overview] Message-ID: <20021105161756.10617.qmail@sources.redhat.com> (raw) >Number: 8464 >Category: c++ >Synopsis: Bus Error (SIGBUS) due to misaligned access >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Nov 05 08:26:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Kyle Hoyt >Release: 2.95.2 19991024 >Organization: >Environment: SunOS 2.6 Generic_108528-06 sun4u sparc SUNW,Ultra-250 >Description: Copying of data from a pointer results in a SIGBUS error. Basically, the compiler is generating a ldd instruction when the data is not guaranteed to be 8-byte aligned. I have tried to multiple options such as the __attribute__ ((aligned)); but I can not get the compiler not to create the ldd instruction. >How-To-Repeat: Compile the included code and run. Basically, this is a real stripped down version of the program. The program receives Navigation Data messages via a data tape. The message is guarranteed to be 4 byte aligned but not 8 byte. The ProcessNav routine stores a history of the navigation data. Thus it copies the message and puts it in a FIFO. The code works on Pentium (G++ complier) and PowerPC (GreenHills compiler) platforms but not on Sparc. >Fix: Change the code to use bcopy. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="gccbug.txt" Content-Disposition: inline; filename="gccbug.txt" typedef struct { int message; int numwords; double latitude; double longitude; double altitude; double ew_rate; double ns_rate; int time; } NAVIGATION_DATAS __attribute__ ((aligned(4))); void ProcessNavData(NAVIGATION_DATAS *nav_ptr) { NAVIGATION_DATAS store; store = *nav_ptr; } int main() { unsigned int data[1024]; ProcessNavData((NAVIGATION_DATAS *)&data[0]); ProcessNavData((NAVIGATION_DATAS *)&data[1]); }
next reply other threads:[~2002-11-05 16:26 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-11-05 8:26 kyle_s_hoyt [this message] 2002-11-05 8:49 bangerth 2002-11-05 9:16 Andreas Schwab
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021105161756.10617.qmail@sources.redhat.com \ --to=kyle_s_hoyt@raytheon.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).