🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1347

gcc 2.3.1 -- filename in errors wrong?

#1347
From: Karl Berry
Date: Wed, 11 Nov 1992 05:58
35 lines
1791 bytes
It seems the preprocessor in GCC 2.3.1 sometimes gets confused as to
what file to report errors in.  Consider the following five-line file foo.c:

extern int a;
extern int b;
#line 1 "./foo.y"
foo
#include "foo.h"

And the one-line file foo.h:

extern int x;

Running `gcc foo.c' reports the error at the erroneous `foo' as follows:

In file included from foo.c:2:
./foo.h:1: syntax error before `extern'

That should be `In file included from foo.y:2:'.  Line two of foo.c is
not in error.

This was on a 486 running Interactive Unix 2.2.1 (configured as
--with-gnu-as i386-isc), and also on an IBM RT running AOS/4.3BSD
(configured as romp-aos), but I doubt the bug is system-dependent.

On the 486, the complete -v output is the following:

Reading specs from /usr/local/gnu/lib/gcc-lib/i386-isc/2.3.1/specs
gcc version 2.3.1
 /usr/local/gnu/lib/gcc-lib/i386-isc/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dunix -Di386 -D__unix__ -D__i386__ -D__unix -D__i386 foo.c /tmp/cca21680.i
GNU CPP version 2.3.1 (80386, BSD syntax)
 /usr/local/gnu/lib/gcc-lib/i386-isc/2.3.1/cc1 /tmp/cca21680.i -quiet -dumpbase foo.c -version -o /tmp/cca21680.s
GNU C version 2.3.1 (80386, BSD syntax) compiled by GNU C version 2.3.1.
In file included from foo.c:2:
./foo.h:1: syntax error before `extern'
Technical Details
Message-ID: <199211111558.AA01984@claude.cs.umb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karl

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karl
From: karl@claude.cs.umb.edu (Karl Berry)
Subject: gcc 2.3.1 -- filename in errors wrong?
Message-ID: <199211111558.AA01984@claude.cs.umb.edu>
Sender: gnulists@ai.mit.edu
Reply-To: karl@cs.umb.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 11 Nov 1992 05:58:08 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 36