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]
Other format: [Raw text]

c++/6321: no warning for bad main function declaration



>Number:         6321
>Category:       c++
>Synopsis:       no warning for bad main function declaration
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 16 05:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     benedictbrown@yahoo.com
>Release:        unknown-1.0
>Organization:
>Environment:
RH Linux 7.2 (full install).
Tested on both gcc 2.95.3 and gcc 3.0.2
>Description:
No warning is given when the main function arguments are wrong (not argc, argv), even when -Wall is set.  The program simply seg faults when it's run.  A warning _is_ given that the return type is incorrect.

The output with -v is listed below (gcc):
Reading specs from /opt/at/gcc/3.0.2/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/specs
Configured with: ../gcc-3.0.2/configure --prefix=/opt/at/gcc/3.0.2 --with-local-prefix=/opt/at/gcc/3.0.2 --with-gnu-as --with-as=/opt/at/gcc/3.0.2/bin/as --with-gnu-ld --with-ld=/opt/at/gcc/3.0.2/bin/ld --enable-cpp --enable-languages=c++ --disable-shared --disable-nls --host=i686-pc-linux-gnu
Thread model: single
gcc version 3.0.2
 /opt/at/gcc/3.0.2/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -I/edc/wa/benedict/g1_es1/csfg/ixl_gnu-assert-dbg/Tree/include -I. -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=2 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Wall -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ bert.cxx bert.ii
GNU CPP version 3.0.2 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/opt/at/gcc/3.0.2/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /edc/wa/benedict/g1_es1/csfg/ixl_gnu-assert-dbg/Tree/include
 .
 /opt/at/gcc/3.0.2/include/g++-v3
 /opt/at/gcc/3.0.2/include/g++-v3/i686-pc-linux-gnu
 /opt/at/gcc/3.0.2/include/g++-v3/backward
 /opt/at/gcc/3.0.2/include
 /opt/at/gcc/3.0.2/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/include
 /usr/include
End of search list.
 /opt/at/gcc/3.0.2/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/cc1plus -fpreprocessed bert.ii -quiet -dumpbase bert.cxx -g -ggdb -gstabs+ -Wall -version -o bert.s
GNU CPP version 3.0.2 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.2 (i686-pc-linux-gnu)
	compiled by GNU C version 3.0.2.
bert.cxx:45: `main' must return `int'
bert.cxx:45: return type for `main' changed to `int'
>How-To-Repeat:
just compile included source
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bert.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bert.ii"

IyAzICJiZXJ0LmN4eCIKY2xhc3MgQQp7CnB1YmxpYzoKCiAgIGNsYXNzIEIKICAgewoKICAgcHVi
bGljOgoKICAgICAgY2xhc3MgQwogICAgICB7CiAgICAgIHB1YmxpYzoKICAgICAgICAgQyhpbnQg
dikge3RoaXMtPnYgPSB2O30KICAgICAgICAgQyhjb25zdCBBOjpCOjpDJiBjKSB7dGhpcy0+diA9
IGMudjt9CiAgICAgICAgIEMoKSB7dj0wO30KCiAgICAgICAgIGludCB2OwoKICAgICAgfTsKICAg
ICAgY2xhc3MgRAogICAgICB7CiAgICAgIHB1YmxpYzoKICAgICAgICAgRChpbnQgdikge3RoaXMt
PnYgPSB2OyBDIGMxKHYpOyBDIGMyKGMxKTsgYz1jMjt9CiAgICAgICAgIEQoKSB7dj0wO30KCiAg
ICAgICAgIGludCB2OwogICAgICAgICBDIGM7CiAgICAgIH07CiAgICAgIEIoaW50IHYpIHtEIGQx
KHYpIDsgZD1kMTsgYyA9IGQuYzt9CiAgICAgIEIoKSB7O30KICAgICAgQyBjOwogICAgICBEIGQ7
CiAgIH07CgogICBBKCkgezt9CiAgIEEoaW50IHYpIHtCIGIxKHYpIDsgYj1iMTt9CiAgIEIgYjsK
Cn07CgoKdm9pZCBtYWluKGludCBpbjEsaW50IGluMixpbnQgJm91dDEsaW50ICZvdXQyLGludCAm
b3V0MykKewogICBBIGEoaW4xKTsKICAgQTo6QiBiMihpbjIpOwoKICAgb3V0MSA9IGEuYi5jLnYg
KyBiMi5jLnY7CiAgIG91dDIgPSBiMi5jLnY7Cn0K


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