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

             Bug #: 52790
           Summary: Problems using x86_64-w64-mingw-w32-gfortran with
                    mcmodel=large and medium
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: wyldckat+gcc.bugzi...@gmail.com


Created attachment 27043
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27043
Example that works on Linux x86_64 but not with mingw-w64 on/for Windows

Attached is "test.f", an example file of Fortran code that will build just fine
on Linux x86_64, but it will not build with "x86_64-w64-mingw32-gfortran.exe"
on Windows or with a cross-compilation "build kit" on Linux.

Commands for building this test file:
- on several Linux x86_64 boxes with various gcc versions, all of these work:
 1.   gfortran -O3 test.f
 2.   gfortran -O3 -mcmodel=medium test.f
 3.   gfortran -O3 -mcmodel=large test.f
the last one is what I have to use with the real code, due to the number and
dimensions of the pre-allocated arrays.


- on Windows or cross-compiled from Linux, all of these don't work:
 1.   x86_64-w64-mingw32-gfortran.exe -O3 test.f
 2.   x86_64-w64-mingw32-gfortran.exe -O3 -mcmodel=medium test.f
 3.   x86_64-w64-mingw32-gfortran.exe -O3 -mcmodel=large test.f

The errors vary depending on option. In order, the summary "complaints" are:
 1.   In function `pre_c_init' [...] crtexe.c [...] relocation truncated to
fit: R_X86_64_PC32 against symbol ...

 2.   as.exe: BFD (GNU Binutils) 2.22.51.20111217 assertion fail [...]
coff-x86_64.c [...] cannot represent relocation type BFD_RELOC_386_GOTPC

 3.   as.exe [...] cannot represent relocation type BFD_RELOC_X86_64_GOTPC64


Tested build systems:
- custom build: binutils 2.21 + gcc 4.5.3 (gmp 4.3.2 + mpfr 2.4.2 + mpc 0.8.2)
+ mingw-w64 CRT v1.x
- custom build: binutils 2.22 + gcc 4.6.3 (gmp 5.0.2 + mpfr 3.0.1 + mpc 0.9) +
mingw-w64 CRT v2.x
- automatic build from the mingw-w64 project (Gcc 4.7.0 and binutils
2.22.51.20111217), namely with the package:
mingw-w64-bin_i686-mingw_20111220.zip



This was initially reported on the mingw-w64 project bug tracker:
http://sourceforge.net/tracker/?func=detail&atid=983354&aid=3505342&group_id=202880
The answer was and I quote:
  «This bug report is invalid on this list. You can open a feature-request on
gcc's bugtracker for it, but x64 windows target is using small-memory model
only. larget memory-model isn't supported at all, and medium is at least
absolutely untested.
  Therefore I close this bug as invalid, as it has nothing to do with mingw-w64
itself.»

Reply via email to