Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Problem trying to get 32-bit exe from 64 bit gfortran

fmolina (TechnicalUser) (OP)
28 Jul 10 14:19
Hello all:

This is probably a silly question, but I cannot find the answer.
I am using the gcc 64 bits compiler package dwonloaded from, running on windows XP x64.
Consider the following short f90 program:


program test32
implicit none
real*8 a, b
a = 2.0
b = 3.0 + a
print *, b
end program
Compiling with:
gfortran test32.f90
Compiles and runs OK. But if I want to make a 32 bits executable, issuing:
gfortran -m32 test32.f90
it gives the following messages:
C:\Temp\ccIkytx5.s: Assembler messages:
C:\Temp\ccIkytx5.s:8: Error: invalid instruction suffix for `push'
C:\Temp\ccIkytx5.s:39: Error: invalid instruction suffix for `push'

I tried things like -march=k8 etc but none works with -m32. What am I doing wrong?

Thanks in advance

NickFort (TechnicalUser)
28 Jul 10 16:06
Hey Fernando,

I think that should work, although I've never dealt with 64-bit systems; they seem to be more trouble than they're worth to me.

My personal thoughts on x64 aside, I have a sneaking suspicion that the problem is your gfortran binaries. I've also used the GCC build from in the past -- and it had problems. The one I encountered was that it wouldn't accept wildcards, so you couldn't say "gfortran *.f90 -o test", for example. I contacted the gfortran developers, who told me that that meant the gfortran binaries were incorrectly built; gfortran should support that. Indeed, here:

we read: "MinGW 32/64bit builds by  (builds were announced at comp.lang.fortran and are said to work well - but is not affiliated with any MinGW or GCC developer. Use at your own risk)"

What I would suggest is scrapping the installation, and trying another one. On the same page above, the MinGW for Win64 binaries are officially supported. Why don't you dig around on there; for example, this one might work:

I'm not sure if that'll solve your problem, but you can try it.

Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.

fmolina (TechnicalUser) (OP)
29 Jul 10 15:58
Hi NickFort

Thanks for your answer. I will try with MinGW and tell you what happens.


fmolina (TechnicalUser) (OP)
4 Aug 10 11:50
Hi NickFort,

I tried with several builds from the mingw-64 project. When I issue:
gfortran -m32 test32.f90
Now compilation goes OK, but ld is having trouble; I got messages like these:
c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5/libgfortranbegin.a when searching for -lgfortranbegin
[... a couple of times again the same message ...]
c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgfortranbegin

and similar for other libraries (gfortran, mingw32, gcc_s, etc.). I am pretty sure that ld does not find the 32 bits libraries, but I dont' know where they are. Should I get them from the mingw builds targeting 32 bits?


NickFort (TechnicalUser)
5 Aug 10 3:09
Fernando, I honestly have no idea. The only thing I can suggest is that you ask the gfortran developers themselves. They are generally very quick to respond and very helpful. You can contact them at the mailing list:

Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close