Hello!
I have been helping a colleague who is trying to port a large UNIX
application to Mac OS X (10.2). In doing so, he has discovered what appears
to be a compiler error in the version of gcc included in 10.2. (Including
the August Developer Tools update.) He has provided a small sample of code
that demonstrates the bug, which I am appending below. He has also tested
this code on a variety of other architectures using gcc-3.2, and none
exhibited the problem.
I promised to forward this bug to Apple, and this e-mail address seemed
like a good start. If there's a more appropriate way for reporting this,
please let me know. Thanks!
- Scott
--------------------------------------------------------------------------
foo.c:
/*
[M-Scott-Smiths-Computer:~] scott% uname -mpsrv
Darwin 6.0 Darwin Kernel Version 6.0: Sat Jul 27 13:18:52 PDT 2002;
root:xnu/xnu-344.obj~1/RELEASE_PPC Power Macintosh powerpc
[M-Scott-Smiths-Computer:~] scott% cc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1161, based on gcc version 3.1 20020420
(prerelease)
[M-Scott-Smiths-Computer:~] scott% cc -c foo.c
foo.c:23: illegal member reference, found `('
cpp-precomp: warning: errors during smart preprocessing, retrying in basic
mode
foo.c:18: two or more data types in declaration of `foo'
foo.c: In function `foo':
foo.c:23: parse error before '(' token
foo.c:23: parse error before ')' token
This code compiles using gcc-3.2 on other architectures:
SunOS-sparc, OSF1, Linux-x86, SunOS-x86, Linux-alpha, HP-UX, IRIX64
*/
#define car(n) ((n) >> 5)
#define bar(x) car(x)
struct obj2
{
int c;
};
struct obj1
{
struct obj2 * b;
}
int
foo(a)
struct obj1 * a;
{
int z;
#define b (a->b)
z = bar(b->c);
/* work-around
z = bar(a->b->c);
*/
return 0;
}
-------------------------------------------------------------------
M. Scott Smith DCSki Editor
[EMAIL PROTECTED]
(410) 695-0593 2391 Sandy Walk Way
(410) 695-0594 [fax] Odenton, Md 21113
DCSki web site: http://www.dcski.com/