This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/2191: GCC 2.95.2 gives misleading "syntax error" with headerfile typedef, when error is elsewhere



>Number:         2191
>Category:       c
>Synopsis:       GCC 2.95.2 gives misleading "syntax error" with headerfile typedef, when error is elsewhere
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 05 15:36:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mika Reunanen
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Linux (RedHat 7.0), Intel (350 MHz PII), default (enviroment) setting for ggc
>Description:
Gcc gives misleading "syntax error", when error is actually
typo in the source. Gcc claims, that error is in standard
header.

gcc -v -save-temp -Wall bug.c -o bug ouput:

Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/specs
gcc-V2.95.2: unrecognized option `-save-temp'
gcc version 2.95.2 19991024 (release)
 /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/cpp -lang-c -v -D__GNUC__=2 -D__
GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i38
6__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Wall -Acpu(i386) -Amachine(i
386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pent
iumpro -D__pentiumpro__ bug.c /tmp/cc3hLOsd.i
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/include/g++
 /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/../../../../i686-pc-linux-gnulib
c1/include
End of omitted list.
 /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.95.2/cc1 /tmp/cc3hLOsd.i -quiet -dump
base bug.c -Wall -version -o /tmp/ccWtMnoh.s
GNU C version 2.95.2 19991024 (release) (i686-pc-linux-gnulibc1) compiled by GNU
 C version 2.95.2 19991024 (release).
In file included from /usr/include/features.h:134,
                 from /usr/include/ctype.h:26,
                 from bug.c:3:
/usr/include/sys/cdefs.h:118: syntax error before `typedef'
>How-To-Repeat:
Repeating is easy: just compile bug.c with options descripted 
above.

I have got same effect with different version gcc (2.8.1, 
egcs-2.91.66, 2.95.2). Main difference is when error messages
is displayed.



>Fix:
Work around: don't make typos ;)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.c"

diAvKiA8LS0tLSB0aGF0IGlzIHR5cG8sIHdoaWNoIG1ha2VzIGdjYyBjb25mdXNlZC4uLiAqLwoK
I2luY2x1ZGUgPGN0eXBlLmg+CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXJl
dHVybigwKTsKfQo=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]