Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apple gcc bug



I am trying to do some numerical calculations and ran into an interesting bug:

[Aaron-Jacksons-Computer:~] jackson% gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1671)

[Aaron-Jacksons-Computer:~] jackson% cat test4.c
#include <stdio.h>

int
main(int argc, char **argv) {
                int k;

                k=1/0;
                printf("k = %d\n",k);
                k=0/0;
                printf("k = %d\n",k);
                exit(0);
}

[Aaron-Jacksons-Computer:~] jackson% gcc -o test4 test4.c
test4.c: In function `main':
test4.c:7: warning: division by zero
test4.c:9: warning: division by zero

[Aaron-Jacksons-Computer:~] jackson% ./test4
k = 0
k = 0

I have tried this on two other macs with the same result. Of course, this program properly bombs out on the openbsd and solaris systems that I tried to run it on. I did some google searching and looked through the list archive, but didn't see this mentioned. Is this a known bug? If so, are there any workarounds for this, or which versions of gcc are not effected? Thanks.

Aaron

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.