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]

[Bug c++/32165] New: Calling main allowed at O3 and Os


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


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