Sponsored Content
Operating Systems HP-UX Program crashes with optimization level O2 Post 302131788 by Yuriy07 on Monday 13th of August 2007 05:39:45 PM
Old 08-13-2007
Program crashes with optimization level O2

I am experiencing a difficulty undersatnding why my program (C++, HP UNIX) crashes. It crashes only when I build it with -O (+O2) optimization switch (used in aCC compiler). It works ok with +O0 or +O1 optimization.

Also, I see that local variables are shown incorrecly when program is built with +O2 optimization switch. They show correcly with +O0 or +O1 optimization.

Could anyone advise me on the +O2 optimization? Why this could lead to the crash? Why the debugger fails to show correctly the local variables?

It is compiled with the following switches:
/opt/aCC/bin/aCC -AA -DHPUX -DBUILD_UNIX -DNO_MSG_BUILD -DNO_MAP_BUILD -DUNICODE -DPIC +Z +inst_auto -D_THREADSAFE -mt +W641 +W829 -g0 -O -I.. -I../.. -I../lib -I/usr/local/include/stl -I../pcmsrv32 -I../pcmlib -g0 -c

Below is the gdb output after the crash:

Program received signal SIGSEGV, Segmentation fault.
0x7f0cc484 in GetAddress (grid=0, link=0, rAddress=@0x0) at street.cpp:352
352 street.cpp: No such file or directory.
(gdb) backtrace
#0 0x7f0cc484 in GetAddress (grid=0, link=0, rAddress=@0x0) at street.cpp:352
#1 0x7f2409d8 in LRAddrOutput::AddressSearch (this=0x7f7f41e8, pInterp=0x0,
grid=13, oldNumMatches=2132813148, rLinkJuris=@0x7f7f41cc,
rPostalCodes=@0x7f7f41e8, rLinkInfo=@0x7f7f4178, rNameInfo=@0x7f7f4194,
exact=@0x7f7f4078) at geoaddrs.cpp:3845
#2 0x7f23e450 in LRAddrOutput::SearchForAddress (this=0x7f7f3fe0, gridID=0,
pInterp=0x401be934, exact=@0x7f129158) at geoaddrs.cpp:2887
#3 0x7f232b88 in LRAddrOutput::CalcMatches (this=0x0, pCB=0x0)
at geoaddrs.cpp:559
#4 0x7f244664 in LRAddr::Lookup (this=0x694, region=0x0,
state=0x3 <Error reading address 0x3: Invalid argument>, pCB=0x0)
at geoaddrs.cpp:4901
#5 0x7f24beb0 in CGeocoder::FindStreetMatchesW (this=0x4004cd7c,
addrW=0x4004cd38 "\177\026\357\b", cityW=0x401be3a4 "", stateW=0x0,
countyW=0x401be934 "", zipW=0x401be9b4 "", size=0 '\000', grid=7026188,
pCB=0x0, type=0, lLat=0, lLong=0) at geocoder.cpp:1044
#6 0x7f2a21d4 in Place_NumAddressMatches (geoID=2139042812,
inStr=0x7f7f33f0 "",
city=0xffffffff <Error reading address 0xffffffff: Bad address>,
state=0x0, county=0x401be934 "", zip=0x401be9b4 "", size=0 '\000',
grid=7026188, UpdateProgMeter=0) at placemgr.cpp:957
#7 0x7f30d5d4 in GeoCodeImpl::NodeForCityOrAddr (this=0x7f7f3300,
pGeoResults=0x7f2b8430, pszLookup=0x4000f608 "NA", bExactMatch=96,
bSPLC=false, bRdNameOnly=false) at geo_impl.cpp:542
---Type <return> to continue, or q <return> to quit---
#8 0x7f30df4c in GeoCodeImpl::Nodefor (this=0x401be370,
pszLookup=0x3 <Error reading address 0x3: Invalid argument>,
bExactMatch=-56, returnSPLC=96, pRtOptions=0x40009e78,
bTrySupressPicklist=false) at geo_impl.cpp:687
#9 0x7f336774 in RouteImpl::AddStop (this=0x401b7f58,
name=0x400c17ec "\177+g@t\nfin=CoPilot tiedostotiedot\nfre=Informations sur
le Fichier CoPilot\nger=CoPilot Dateiinformationen\ngre=\316\240\316\273\316\267
\317\201\316\277\317\206\316\277\317\201\316\257\316\265\317\202 \316\263\316\27
1\316\261 \317\204\316\277 \316\261\317\201\317\207\316\265\316\257\316\277 CoPi
lot\nita=Informazioni sui file di CoPilot"..., gc=0x7f7f31b0)
at route_impl.cpp:488
#10 0x7f39915c in PCMSAddStop (trip=333240,
stop=0x5159c "PCMSAddStop returned %d\n") at pcmsrvapp.cpp:1312
#11 0x266b8 in TestFuelOpt () at pcmstest.cpp:616
#12 0x25ae4 in main () at pcmstest.cpp:467
(gdb)

