Bug 55443

Summary: parse error with gcc2.96, gcc3 is ok
Product: [Retired] Red Hat Linux Reporter: chrb
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://www.dcs.ed.ac.uk/~chrb/gccbug_311001.tar.gz
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-10-31 11:59:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description chrb 2001-10-31 11:59:44 UTC
Description of Problem:
gcc2.96 reports a parse error when gcc doesn't. This has been tested with gcc 
2.91.66 on rh6.2 and 2.96-98 on rh7.2. gcc3 compiles ok.

Version-Release number of selected component (if applicable):

2.98-98

How Reproducible:

always

Steps to Reproduce:
1wget http://www.dcs.ed.ac.uk/~chrb/gccbug_311001.tar.gz
2.tar -xzvf gccbug_311001.tar.gz; cd bug
3. gcc -c commands.i

Actual Results:

commands.c: In function `MakeFVsForChannelAccesses':
commands.c:935: parse error before `synch'
commands.c:938: `synch' undeclared (first use in this function)
commands.c:938: (Each undeclared identifier is reported only once
commands.c:938: for each function it appears in.)

Expected Results:

should have compiled -
gcc3  -c commands.i
no errors reported

Additional Information:
 
on redhat 7.2:

$ gcc -v -save-temps  -I. `glib-config --cflags` commands.c
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v -I. -I/usr/include/glib-1.2 
-I/usr/lib/glib/include -D__GNUC__=2 -D__GNUC_MINOR__=96 
-D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ 
-D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) 
-D__NO_INLINE__ -Acpu(i386) -Amachine(i386) -Di386 -D__i386 
-D__i386__ -D__tune_i386__ commands.c commands.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) (cpplib) 
(i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/include/glib-1.2
 /usr/lib/glib/include
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1 commands.i -quiet -dumpbase 
commands.c -version -o commands.s
GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) 
(i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat 
Linux 7.1 2.96-98).
commands.c: In function `MakeFVsForChannelAccesses':
commands.c:935: parse error before `synch'
commands.c:938: `synch' undeclared (first use in this function)
commands.c:938: (Each undeclared identifier is reported only once
commands.c:938: for each function it appears in.)

Comment 1 Jakub Jelinek 2001-11-12 13:56:27 UTC
This is not a bug, buggy is your code.
Try -pedantic-errors option in gcc3, you'll get
ISO C89 forbids mixed declarations and code
error. ISO C99 allows this, but gcc by default compiles C89 code and in gcc3
supporting this in C89 mode is just a GNU extension.