This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21960] New: Incorrect Syntax NOT rejected
- From: "eric at ez-soft dot demon dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jun 2005 14:14:25 -0000
- Subject: [Bug c++/21960] New: Incorrect Syntax NOT rejected
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
The code snippet below contains a syntax error.
The line "i = 4," is termited by a "," instead of a ";", but it still compiles
fine. Even the result of the compilation is correct.
I expected the "Parse error before ..." here, but the compiler doesn't even
give a warning.
If the line "printf .... " is removed, the compiler give the error message I
expected. Also when the line would be "int i = 4," the error is given.
I hope you have enough information now.
Regards,
Eric Zuur.
Code snipet:
#include <stdio.h>
int main()
{
int i;
i = 4,
printf("int=%d\n", i);
return (i);
}
Compiler version and OS information:
nlezu0@kslinux05> g++ -v -save-temps test.cpp
Reading specs from /apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/cpp0 -lang-c++ -v -D__GNUC__=2 -
D__GNUG__=2 -D__GNUC_MINOR_
_=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -
D__i386__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -
D__i386 -D__i386__ -Di686 -Dp
entiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ test.cpp test.ii
GNU CPP version 2.95.3 20010315 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/../../../../include/g++-3
/usr/local/include
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/../../../../i686-pc-linux-
gnu/include
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/cc1plus test.ii -quiet -
dumpbase test.cc -version -o test.s
GNU C++ version 2.95.3 20010315 (release) (i686-pc-linux-gnu) compiled by GNU C
version 2.95.3 20010315 (re
lease).
as -V -Qy -o test.o test.s
GNU assembler version 2.11.90.0.8 (i386-redhat-linux) using BFD version
2.11.90.0.8
/apps/oss/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/collect2 -m elf_i386 -dynamic-
linker /lib/ld-linux.so.2 /us
r/lib/crt1.o /usr/lib/crti.o /apps/oss/lib/gcc-lib/i686-pc-linux-
gnu/2.95.3/crtbegin.o -L/apps/oss/lib/gcc-
lib/i686-pc-linux-gnu/2.95.3 -L/apps/oss/lib test.o -lstdc++ -lm -lgcc -lc -
lgcc /apps/oss/lib/gcc-lib/i686
-pc-linux-gnu/2.95.3/crtend.o /usr/lib/crtn.o
--
Summary: Incorrect Syntax NOT rejected
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eric at ez-soft dot demon dot nl
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: Linux 2.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21960