Any help is appreciated.
 

9 More Discussions You Might Find Interesting

1. Programming

AIX 5.3 64-bit program crashes with AIX 5.1

I have an AIX 64-bit program which uses following from AIX5.3 /usr/lib/libc.a(shr_64.o) /usr/lib/libpthread.a(shr_xpg5_64.o) /home/jeet_xp/export/power/usr/lib/libsarpc.a(shr.o) /unix /usr/lib/libcrypt.a(shr_64.o) /usr/lib/libc_r.a(shr_64.o) ... (3 Replies)
Discussion started by: jeet_xp
3 Replies

2. UNIX for Advanced & Expert Users

Which Base Level Filesets needed by a specific program?

hello... thats a great forum btw :) my problem is that I need a list of the Base Level Filesets (BLF) which are needed by a specific program. Is there any command/tool which shows me that? during the installation I can choose "Preview only" so that I can see what BLF´s are missing etc but... (4 Replies)
Discussion started by: cypher82
4 Replies

3. UNIX for Dummies Questions & Answers

Text book / online resource for learning to program at system/kernel level

Is there any book/resource that one can refer to, to be able to write programs at kernel/system level.. I'm looking for a programming book that could serve as a guide to write kernel codes / system level programming etc.. I have Tannenbaum's Design and Implementation. It addresses theoretical... (2 Replies)
Discussion started by: vishwamitra
2 Replies

4. Solaris

Difference between run level & init level

what are the major Difference Between run level & init level (2 Replies)
Discussion started by: rajaramrnb
2 Replies

5. Programming

C++ program crashes

Hi, Could anyone tell me the reason why the following program crashes? class A { int x; public: A() { cout << "from A()" << endl; } ~A() { cout << "from ~A()" << endl; } }; class B : public A { public: B() { cout << "from B()"... (2 Replies)
Discussion started by: royalibrahim
2 Replies

6. Programming

Program crashes on calling __libc_msgrcv()

Hi, I am a newbie to linux programming. I have implemented msgqueue in C. msgrcv() call at the client end is as below: msgrcv( msgqid, msgptr, msgsize, msgtype, 0 ); My program works fine when msgrcv () from /lib/libc.so.6 is called. However it crashes when __libc_msgrcv() is called. ... (3 Replies)
Discussion started by: praasanna
3 Replies

7. Programming

C++ program crashes

Hi, Can anyone tell me why the below program is crashing? and where exactly it is crashing. What is the corrective measure to be taken to make it work fine? #include <iostream> #include <cstring> using namespace std; class CString { char* m_data; public: CString() :... (6 Replies)
Discussion started by: royalibrahim
6 Replies

8. Red Hat

SSL certificate generation on OS level or application level

We have a RHEL 5.8 server at the production level and we have a Java application on this server. I know of the SSL certificate generation at the OS (RHEL) level but it is implemented on the Java application by our development team using the Java keytool. My doubt is that is the SSL generation can... (3 Replies)
Discussion started by: RHCE
3 Replies

9. UNIX and Linux Applications

Apcupsd crashes

I am trying to run apcupsd, but it will not retain contact the UPS root@meow:/home/ethan/UPS/gapcmon-0.8.9# /etc/init.d/apcupsd start Starting UPS power management: A copy of the daemon is still running. If you just stopped it, please wait about 5 seconds for it to shut down.... (0 Replies)
Discussion started by: Meow613
0 Replies
wibble-test-genrunner(1)				      General Commands Manual					  wibble-test-genrunner(1)

NAME
wibble-test-genrunner - Code generator for wibble testsuites. SYNOPSIS
wibble-test-genrunner header <file> wibble-test-genrunner main <files> DESCRIPTION
The program generates .cpp files that are then compiled and linked into a test program for running tests from .test.h files. Examples of such .test.h files may be found among wibble headers, eg. /usr/include/wibble/regexp.test.h. In the first form, the program processes a single header file (usually of the form foo.test.h) and produces a corresponding .cpp file to be compiled. In the second form, it takes as <files> all the .test.h headers and produces a single main.cpp which contains the main() function of the test program, which then runs all the tests in all the .test.h files. The generated source code is always written to standard output and it is left up to the user to redirect it to a meaningful location. The program currently has no options other than the two forms above. The program is intended to be run as part of build process of programs or libraries using the wibble testing framework. For convenient use from CMake, there is a test.cmake script under /usr/share/wibble, that takes care of producing all the .cpp files (both per-header and the main one), compiling them and linking them into a single binary which executes the testsuite. AUTHOR
Petr Rockai <me@mornfall.net> wibble-test-genrunner(1)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy