Why is my fortran program giving an internal compiler error with gfortran?

In summary, if you're experiencing an internal compiler error with gfortran, it's best to contact the developers for assistance and make sure to review the documentation for both compilers to ensure proper syntax.
  • #1
jjytarheel
1
0
hello,

I have a program that compiles and runs fine with the ifort compiler (a fortran 90 program). This program is on a server at my university. When I download the program to my own computer, and use gfortran to compile it (as I do not have ifort available), I get an internal compiler error in gfc_generate_function_code. The only changes that was made to the programs I had was to change all the "ifort" to "gfortran" in my Makefile. Other than that my program is exactly the same.
Any ideas on why it won't compile with gfortran? Or ideas of how to proceed?
The error occurs at a random spot in my own code, at the start of new function definition. If I move that function down to the bottom of the list of functions, the error occurs in at the top of next function in line, so I don't think it has anything to do with my actual code there.
Thank you!
 
Technology news on Phys.org
  • #2
</code>If you're getting an "internal compiler error" with gfortran, it's likely an issue with the compiler itself. The best thing to do is to contact the developers of gfortran to report the issue and see if they can help you resolve it. Generally, the developers of a compiler will be the best people to help you with any issues related to the compiler. In terms of porting the program from ifort to gfortran, it's good that you changed the Makefile to reflect the correct compiler. It's also likely a good idea to check the documentation for both compilers to make sure you understand the differences in their syntax. This should help you identify any other potential problems when porting the program.
 

1. What is the difference between Ifort and gfortran?

Ifort and gfortran are both compilers used for the Fortran programming language. Ifort is developed by Intel and is optimized for Intel processors, while gfortran is developed by GNU and is open source. They may have slightly different syntax and options, but they both aim to compile and execute Fortran code.

2. Why am I getting an error when trying to switch from Ifort to gfortran?

Ifort and gfortran may have different default settings and flags, so when switching from one to the other, it is important to check for any differences in the code or to specify the appropriate flags for the chosen compiler. Additionally, some code may be specific to one compiler and may not be compatible with the other.

3. Can I use both Ifort and gfortran in the same code?

Yes, it is possible to use both Ifort and gfortran in the same code, but it may require some additional steps. For example, you may need to specify different flags or use conditional statements to compile different parts of the code with the appropriate compiler.

4. How can I troubleshoot an Ifort -> gfortran error?

The first step in troubleshooting an error is to carefully read and understand the error message. It may provide clues as to what is causing the error. It can also be helpful to check for any differences in syntax or flags between the two compilers. Additionally, searching online for solutions or asking for help from experienced Fortran programmers can also be beneficial.

5. Is it better to use Ifort or gfortran?

There is no definitive answer to this question as it depends on individual preferences and requirements. Ifort may be more optimized for Intel processors and may have better performance, while gfortran is open source and may be more accessible to a wider range of users. It is recommended to try both and see which one works best for your specific needs.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
2
Views
7K
  • Programming and Computer Science
2
Replies
37
Views
3K
  • Nuclear Engineering
Replies
6
Views
1K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
13
Views
2K
  • Programming and Computer Science
Replies
4
Views
620
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
Back
Top