Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
99 user(s) are online (88 user(s) are browsing Forums)

Members: 0
Guests: 99

more...

Support us!

Headlines

 
  Register To Post  

Alignment Exception
Just popping in
Just popping in


See User information
I *think* to remember that it was possible on OS 4 to make alignment exception not cause a crash (but did not have a working Amiga for some while, so not sure right now), I think to remember there was some ENV Variable or such... Can someone tell if I remember right?

I have an alignment exception in one of my programs which looks like a data structure is not aligned to 32 Bit boundaries (which AFAIK is a problem on the Sam).

Also: Would -mstrict-align help?

MagicSN

Go to top
Re: Alignment Exception
Quite a regular
Quite a regular


See User information
@MagicSN

I had the same problem when developing Digital Universe with the latest SDK. Older SDKs worked but the latest one did not.

The answer I was given from the SDK experts is:

Quote:




OK, we finally figured out what is happening and it is anAmigaOS-specific GCC compiler bug.



Quote:




The root cause of the trouble is the pack(2) as you suspected all along. However, our GCC should have been created withthe -mstrict-align option to force strict alignments of floatingpoint types which makes the code run faster (alignment is good)at the expense of storage space.A bug has been filed against our version of GCC.



Quote:




So add the -mstrict-align optionand your code should still compile and run without this problem. This enables the optimizer to do its job without worry.



So currently add the -mstrict-align in your makefiles when compiling for OS4, in a future SDK you should be able to leave this out as it will be on by default.

Hope this helps.

Go to top
Re: Alignment Exception
Just popping in
Just popping in


See User information
@BillE

Well, let's hope Mame 0.131 will finally work after this recompile

Go to top
Re: Alignment Exception
Home away from home
Home away from home


See User information
@BillE
Do you know if this bug could affect 64-bit (long long) values? And whether -mstrict-align would help?

Author of the PortablE programming language.
Go to top
Re: Alignment Exception
Not too shy to talk
Not too shy to talk


See User information
@MagicSN

How long does it take to compile?

I get annoyed at my 1 minute 15 second WookieChat compiles.. it went a lot faster on the A1. :)

Go to top
Re: Alignment Exception
Quite a regular
Quite a regular


See User information
@ChrisH

Quote:

ChrisH wrote:
Do you know if this bug could affect 64-bit (long long) values? And whether -mstrict-align would help?


To be honest, no idea. But from what I currently gather...

It should not affect 64 bit values as they should be aligned anyway. It is small variables that in a structure may not fit on an aligned memory boundary that will have this problem. Furthermore only structures that use #pragma pack(2) to read in existing data files would be affected.

Go to top
Re: Alignment Exception
Not too shy to talk
Not too shy to talk


See User information
@MagicSN

The cpu on the Sam440 is a little special... where the 'normal' powerpc cpus want 4 bytes alligned Floats, the sam wants 8 bytes.. The exec implements a execption handler that will catch this error and correct it.

I am not sure if it will only work for 4 bytes allign floats. but you can write to Thomas Frieden and ask I'm very sure he can tell you, I only write what my memory allows me to remeber, I dident followed this topic very closely then the Sam port was done.

RWO

Go to top
Re: Alignment Exception
Just popping in
Just popping in


See User information
@rwo

Yes, I examined the code now, and there is something like that in the structure causing the crash:

UBYTE8 ...;
ULONG ...;
float ...;

so the float ends up on a non-aligned address, which after what you wrote is a problem.

I added -mstrict-align to the compile but not to the link, this did not help (do I need to add it to the link as well?)

Now I am trying something else: Including 3 Pad-Bytes after the UBYTE Just hope such a problem is not at a different location as well!

I will also phone Thomas Frieden at some times and ask him if he has a suggestion, though

Steffen

Go to top
Re: Alignment Exception
Amigans Defender
Amigans Defender


See User information
@MagicSN
Quote:

UBYTE8 ...;
ULONG ...;
float ...;


Adding the -mstrict-align option should do the trick for that problem. Another way to get rid of the problem is to remove any #pragma pack() directives and let the compiler pack it.

Make sure you are using the latest SDK compiler as well. If you use an older version you will have problems on the 440ep.

ExecSG Team Lead
Go to top
Re: Alignment Exception
Quite a regular
Quite a regular


See User information
@ssolie

IIRC correctly MagicSN is cross-compiling from Cygwin. Is the latest SDK enough or should an updated cross-compiler be used too ?

Back to a quiet home... At last
Go to top
Re: Alignment Exception
Just popping in
Just popping in


See User information
@ssolie: I am already using -mstrict-align and the problem still appears. I checked the ASM code which crashed and it was a loading of a float. So it seems -mstrict-align did not do the trick, probably due to a too old compiler.

@abalaban

You are right. I am using the cygwin-cross-compiler. I am using the latest one I could find which was already quite old (from 2007). My guess is this version is too old for it. If anyone has the recent compiler for cygwin, please tell me where I can get it.

And I am still interested in a A1/Peg2 based tester for Mame, so I can see if it runs on a non-Sam system in the current compile.

MagicSN

Go to top
Re: Alignment Exception
Amigans Defender
Amigans Defender


See User information
@MagicSN

as Steven (ssolie) said and as I said you on AW, try #pragma pack() directive and try also __align() attribute:

Link

i'm really tired...
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project