[comp.sys.apollo] CC Bug?

derstad@cim-vax.honeywell.com ("DAVE ERSTAD") (10/17/90)

OK, campers, here's yet another (probable)  compiler bug.  This time, it's CC:
     
     test(int a,)
     {
     printf("Hello");
     }
     
     main()
     {
        test();
     }

The above program is syntactically incorrect.  The prototype for
test has an extraneous comma.  However, CC compiles this with
no errors and no warnings.

If one gets the info messages out (how many people actually do?)
it turns out that the compiler doesn't think a prototype exists:

   ******** Line 4: [Information #213]  No prototype in scope, default prototype "test(...)"
            assumed.

We ran into this due to a cut-and-pasted prototype which had such
an extraneous comma.  Finding the source of our illegal address
problem was less than fun.

The question:  Is there any reason why CC should be accepting the 
above code as legal?

Dave Erstad
Honeywell SSEC
DERSTAD@cim-vax.honeywell.com

hanche@imf.unit.no (Harald Hanche-Olsen) (10/19/90)

In article <9010170052.AA00467@umix.cc.umich.edu> derstad@cim-vax.honeywell.com ("DAVE ERSTAD") writes:

   OK, campers, here's yet another (probable)  compiler bug.  This time, it's CC:

	test(int a,)
	{
	printf("Hello");
	}

	main()
	{
	   test();
	}

   The above program is syntactically incorrect.  The prototype for
   test has an extraneous comma.  However, CC compiles this with
   no errors and no warnings.

[...[

   The question:  Is there any reason why CC should be accepting the 
   above code as legal?

No, like you said that comma constitutes a syntax error (at least as
far as I am able to decode what K&R<2> says about it).  And not only
that, the error is still around in cc 6.8(beta).  I have reported it,
and if we're really really lucky it will be fixed before 6.8 is out.
But the beta period is almost over, and I think they are reluctant
about changes that are not absolutely essential to do at this stage.
Let's just wait and see...

- Harald Hanche-Olsen <hanche@imf.unit.no>
  Division of Mathematical Sciences
  The Norwegian Institute of Technology
  N-7034 Trondheim, NORWAY