weird C-compiler error message

Guy Harris guy at sun.uucp
Sat Jun 14 13:22:24 AEST 1986


> ) ... if your users are aware that "compiler error" really means "bring this
> ) message, along with the source code, to your local support person", ...
> 
> I must take some exception to this.  Your local support person is too busy
> to tell 50 people that "compiler error: gork blunge snarf" means "formal not
> declared on argument list".

I must take some exception to this.  You're assuming that "compiler error:
<foo bar bletch>" *does* mean "formal not declared on argument list".  It
doesn't (note that, while the S5 compiler does generate such a message in
this case, earlier PCC compilers generate *no* error).  What it means is
"somebody working on the compiler f***ed up".   Your local support person
better not be too busy to do the appropriate thing in this instance, which
is to take the message, source code, etc., attach it to a bug report, and
send it to the vendor.

> For shame!  If (when the time comes to decide where in the argument list you
> found the item to be bound) you can't find it in the argument list, you
> should make a good effort to emit a useful error.

The problem isn't that it didn't find the item in the argument list, it's
that it wasn't in the argument list but it didn't realize it.  Since it
didn't even think there was an error, it could hardly have made an effort to
emit any error message, useful or not.  It just put its data structures into
an inconsistent state.  One version of the compiler (S5, VAX) detected this
inconsistency later;, by then, it had no idea what the problem was and
couldn't make any effort to say anything more meaningful that "oops!".
Other versions of the compiler don't even detect this inconsistency.

The fix is to properly check that the item which is allegedly being declared
as an argument actually appeared in the argument list; see my recent posting
here and in "net.bugs.*" for that fix.

> Failing that, publish a list of compiler errors as part of the error
> list so we know that "gork blunge snarf" means "one of your formal
> declarations was not on arg list".

Again, I point out that "gork blunge snarf" doesn't mean "one of your formal
declarations wasn't on arg list"!  It means "something is fouled up here",
and it just so happens that the foulup in this particular case was caused by
something being declared, in a scope where declarations are treated as
formal argument declarations, and the name hadn't previously appeared in the
argument list.

If the compiler writer had known that a particular "compiler error" message
would be emitted when a particular illegal program were fed to the compiler,
they would presumably have fixed the compiler to detect the illegal code and
not *get* to the place where the "compiler error" message is emitted!

At the back of one of IBM's mainframe PL/I compiler manuals (and probably at
the back of all such manuals), there is a long list of error messages.  Some
of them are "compiler error" messages.  They generally don't say "this error
really means you put extra crud in a DO statement, but we screwed up the
parser so it causes an inconsistent data structure in the compiler which is
detected later on."  They say "report this to your IBM support person",
because it means somebody ran across a *bug* in the compiler which,
presumably, the compiler writers didn't know was there.

The fact that this particular inconsistency was reported as a "warning"
rather than a fatal "compiler error" is probably a botch on the part of one
of the compiler maintainers.  That isn't, however, germane to this
particular discussion.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.lang.c mailing list