Thread View: comp.bugs.sys5
2 messages
2 total messages
Started by Mark Stevans
Wed, 29 Jul 1987 18:07
Strange compiler bug
Author: Mark Stevans
Date: Wed, 29 Jul 1987 18:07
Date: Wed, 29 Jul 1987 18:07
39 lines
1464 bytes
1464 bytes
If you attempt to declare a function argument that is not present in the
argument list, like in the following program:
main()
{
bar(3);
}
bar(contect)
int context;
{
}
the C compilers will give an error message about "declared argument context"
not found. However, the following program:
int context;
main()
{
bar(3);
}
bar(contect)
int context;
{
}
passes both "cc" and "lint" on both System V and 4.2bsd without giving any
messages to inform you that you misspelled "context" as "contect". The
compiler seems to think that there are two arguments: context and contect.
Lint will tell you that you are hiding your global, and that the two arguments
of bar, context and contect, are unused.
I believe this is a bug. In fact, the above situation was actually
encountered by a colleague, so this is not a purely theoretical issue.
Mark "Bugsy" Stevans
cci632!mark
Re: Strange compiler bug
Author: Guy Harris
Date: Thu, 30 Jul 1987 01:22
Date: Thu, 30 Jul 1987 01:22
10 lines
949 bytes
949 bytes
> I believe this is a bug.
Yes, this is a bug. There is a fix to "pftn.c" that will, at least,
make the compiler complain that "declared argument context is
missing". I think I posted the fix to comp.bugs.sys5 and/or
comp.bugs.4bsd a while ago; you might try digging through your
archives for that. If it doesn't turn up, I'll repost it.
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy@sun.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads