gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > More bus error fun...

#14277 - poslundc - Sat Jan 03, 2004 7:53 pm

OK, here's a new one.

Now I'm getting bus errors if I attempt to link code that assigns a struct that is larger than 48 bytes. So for example:

Code:
struct ex1
{
   int   a4, a8, a12, a16, a20, a24, a28, a32, a36, a40, a44, a48, a52;
};

struct ex2
{
   int   a4, a8, a12, a16, a20, a24, a28, a32, a36, a40, a44;
};

struct ex1 a = (struct ex1) {a20: 12345};   // generates bus error

struct ex2 b = (struct ex2) {a20: 12345};   // does not generate error


I can still address individual members, it's just when trying to assign the entire struct that I get an error.

I gather that "bus error" on my compiler/linker is a more generic term it uses instead of the specific errors it should be generating, but I'm not certain what that specific error is.

Is there a documented limit to struct sizes somewhere that I haven't been able to track down?

Thanks,

Dan.

#14288 - Miked0801 - Sat Jan 03, 2004 10:46 pm

What the heck are you trying to do there? I've not seen that notation before. It looks like your only assigning a value to a20 and leaving the rest garbage. Just curious.

#14293 - sajiimori - Sat Jan 03, 2004 11:00 pm

A bus error is a crash, which seems to imply that you're encountering a linker bug.

Any fix suggestions I give would just be speculation -- I don't know if there really is an ld bug, or if the bug was introduced by DevKit Advance, or if it's something corrupted in your installation, or if it's having some funny interaction with the OS or another component on your system.