- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have recently moved a whole bunch of code from an IA-32 system to a new Intel EM64T system, and I need to recompile and optimize.
I've got everything working properly, up to the point of the first optimization. That is, with "-O0" everything compiles and executes just fine. Now, when I invoke the "-O1" flag, I get a big old segmentation fault. I used to be able to optimize this code up to "-O2" on the IA-32 system.
It seems to me that the problem can't be with the code itself; it works perfectly unoptimized. So, I am wondering if someone can point me to a list of exactly what goes into the first level of optimization, and what I might turn on/off to try to alleviate this problem. What is handled differently between the 64 optimization and the 32?
Any help would be appreciated! It seems like a lot of people have had similar difficulties, but I haven't been able to track down the problem. I suspect lots more people will have this problem, so it might be nice to have a place where this is all laid out clearly.
Thanks! This software network has been really useful for me!
Jeff
I have recently moved a whole bunch of code from an IA-32 system to a new Intel EM64T system, and I need to recompile and optimize.
I've got everything working properly, up to the point of the first optimization. That is, with "-O0" everything compiles and executes just fine. Now, when I invoke the "-O1" flag, I get a big old segmentation fault. I used to be able to optimize this code up to "-O2" on the IA-32 system.
It seems to me that the problem can't be with the code itself; it works perfectly unoptimized. So, I am wondering if someone can point me to a list of exactly what goes into the first level of optimization, and what I might turn on/off to try to alleviate this problem. What is handled differently between the 64 optimization and the 32?
Any help would be appreciated! It seems like a lot of people have had similar difficulties, but I haven't been able to track down the problem. I suspect lots more people will have this problem, so it might be nice to have a place where this is all laid out clearly.
Thanks! This software network has been really useful for me!
Jeff
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That the code works without optimization does not mean that the code is correct. There are many coding errors that will reveal themselves only when optimization is enabled so that the compiler makes additional assumptions about the legality of the code.
Your best bet is to use a debugger to identify the code that is getting the segfault and then to determine why. A list of optimizations isn't going to be helpful. You might try turning on some of the compiler diagnostics such as:
-CB -gen-interface -warn interface
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Thanks for your advice. The problem, I believe, has to do with the compatibility of the newer versions of fortran with the older ones. The programs I am trying to compile were written over the last 30 years (some translated from punch-cards) by a collaborator of mine. There are of course some conventions which have fallen out of favor, and apparently this creates a little bit of trouble in the optimization.
In any case, I wanted to post a reply so that others in a similar situation may be able to benefit...
1) I was able to trace the problem, using the -traceback compiler option, all the way to the particular subroutine that was having issues.
2) Once I was able to trace the problem back to a particular subroutine, I isolated it in the compile step. So, I would compile everything except that routine using -O1 or -O2, and compile the problem routine with -O0.
3) After linking, the code executed properly and I have not encountered any problems yet.
This probably isn't the most elegant way to do things, but trying to dig through megabytes of text to root out subtle compatibility problems would simply take too much time.
Thanks for your help! It's a great bulletin board you have here.
Thanks for your advice. The problem, I believe, has to do with the compatibility of the newer versions of fortran with the older ones. The programs I am trying to compile were written over the last 30 years (some translated from punch-cards) by a collaborator of mine. There are of course some conventions which have fallen out of favor, and apparently this creates a little bit of trouble in the optimization.
In any case, I wanted to post a reply so that others in a similar situation may be able to benefit...
1) I was able to trace the problem, using the -traceback compiler option, all the way to the particular subroutine that was having issues.
2) Once I was able to trace the problem back to a particular subroutine, I isolated it in the compile step. So, I would compile everything except that routine using -O1 or -O2, and compile the problem routine with -O0.
3) After linking, the code executed properly and I have not encountered any problems yet.
This probably isn't the most elegant way to do things, but trying to dig through megabytes of text to root out subtle compatibility problems would simply take too much time.
Thanks for your help! It's a great bulletin board you have here.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page