Re: GCC 4 and strict aliasing
Re: GCC 4 and strict aliasing
- Subject: Re: GCC 4 and strict aliasing
- From: "Frederik Slijkerman (FabFilter)" <email@hidden>
- Date: Sat, 18 Mar 2006 11:17:00 +0100
Hi Eric,
Awesome, thanks! I will file the bug reports as you suggested. I've also
noticed that Xcode 2.2 / GCC 4 generates rather sub-optimal code for Intel,
with a lot of unnecessary extra register movements. Is this a known
problem?
Best regards,
Frederik Slijkerman
----- Original Message -----
From: "Eric Albert" <email@hidden>
To: "Frederik Slijkerman (FabFilter)" <email@hidden>
Cc: "Xcode Users" <email@hidden>
Sent: Friday, 17 March 2006 22:45
Subject: Re: GCC 4 and strict aliasing
We turn off strict aliasing by default because, as you've noticed, it
breaks a lot of code (even though it's more correct and results in faster
code). But we explicitly turn it on for -O2 and higher when -
ftree-vectorize is passed to the compiler, as you're doing here. I'm not
sure why, but it doesn't seem right to me, particularly when -fno-
strict-aliasing is passed.
So I think we have three bugs here. It'd be great if you could take the
time to file each of them separately. Thanks!
1) The Core Audio SDK should use a strict-aliasing-safe method to swap
floats. That'd ideally be the CFByteOrder.h float-swapping functions,
but anything else that uses a union in the same manner should be fine.
2) Apple's GCC should not turn on -fstrict-aliasing when -ftree-
vectorize -fno-strict-aliasing is passed.
3) The GCC man page should document that -fstrict-aliasing is turned off
by default on Mac OS X and that -ftree-vectorize turns it on.
Meanwhile, you can try to work around it by turning off -ftree- vectorize.
Hope this helps,
Eric
(not a compiler engineer)
On Mar 17, 2006, at 9:54 AM, Frederik Slijkerman (FabFilter) wrote:
Hi Stefan,
Yes, I've added -fno-strict-aliasing to the 'Other C++ Flags' setting in
Xcode but it seems to be ignored, even though it does appear in the
command line. One thing that might matter is that it is added after all
other options. Here is part of the command line:
/usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-
strings -faltivec -fasm-blocks -O3 -Wreturn-type -Wformat -Wmissing-
braces -Wparentheses -Wunused-function -Wunused-label -Wunused-
variable -Wunused-value -Wsign-compare -DMACOSX -DAUDIOUNITS -
fmessage-length=0 -funroll-loops -ffast-math -mtune=G4 -ftree-
vectorize -fvisibility-inlines-hidden -Wno-invalid-offsetof -
mmacosx-version-min=10.3
<includes skipped>
-DNDEBUG -fno-strict-aliasing -falign-loops=16 -isysroot /Developer/
SDKs/MacOSX10.3.9.sdk -include /Library/Caches/com.apple.Xcode.501/
SharedPrecompiledHeaders/pch-fjwtzxtrfzovnrcfiacmnnqisrwj/pch.h
<paths skipped>
Best regards,
Frederik Slijkerman
----- Original Message ----- From: "Stefan Haller" <email@hidden>
To: "Frederik Slijkerman (FabFilter)" <email@hidden>;
<email@hidden>
Sent: Friday, 17 March 2006 18:25
Subject: Re: GCC 4 and strict aliasing
Frederik Slijkerman (FabFilter) <email@hidden> wrote:
Please, please, can someone tell me how I can turn off strict aliasing
while
still being able to compile at the -O3 level? Thanks!
Did you try -O3 -fno-strict-aliasing?
--
Stefan Haller
Ableton
http://www.ableton.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40outofcheese.org
This email sent to email@hidden
_______________________________________________
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