https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121733

            Bug ID: 121733
           Summary: Injection of __main into main for mingw-w64
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pali at kernel dot org
  Target Milestone: ---
            Target: *-w64-mingw32

mingw-w64 runtime since its first public release for both 32-bit and 64-bit x86
platforms automatically calls __main() function from its crt2.o object file
before calling the application's main() function.

gcc targets i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc automatically
injects invocation of __main() into application's main() function.

Therefore it should not be needed this auto-injection of __main into main done
by gcc for *-w64-mingw32 targets.

For example Linux target i686-linux-gnu-gcc does not do this auto-injection. So
is there any reason why it is enabled for *-w64-mingw32 but not for
*-linux-gnu-gcc?

Note that __main() function provided by mingw-w64 runtime contains guard to
prevent duplicate invocation, so it should not cause issues if the __main() is
called multiple times.

This report is for mingw-w64 (called *-w64-mingw32 in gcc), not the older
mingw32 or cygwin.

Reply via email to