public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21960] New: Incorrect Syntax NOT rejected
@ 2005-06-08 14:14 eric at ez-soft dot demon dot nl
  2005-06-08 14:18 ` [Bug c++/21960] " eric at ez-soft dot demon dot nl
  2005-06-08 14:18 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: eric at ez-soft dot demon dot nl @ 2005-06-08 14:14 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/21960] Incorrect Syntax NOT rejected
  2005-06-08 14:14 [Bug c++/21960] New: Incorrect Syntax NOT rejected eric at ez-soft dot demon dot nl
  2005-06-08 14:18 ` [Bug c++/21960] " eric at ez-soft dot demon dot nl
@ 2005-06-08 14:18 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-08 14:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-08 14:18 -------
THis is valid code as comma is an operator.
a, b; is valid for all expressions, a and b. Since return is a statement and not an expression we get an 
error for that case.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21960


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/21960] Incorrect Syntax NOT rejected
  2005-06-08 14:14 [Bug c++/21960] New: Incorrect Syntax NOT rejected eric at ez-soft dot demon dot nl
@ 2005-06-08 14:18 ` eric at ez-soft dot demon dot nl
  2005-06-08 14:18 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: eric at ez-soft dot demon dot nl @ 2005-06-08 14:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From eric at ez-soft dot demon dot nl  2005-06-08 14:17 -------
Now the compiler version and OS information of the v3.3.1 compiler. Previous 
post gave the compiler version and OS information of the v2.95.3 compiler.

Reading specs from /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-
gnu/3.3.1/specs
Configured with: ./configure --prefix=/nfs/rvl/users/nlezu0/usr/local
Thread model: posix
gcc version 3.3.1
 /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1plus -
E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -
D__GNUC_PATCHLEVEL__=1 -D_GNU_SOURCE test.cpp test.ii
ignoring nonexistent directory "/nfs/rvl/users/nlezu0/usr/local/i686-pc-linux-
gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /nfs/rvl/users/nlezu0/usr/local/include/c++/3.3.1
 /nfs/rvl/users/nlezu0/usr/local/include/c++/3.3.1/i686-pc-linux-gnu
 /nfs/rvl/users/nlezu0/usr/local/include/c++/3.3.1/backward
 /usr/local/include
 /nfs/rvl/users/nlezu0/usr/local/include
 /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/include
 /usr/include
End of search list.
 /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1plus -
fpreprocessed test.ii -quiet -dumpbase test.cpp -auxbase test -version -o test.s
GNU C++ version 3.3.1 (i686-pc-linux-gnu)
        compiled by GNU C version 2.95.3 20010315 (release).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as --traditional-format -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
 /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/collect2 -
m elf_i386 -dynamic-linker /lib/ld-
linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /nfs/rvl/users/nlezu0/usr/local/lib/g
cc-lib/i686-pc-linux-gnu/3.3.1/crtbegin.o -
L/nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1 -
L/nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../.. 
test.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -
lgcc /nfs/rvl/users/nlezu0/usr/local/lib/gcc-lib/i686-pc-linux-
gnu/3.3.1/crtend.o /usr/lib/crtn.o


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21960


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-08 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-08 14:14 [Bug c++/21960] New: Incorrect Syntax NOT rejected eric at ez-soft dot demon dot nl
2005-06-08 14:18 ` [Bug c++/21960] " eric at ez-soft dot demon dot nl
2005-06-08 14:18 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).