- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Optimization problems with aC++ 3.50/3.52 on 1...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2004 04:59 AM
04-16-2004 04:59 AM
Our code compiles and executes without any problems when optimizations are turned off or only level 1 optimizations are used. When level 2 optimizations are enabled using either the -O or +O2 flags, some of our demo applications crash with a signal 10, Bus error.
The following are a couple of traces we get using gdb on the core file:
1)
Core was generated by `server'.
Program terminated with signal 10, Bus error.
(no debugging symbols found)...
warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the
program.
#0 0xc0000000000beef8 in pthread_mutex_lock+0 ()
from /usr/lib/pa20_64/libpthread.1
Unable to find AP register.
2)
Core was generated by `eventserv'.
Program terminated with signal 10, Bus error.
#0 0xc0000000000beef8 in ?? ()
warning: Attempting to unwind past bad PC 0xc0000000000beef8
#1 0xc000000000076a6c in ?? ()
NOTE: the -mt flag was used to set the appropriate threading flags
Are there any known issues with the optimizer on this compiler? Has anyone come across any similar issues? HP-UX 11i was recently installed (last couple of months) on our system and I believe the most recent update CDs were used.
Thanks,
Darren
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2004 04:20 AM
04-19-2004 04:20 AM
SolutionPerhaps the +O2 code is using more stack space for storing registers and local variables than the non-optimized code. That could happen if the optimized code saved and restored many registers for something like loop unrolling in some functions.
Try increasing the stack size for your threads. You can do that with a call to pthread_attr_setstacksize before pthread_create or with the non-portable pthread_default_stacksize_np function.
- Tags:
- guard page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2004 04:34 AM
04-19-2004 04:34 AM
Re: Optimization problems with aC++ 3.50/3.52 on 11.11 (PA-RISC)
The current patch for 11.11 C++ is PHSS_29483.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 03:28 AM
04-20-2004 03:28 AM
Re: Optimization problems with aC++ 3.50/3.52 on 11.11 (PA-RISC)
As a follow up, is there a way to modify this value for the system (for example, on the command line) so that I don't have to call the pthread_attr_setstacksize function for every program that I write? I'm asking this because the code we are writing is designed to run on a variety of platforms and I don't want to fix something on other systems that isn't broken. I realize that I could just put a #if/#endif block checking for PA-RISC (which is what I have right now) but I was wondering if there was another way.
Thanks,
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2004 05:22 AM
04-20-2004 05:22 AM
Re: Optimization problems with aC++ 3.50/3.52 on 11.11 (PA-RISC)
You could encapsulate that step by linking your programs against a shared library that set the default stack size in an initializer function. This simple library would set the thread stack size to either 128K or a value set in a THREAD_STACK_SIZE environment variable. It could be used with the LD_PRELOAD environment variable to affect an already compiled program. (LD_PRELOAD is described in "man dld.sl".)
thread_stack.c:
---------------------
#include
#include
void thread_stack()
{
size_t size = atol(getenv("THREAD_STACK_SIZE"));
if (size == 0) size = 128*1024;
pthread_default_stacksize_np(size, NULL);
}
Makefile:
---------------------
libthread_stack.sl: thread_stack.c
cc +z -c thread_stack.c
ld -b -o libthread_stack.sl thread_stack.o +init thread_stack
rm thread_stack.o