lvc@cbnews.ATT.COM (Lawrence V. Cipriani) (12/03/88)
One of the most widely distributed C programs I wrote failed to compile on a UTS(r) C compiler because it was missing a ; inside a struct definition. For example: struct a { int b, c, d /* ; */ }; Another one I found a while ago is this: void exit(); void error(v, eval) void (*v)(); int eval; { ... if (v == exit) /* miscompiled line */ exit(eval); else return; } The compiler thought the comparison of v to exit was invalid. -- Larry Cipriani, AT&T Network Systems, Columbus OH, Path: att!cbnews!lvc Domain: lvc@cbnews.ATT.COM
gwyn@smoke.BRL.MIL (Doug Gwyn ) (12/03/88)
In article <2432@cbnews.ATT.COM> lvc@cbnews.ATT.COM (Lawrence V. Cipriani) writes: >The compiler thought the comparison of v to exit was invalid. The PCC compiler that Berkeley "borrowed" did not grok pointers to functions returing void, but it accepted declarations of them. Vendors who started with Berkeley's copy of the compiler instead of a more modern one spread the bug around. It's been fixed in the current 4.3BSD release, I believe (I don't use the Berkeley compiler; because of that and other bugs I ported the SVR1 VAX version for the BRL System V emulation on VAX 4.nBSD).
henry@utzoo.uucp (Henry Spencer) (12/04/88)
In article <2432@cbnews.ATT.COM> lvc@cbnews.ATT.COM (Lawrence V. Cipriani) writes: > struct a > { > int b, c, d /* ; */ > }; Uh, why is failing to compile this a bug? The semicolon is not optional. -- SunOSish, adj: requiring | Henry Spencer at U of Toronto Zoology 32-bit bug numbers. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
lvc@cbnews.ATT.COM (Lawrence V. Cipriani) (12/05/88)
In article <1988Dec3.221300.28890@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <2432@cbnews.ATT.COM> lvc@cbnews.ATT.COM (Lawrence V. Cipriani) writes: >> struct a >> { >> int b, c, d /* ; */ >> }; > >Uh, why is failing to compile this a bug? The semicolon is not optional. The bug was in the compilers that accepted it. The UTS(r) C compiler was correct in rejecting it. I must say the error handling was atrocious, about 24 lines of rubbish. Sorry for the confusion. UTS is a trademark of Amdahl Corporation. -- Larry Cipriani, AT&T Network Systems, Columbus OH, Path: att!cbnews!lvc Domain: lvc@cbnews.ATT.COM