Re: err = noErr; // Intel binary (only) crashes here
Re: err = noErr; // Intel binary (only) crashes here
- Subject: Re: err = noErr; // Intel binary (only) crashes here
- From: "Kyle Sluder" <email@hidden>
- Date: Sun, 2 Sep 2007 03:34:17 -0400
Apparently there's an err defined in libSystem.dylib, as the linker is
complaining about.
Try renaming your variable to myErr and see what happens.
--Kyle Sluder
On 9/2/07, Robert Purves <email@hidden> wrote:
>
> An apparent bug in gcc and/or Darwin, demonstrable in half a dozen
> lines of code, and leading to a crash. Am I missing something, or is
> it time to visit bugreport.apple.com?
>
> $ cat bug_demo.c
>
> #include <Carbon/Carbon.h>
> OSStatus err;
> int main( void )
> {
> SysBeep( 1 ); // any Carbon function
> err = noErr; // Intel binary (only) crashes here
> return 0;
> }
>
> $ gcc bug_demo.c -framework Carbon -g && ./a.out
> Bus error
>
> EXC_BAD_ACCESS (0x0001)
> KERN_PROTECTION_FAILURE (0x0002) at 0x900dd686
>
> Thread 0 Crashed:
> 0 main + 32 (bug_demo.c:7)
> 1 _start + 216
> 2 start + 41
>
>
> 0x900dd686 seems an unlikely address for a global. Is there something
> weird about err? Changing the declaration to a definition:
> OSStatus err = 1;
> suggests the answer "Very weird indeed"
>
> $ gcc bug_demo.c -framework Carbon -g && ./a.out
> /usr/bin/ld: warning multiple definitions of symbol _err
> /var/tmp//cc4X2C6Z.o definition of _err in section (__DATA,__data)
> /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib
> (err.So) definition of _err
>
>
> $ gcc --version
> i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
> 5367)
>
> Robert P.
>
> _______________________________________________
> 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
>
_______________________________________________
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