Operating System - HP-UX
1834288 Members
2313 Online
110066 Solutions
New Discussion

GCC 3.0.1/3.0.2 compiled program "memory fault" at run-time with STL...

 
Allan Stirrett
Occasional Advisor

GCC 3.0.1/3.0.2 compiled program "memory fault" at run-time with STL...

Hi,

I've been up against a brick wall trying to port code that runs fine on Linux, Solaris and Win32 over to HP-UX. I've isolated the problem and have a very short example (attached).

When I build and run this sample program, depending on the value I provide for the _ARRAYLEN macro, I either get "Bus error", "Memory fault", or it runs successfully. Since the failure happens on entry to a sub-function, my first thought was "I've filled the stack."

The strange thing is this: values where it runs fine are both lower than AND higher than the values where it crashes. If I had filled the stack, higher values would fill the stack even more, so that theory is out the door.

I've installed the latest "stable" releases of GCC that I know of for HP-UX: 3.0.1 from the "HP-UX Porting and Archive Centre" mirror at U. Alberta, and later 3.0.2 from http://dsportal.eservices.hp.com/. I can also get this program to fail using STLport 4.5.1 (which is our STL of choice), just using different values, but I wanted to remove all the variables for this post.

Any ideas? Any help/hints/tips would be GREATLY appreciated. I noticed one post about ensuring the size of the swap on 11i is 4-times the physical memory size, but I've got 4GB or dev swap and 1GB of physical memory, so I think I'm okay there. This is (I hope) the last roadblock to a successful port to HP-UX. Thanks in advance.

Allan Stirrett.