Xref: utzoo comp.lang.c:30759 comp.unix.aix:1479 Path: utzoo!attcan!uunet!mtndew!friedl From: friedl@mtndew.UUCP (Stephen J. Friedl) Newsgroups: comp.lang.c,comp.unix.aix Subject: Problems with IBM RS6000 C compiler Message-ID: <476@mtndew.UUCP> Date: 3 Aug 90 07:14:53 GMT Followup-To: comp.lang.c Organization: VSI*FAX Tech Center Lines: 93 Hi folks, I'm not sure where this really belongs so I tried the above groups. There's no RS6000 group, right? I am porting some software to the IBM RS6000, and the C compiler and I are just not getting along. I am not sure what is a compiler bug, what is my bug, and what is a misunderstanding between me and the various standards that this thing is trying to match. I'm using the "xlc" invocation of the compiler plus referring to the 7 Dec 88 draft of the Standard. For cross- checking my work, I am using C Issue 5 (ANSI) on the 3B2%. ------ First, a bug: the following produces a compiler error: 1 | #ifdef undef .......a.... a - 1506-199: (S) Expecting macro name on #ifdef or #ifndef directive. I've seen lots of places use this instead of something like "#if 0", and my reading of section 3.8 of the standard seems to specifically indicate that this should be OK. ------ Second, I am having problems with prototypes in header files. It seems that this compiler is trying to be compliant with ANSI, POSIX, and X/Open (plus maybe the SVID) and I just don't know enough about all these standards to know who to blame for this. For instance, defines the prototype for stat: extern int stat(char *filename, struct stat *stptr); Shouldn't the "filename" argument be const qualified? I use const all over my code, and the compiler throws up on every usage. The following other functions are mis-prototyped: open() creat() stat() mkdir() chmod() mkfifo() getpwnam() getgrnam() plus probably others. Is this supposed to be like this? Why? ------ The last is the one I am least sure of. What should happen with the following test program: extern void foo( void *** ); typedef struct { int a; long b; } any_type; any_type **array; main() { foo(&array); } It complains with: 9 | arrsize(&array); .................a....... a - 1506-193: (S) Function call arg cannot be assigned to corresponding param. I just don't get it; the ANSI compiler on the 3B2 doen't complain about this. ------ Anybody have ideas on any of this? I am stumped and frustrated. Oh, a side note. This is not a flame on the RS6000. It is a phenomenally fast machine -- hey, I compare it to the 3B2 -- and it seems to me that IBM has spent a lot of time on it. They are early in the cycle so I don't mind finding a few bugs in the short term. Steve % - I realize that the 3B2 compiler does not define the ANSI standard, and I certainly don't believe that a single test is exhaustive, but it does provide a brief sanity check. OK? -- Stephen J. Friedl, KA8CMY / Software Consultant / Tustin, CA / 3B2-kind-of-guy +1 714 544 6561 / friedl@mtndew.Tustin.CA.US / {uunet,attmail}!mtndew!friedl If the ADA bill is so important, why does Congress exempt itself?