Run a fortran file



I'm trying to compile and run a fortran file (name zerodegen1). I used this command

$f77 -o zerodegen1 zerodegen1.f -limsl -lsocket -lnsl

and it compiles the file. But then, when I want to run the file using this command


I got this error message:
*** TERMINATING zerodegen1
*** Received signal 4 SIGILL
Illegal Instruction

Can you tell me what is the problem here?
7 answers Last reply Best Answer
More about fortran file
  1. Best answer
    Unlikely to be able to diagnose the problem without seeing the program.

    Short answer - there's something wrong with the program or your compiler configuration. Not a very helpful answer, but not a very helpful question.
  2. There's a bug in the code. Programmers call this a runtime error. Just because a program compiles doesn't mean that it will run as expected. Consult the author of the program and try to find a solution. There may be missing compiler options that are needed to get working code, but we wouldn't be able to help with that, only the author.
  3. Hmm. Illegal instruction errors aren't normally caused by logic errors in the program. A compiler option seems more likely.

    It might be instructive to run the program under gdb to see which instruction is causing the fault.
  4. Don't know about Fortran (haven't touched it for 20 years), but with C / C++ (etc) you normal use the compiler to create object modules, then use ld to link them to the run-time libraries and start-up code...

    I've always used tools like Automake to build makefiles that do the dirty work.
  5. Gcc automatically compiles, assembles, and links if you don't tell it to do otherwise. So the command in the op would have produced the executable. (It wouldn't have run far enough to die with an illegal instruction if it hadn't been properly linked.)
  6. Best answer selected by amirahazmi.
  7. Thank you so much for all the feedbacks. It was some kind of error in the code itself that has been fixed. The program works fine now.
Ask a new question

Read More

Fortran File Name