This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32165] New: Calling main allowed at O3 and Os
- From: "andrew dot stubbs at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 May 2007 15:08:00 -0000
- Subject: [Bug c++/32165] New: Calling main allowed at O3 and Os
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
int
main ()
{
main();
}
Compiling this program at different optimisation levels gives different
results. Levels O3 and Os appear to be broken (with GCC 4.1.1).
$ g++ t.cxx -c -ansi -pedantic -O0
t.cxx: In function ?int main()?:
t.cxx:4: error: ISO C++ forbids taking address of function ?::main?
$ g++ t.cxx -c -ansi -pedantic -O1
t.cxx: In function ?int main()?:
t.cxx:4: error: ISO C++ forbids taking address of function ?::main?
$ g++ t.cxx -c -ansi -pedantic -O2
t.cxx: In function ?int main()?:
t.cxx:4: error: ISO C++ forbids taking address of function ?::main?
$ g++ t.cxx -c -ansi -pedantic -O3
$ g++ t.cxx -c -ansi -pedantic -Os
--
Summary: Calling main allowed at O3 and Os
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrew dot stubbs at st dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32165