• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GCC 4 and strict aliasing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC 4 and strict aliasing


  • Subject: Re: GCC 4 and strict aliasing
  • From: "Frederik Slijkerman (FabFilter)" <email@hidden>
  • Date: Fri, 17 Mar 2006 14:50:00 +0100

Hi Steve,

Thanks, but I already know that. :-) The thing is, I don't want to change the CoreAudio SDK source because that makes it hard to upgrade to a newer version of the SDK later. Also, this is just one example of where things go wrong -- it's not practical to do a complete code review of the entire SDK, and our own code, just to figure out where strict aliasing will break things. That is just too fragile.

There must be other people -- or rather, any Audio Unit developer -- with this problem, yet I haven't found anything about it.

Thanks,
Frederik Slijkerman.

----- Original Message ----- From: "Steve Checkoway" <email@hidden>
To: "Frederik Slijkerman (FabFilter)" <email@hidden>
Cc: <email@hidden>
Sent: Friday, 17 March 2006 12:28
Subject: Re: GCC 4 and strict aliasing



Hi,

On Mar 17, 2006, at 1:19 AM, Frederik Slijkerman (FabFilter) wrote:
My apologies if this question has come up before, but I seem to be unable to turn off the 'strict aliasing' option in GCC 4 / Xcode 2.2. The problem is that with the -O3 option (Optimization = Fastest in Xcode), strict aliasing is automatically enabled and there doesn't seem to be a way to turn it off again. I have tried adding '-fno-strict-aliasing' to the 'Other C Flags' setting in Xcode but it doesn't seem to have any effect. Inspecting the gcc command line in the build window shows that it is added to the command line properly.

I'm compiling an Audio Unit that uses the CoreAudio SDK which I don't want to change, and there is a strict aliasing issue in AUElement::RestoreState() that means that the audio unit cannot properly restore its state. Here are the offending lines:

 UInt32 temp = EndianU32_BtoN(*(UInt32 *)p);
 entry.value = *(Float32 *)&temp;
 p += sizeof(Float32);

The *(Float32 *)&temp expression is compiled incorrectly on the PowerPC architecture which gives entry.value a random value. Interestingly enough, on Intel the correct code is produced.

I can't help with gcc, but if you _can_ change the code, then this should work:


union { UInt32 i; Float32 f; } u;
u.i = EndianU32_BtoN( *(UInt32 *)p );
entry.value = u.f;
p += sizeof(Float32);


Please, please, can someone tell me how I can turn off strict aliasing while still being able to compile at the -O3 level? Thanks!

Sorry I couldn't be more help.

- Steve



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >GCC 4 and strict aliasing (From: "Frederik Slijkerman (FabFilter)" <email@hidden>)
 >Re: GCC 4 and strict aliasing (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: Dependency Checking Woes
  • Next by Date: Xcode and ccache
  • Previous by thread: Re: GCC 4 and strict aliasing
  • Next by thread: Re: GCC 4 and strict aliasing
  • Index(es):
    • Date
    • Thread