f



Purify problem or compiler problem?

Hi,

I am using sun's CC (c++ compiler) to compile the follow code:

#define __REENTRANT
#include <stdio.h>
#include <pthread.h>

void *one(void *dummy);

void two(void);
void output(void);

int main (int argc, char **argv)
{
        pthread_t tid;
        pthread_create( &tid, NULL, one, NULL );
        pthread_join(tid,NULL);
}

void *one(void *dummy)
{
        output();
        two();
        return NULL;
}

void two(void)
{
        output();
}

void output(void)
{
        //char string[16468]; //This one purify likes
        //char string[16469]={0}; //This and greater makes purify spit
BSW's
        char string[16469]; //This and greater makes purify spit a
IPW/R's
        string[0]='\0';
}

This is purify's output:

IPW: Invalid pointer write
      This is occurring while in thread 7:
            void output()  [testmain3.o]
            void two()     [testmain3.o]
            void*one(void*) [testmain3.o]
            _thread_start  [libthread.so.1]
      Writing 1 byte to 0x7e5fbbef on the stack of thread 7.
      Address 0x7e5fbbef is    16473 bytes below frame pointer in
function void output().
     
 Thread Summary : 7 threads in existence
         Thread 0 [main thread]
         Stack Limit : (0xff3f0000 0xffbf0000), size = 0x800000
         Thread 1
         Stack Limit : (0x7ef10000 0x7f010000), size = 0x100000
         Stack Use : (0x7f00fa30 0x7f00fd54), size = 0x324
         Thread 2
         Stack Limit : (0x7e652000 0x7e656000), size = 0x4000
         Stack Use : (0x7e655978 0x7e655d54), size = 0x3dc
         Thread 3
         Stack Limit : (0x7f902b64 0x7f91e3f8), size = 0x1b894
         Stack Use : (0x7f9076d0 0x7f9078f4), size = 0x224
         Thread 4
         Stack Limit : (0x7ee0e000 0x7ef0e000), size = 0x100000
         Stack Use : (0x7ef0db30 0x7ef0dd54), size = 0x224
         Thread 6
         Stack Limit : (0x7e612000 0x7e616000), size = 0x4000
         Stack Use : (0x7e615b28 0x7e615d54), size = 0x22c
         Thread 8
         Stack Limit : (0x7e632000 0x7e634000), size = 0x2000
         Stack Use : (0x7e633b28 0x7e633d54), size = 0x22c

This is with CC. With gcc or g++ it does not have this problem. cc has
the problem too but with a larger number in the array.

Is it the compiler/linker bug or it purify making things up?

If it is the compiler I assume I am screwing up memory badly.

Matt
0
matt
2/6/2004 12:40:50 PM
comp.programming.threads 4878 articles. 1 followers. Post Follow

3 Replies
846 Views

Similar Articles

[PageSpeed] 31

In article <16800e49.0402060440.69d9ad9f@posting.google.com>,
Matthew <matt@holly.com.au> wrote:

% I am using sun's CC (c++ compiler) to compile the follow code:

The code looks fine, except for one thing -- one() should be
declared extern "C". I'm not aware of any issues with not doing
it on Solaris (and as you say, it also fails with cc), but
I feel bound to point it out.

Are you compiling with the -mt switch? If not, try it and see if the
problem goes away. Otherwise, is it failing when run normally? It
may be that Purify is being confused by the Solaris stack commitment
scheme, or that Purify is introducing the error when it modifies the
object files.

-- 

Patrick TJ McPhee
East York  Canada
ptjm@interlog.com
0
ptjm
2/6/2004 4:50:24 PM
Matthew,

I have been using purify for quite some time with gcc on solaris 2.5 to 
8.  I never had an issue like you describe.  I know Sun's cc uses some 
tricks to make things go faster  (are you compiling with any 
optimizations?).  Is your version of purify compatible with the compiler 
and OS?  If that combo is not listed as supported, you will invariably 
find issues - I did with incompatible versions of gcc/solaris/purify - 
strange core dumps, etc.

Also, what is the stack increment per thread for your machine?  Could it 
be that 16K string is overstepping the allowed stack size.  Purify 
itself may have an option for you to set this.

And last but not least, you did link in -lpthread, right :)

Good luck,
Misk

Matthew wrote:
> Hi,
> 
> I am using sun's CC (c++ compiler) to compile the follow code:
> 
> #define __REENTRANT
> #include <stdio.h>
> #include <pthread.h>
> 
> void *one(void *dummy);
> 
> void two(void);
> void output(void);
> 
> int main (int argc, char **argv)
> {
>         pthread_t tid;
>         pthread_create( &tid, NULL, one, NULL );
>         pthread_join(tid,NULL);
> }
> 
> void *one(void *dummy)
> {
>         output();
>         two();
>         return NULL;
> }
> 
> void two(void)
> {
>         output();
> }
> 
> void output(void)
> {
>         //char string[16468]; //This one purify likes
>         //char string[16469]={0}; //This and greater makes purify spit
> BSW's
>         char string[16469]; //This and greater makes purify spit a
> IPW/R's
>         string[0]='\0';
> }
> 
> This is purify's output:
> 
> IPW: Invalid pointer write
>       This is occurring while in thread 7:
>             void output()  [testmain3.o]
>             void two()     [testmain3.o]
>             void*one(void*) [testmain3.o]
>             _thread_start  [libthread.so.1]
>       Writing 1 byte to 0x7e5fbbef on the stack of thread 7.
>       Address 0x7e5fbbef is    16473 bytes below frame pointer in
> function void output().
>      
>  Thread Summary : 7 threads in existence
>          Thread 0 [main thread]
>          Stack Limit : (0xff3f0000 0xffbf0000), size = 0x800000
>          Thread 1
>          Stack Limit : (0x7ef10000 0x7f010000), size = 0x100000
>          Stack Use : (0x7f00fa30 0x7f00fd54), size = 0x324
>          Thread 2
>          Stack Limit : (0x7e652000 0x7e656000), size = 0x4000
>          Stack Use : (0x7e655978 0x7e655d54), size = 0x3dc
>          Thread 3
>          Stack Limit : (0x7f902b64 0x7f91e3f8), size = 0x1b894
>          Stack Use : (0x7f9076d0 0x7f9078f4), size = 0x224
>          Thread 4
>          Stack Limit : (0x7ee0e000 0x7ef0e000), size = 0x100000
>          Stack Use : (0x7ef0db30 0x7ef0dd54), size = 0x224
>          Thread 6
>          Stack Limit : (0x7e612000 0x7e616000), size = 0x4000
>          Stack Use : (0x7e615b28 0x7e615d54), size = 0x22c
>          Thread 8
>          Stack Limit : (0x7e632000 0x7e634000), size = 0x2000
>          Stack Use : (0x7e633b28 0x7e633d54), size = 0x22c
> 
> This is with CC. With gcc or g++ it does not have this problem. cc has
> the problem too but with a larger number in the array.
> 
> Is it the compiler/linker bug or it purify making things up?
> 
> If it is the compiler I assume I am screwing up memory badly.
> 
> Matt


-- 
========================================================================
Missaka Wijekoon (a.k.a. Misk)     mwijekoon@RemoveThis.villageEdocs.com
Sr. Software Engineer              http://www.villageEdocs.com
VillageEdocs
========================================================================
0
Missaka
2/6/2004 8:51:59 PM
In article <16800e49.0402060440.69d9ad9f@posting.google.com>,
	matt@holly.com.au (Matthew) writes:
> 
> This is purify's output:
> 
> IPW: Invalid pointer write

Look up the man page for purify and read the section on threads, in
particular the -thread-stack-change setting. In your case, you need to
increase the value. More information on this can be found at:

	http://www-1.ibm.com/support/docview.wss?uid=swg21125686

Otto

-- 
Otto Lind               Kabira Technologies (http://www.kabira.com)
otto@olcs.com           12193 285th street, Lindstrom, MN 55045
otto.lind@kabira.com    cell:(612)384-5259
0
otto
2/6/2004 9:44:09 PM
Reply:

Similar Artilces:

problems problems problems
(The short(?) summary) I've got an Access MDB file and a DAO connect with it.. Problem 1 of 2 The below gives me a runtime error 91 Object variable or With block variable not set. I've got the db stuff after the form.show (to make sure all the objects on the form are loaded before attempting to utilize/manipulate them) But it doesn't like it when I use the data object in the form load anyway for some reason.. pffft. Private Sub Form_Load() frmTest1Project.Show datGallery.Recordset.MoveLast datGallery.Recordset.MoveFirst Call LockTextBoxes(frmTest...

Purify problem or compiler problem? #2
Hi, I am using sun's CC (c++ compiler) to compile the follow code: #define __REENTRANT #include <stdio.h> #include <pthread.h> void *one(void *dummy); void two(void); void output(void); int main (int argc, char **argv) { pthread_t tid; pthread_create( &tid, NULL, one, NULL ); pthread_join(tid,NULL); } void *one(void *dummy) { output(); two(); return NULL; } void two(void) { output(); } void output(void) { //char string[16468]; //This one purify likes //char string[16469]={0}; //This and greater ...

Problem with a problem
Hello, take a grammar G with alphabet {0,1} such that (the word problem for) the language L_G={w in (0+1)*|w\in L(G)} is very complex, say in PSPACE or some higher complexity class. Now consider an "easy" problem EASY like: "Is an element of L_G in L_G?". Well, this seems to be fairly easy because the answer is "yes" in any case. Hence the problem should be of small complexity. But if one models such a decision problem one has to construct a language L with alphabet A such that the word problem for L reflects exactly the decision problem which one is interested...

Problem compiling a simple threading program
Hi Everybody, I am using Redhat Linux Release 9 (Shrike). I am learning threaded programming and trying to compile an example program listed at the end of this mail. I get the following problem using the command gcc test.c test.c:7: parameter `thread2' has just a forward declaration test.c:6: parameter `thread1' has just a forward declaration test.c:8: parse error before '=' token test.c:13: parse error before '&' token test.c:16: parse error before numeric constant test.c:16: warning: data definition has no type or storage class I don't know ...

Problems problems....
I've got Fujitsu MAN3184MP and Adaptec 29160 scsi card. Sometimes i have this message "A disk read error occured" , sometimes even bios does not recognize it, sometimes it does but the boot sequence does not start it seems that motherboard bios has problems with it ( so it seems to me, i could be wrong about that assumption) . Then i reset and it all works perfectly. I've noticed a speed degradation in Win XP lately. I'm angry :)) I have LVD/SE terminator, and i think 68pin cable ( not sure about that ). Hope i gave you enough info to try and help. Thanx! -- ----------------------------------- Makni #### iz adrese Seems obvious that the drive is going belly up. You could download the manufacture's utility disk and confirm it. I think time would more wisely be spent backing up your data before you can't read it at all. DaveL "biBU" <idolovcak####@inet.hr> wrote in message news:cuslus$ljq$1@fegnews.vip.hr... > I've got Fujitsu MAN3184MP and Adaptec 29160 scsi card. > > Sometimes i have this message "A disk read error occured" , sometimes even > bios does not recognize it, sometimes it does but the boot sequence does > not start it seems that motherboard bios has problems with it ( so it > seems to me, i could be wrong about that assumption) . Then i reset and it > all works perfectly. I've noticed a speed degradation in Win XP lately. > I'm angry :)) > > ...

problem compiling c (pro*c) program
HPUX 11iv2 (11.23) HP Itanium2 8 Gig RAM Oracle9i (9.2.0.6.0) I got this error below that I have not been able to solve. Can someone help? I am not a really a programmer .. more like a dba. $ Make_idbicms ld: Can't find library or mismatched ABI for -llibclntsh.so Fatal error. collect2: ld returned 1 exit status $ more Make_idbicms gcc -DPRINT -DLOG idba1Mainsend.c idba1ReadTransmit.c idba1AssembleMsg.c idba1UtilMQ.c idba1LogError.c idba1ReadConfig.c idba1UpdateReceive.c idba1DecodeMsg.c -ansi -I../INCLUDE -I/u01/app/oracle/9.2.0/precomp/public -L/opt/mqm/lib -lmqic - ...

Problem to compile with g77 a program which was normally compiled with Absoft compiler
Hello, I get the following error messages when I try to compile a program with g77 somefile.f:(.text+0x93): undefined reference to `for_open' somefile.f:(.text+0xf4): undefined reference to `for_write_seq_fmt' somefile.f:(.text+0x128): undefined reference to `for_write_seq_fmt_xmit' somefile.f:(.text+0x454): undefined reference to `for_read_seq' Could you help me to fix this? I have posted more details about my actions on http://stackoverflow.com/questions/3365742/f77-problem-to-compile-with-g77-a-program-which-was-normally-compiled-with-absof Thank you On 30/07/2010 10:2...

Threading problem / Paramiko problem ?
Hello everyone, I wrote "concurrent ssh" client using Paramiko, available here: http://python.domeny.com/cssh.py This program has a function for concurrent remote file/dir copying (class SSHThread, method 'sendfile'). One thread per host specified is started for copying (with a working queue of maximum length, of course). It does have a problem with threading or Paramiko, though: - If I specify, say, 3 hosts, the 3 threads started start copying onto remote hosts fast (on virtual machine, 10-15MB/s), using somewhat below 100% of CPU all the time (I wish i...

Is it a gtk2 problem or Threads problem
Hai All, In my application iam using threads under Gtk2.Iam trnsferring files with progressbars updation using threads.Some one suggested me to use Gtk2 qw/-init -threads-init/; If i used this, the application is hanging(means the widgets are not visible).Iam using only use threads and use threads ::shared.In this it is giving error(cannot read memory error) at Progressbar6->set_fraction($totalpercent); Can any one suggest me how to do this??? and What is Gdk assertion failed error. please give answer as early as possible In the below code get_value is a thread code block in w...

Problem figuring out threading problem for SCJP
Hi I have the following code -------------------------------------- <snip> class MyThread extends Thread { String sa; public MyThread(String sa) { this.sa = sa; } public void run() { synchronized(sa) { while(!sa.equals("Done)) { try { sa.wait(); } catch (InterruptedException e) {} } } System.out.println(sa); } } class Test { private static String sa = new String("Not Done"); ...

Re: How many files can you have in a VMS directory without performance problems? performance problems? performance problems? problems? performance problems? performance problems? problems? perfo
First, does anyone know why Info-VAX goes nuts on subjects from time to time? (Or is the trouble elsewhere?) From: JF Mezei <jfmezei.spamnot@teksavvy.com> > DELETE Z*.*;* > DELETE Y*.*;* > ... > DELETE A*.*;* > > (followed by the numbers). This scheme may be a bit obsolete. See: http://h71000.www7.hp.com/doc/731FINAL/4506/4506pro_014.html#index_x_890 I quote: [...] 5.2.3.1.2 Extended Character Set In addition, OpenVMS V7.2 on Alpha systems and ODS-5 disks includes support for the use of file names, and subdirectory and root subdirectory names, tha...

Problem with a Compiled Program
I have written and compiled a program. It runs on a machine with two processors. The operating system is Windows XP. Usually the program is not closed and started again, but it runs continuously. Sometimes the program disappears without any clear reason. Both GUI and DOS window are not visible anymore then. The program must be started again. I have run a very similar program several times on other computers, but this strange behaviour has not occured on the other computers so far. Does anybody know how to fix this? ...

Problems with compiled program
Hello! I�m having a compiler related problem: Running a compiled little m-function (incl. all necessary dll�s...) under WinXP is doing fine, the same under Win2k is dying... What can be the reason? Thank you very much, Richard ...

compiling BTG-0.9.5... linking problems... or problems whith my compiling-skill
Hi I've tried to compile btg-0.9.5 [http://btg.berlios.de/] under Madriva 2007.1 Spring (kernel 2.6.17-14), but it couldn't link some library... i readed config.log and i found a lot of errors like that: /usr/local/include/libtorrent/socket.hpp:48:27: error: asio/ip/tcp.hpp: No such file or directory or /usr/local/include/libtorrent/socket.hpp:83: error: 'asio' has not been declared But /usr/local/include/libtorrent/asio (and other subdirectories) exist! i've comiled also Libtorrent, then, to make the btg config script find the library, i've exported the enviro...

Re: How many files can you have in a VMS directory without performance problems? performance problems? performance problems? problems? performance problems? performance problems? problems? perfo #2
On 8/17/05, Mark Berryman <mark@theberrymans.com> wrote: > Steven M. Schweda wrote: > > First, does anyone know why Info-VAX goes nuts on subjects from time > > to time? (Or is the trouble elsewhere?) >=20 > Elsewhere. Info-VAX does not rewrite the subject. >=20 > Mark Berryman > Info-VAX admin >=20 I thought it was reacting to poster sanity bugchecks. : ^ ) WWWebb --=20 NOTE: This email address is only used for noncommerical VMS-related correspondence. All unsolicited commercial email will be deemed to be a request for services pursuant to the t...

CUPS problem? or network problem? or printer problem?
Trying to configure CUPS to print to an HP LaserJet 5si over the network. Here is the relevant error_log stuff: I [17/Nov/2003:14:19:03 -0500] Job 14 queued on 'ptr' by 'wm'. I [17/Nov/2003:14:19:03 -0500] Started filter /usr/lib/cups/filter/texttops (PID 12120) for job 14. I [17/Nov/2003:14:19:03 -0500] Started filter /usr/lib/cups/filter/pstops (PID 1 2121) for job 14. I [17/Nov/2003:14:19:03 -0500] Started filter /usr/lib/cups/filter/pstoraster (P ID 12122) for job 14. I [17/Nov/2003:14:19:03 -0500] Started filter /usr/lib/cups/filter/rastertoprint er (PID 1...

Is this a BIOS problem, a kernel problem or a user problem :-)
Hi all, I have a Dual Core P4, which dmesg reports as (CPU0 and) CPU1: Intel(R) Pentium(R) 5 CPU 2.66GHz stepping 07 Unfortunately, it is also reporting CPU: Hyper-Threading is disabled I went through the BIOS (AMI dated 2005) and saw no option to enable HT. uname -a reports Linux hwa3 2.6.17-10-generic #2 SMP Fri Oct 13 18:45:35 UTC 2006 i686 GNU/Linux so clearly the BIOS and the kernel see the processor as dual core. Is there a utility to do this (enable hyperthreading)? Am I going to have to recompile the kernel? Is there a set of Intel dual core CPU's which does not have H...

1] Problems with compiler 2] Problems with Rhide
Dear Group - Thank you for the help with the environment variable. I forgot to set the variable. I added SET DJGPP=c:\D\DJGPP\DJGPP.ENV, and everything works. However... I respectfully request your advice on the following: 1] I am using my wife's Windows 2000 computer, but booting off a drive that has DOS 7.1 loaded. I am not running a DOS shell off Windows 2000. I wrote the following trivial program, to test if my installation of DJGPP would work with DOS 7.1 #include <stdio.h> int main() { printf("hello world"); } I receive the following message on an at...

Strange error! Compiler problem? Or code problem?!!!!!!!
Greetings. The following code does not compile and I can't see why! I'm using C++Builder v6.0 (build 10.160). <code> #include <vector> class test { bool Fixed( unsigned int I ) const; bool& Fixed( unsigned int I ); private: std::vector<bool> pFixed; }; bool test::Fixed( unsigned int I ) const { return pFixed[I]; } bool& test::Fixed( unsigned int I ) { return pFixed[I]; // error: [C++ Error] test.cpp(21): E2357 Reference initialized with 'bool', needs lvalue of type 'bool' } </code> If the bool's are replace wit...

Web resources about - Purify problem or compiler problem? - comp.programming.threads

Compiler - Wikipedia, the free encyclopedia
... , or external linking . The most common reason for wanting to transform source code is to create an executable program. The name "compiler" ...

Compiler - Wikipedia, the free encyclopedia
"Compile" and "compiling" redirect here. For the software company, see Compile (publisher) . For other uses, see Compilation . This article has ...

Facebook Open-Sources HipHop PHP Compiler Software
Earlier this morning, Facebook officially made their new PHP “compiler,” called HipHop, available as open source software. In the blog post by ...

Art in the Age of Matter Compilers
jurvetson posted a photo: Sheba may be the harbinger of art in the digital age — a mathematical sculptor with digital matter. She manipulates ...

Interpreters and Compilers (Bits and Bytes, Episode 6) - YouTube
This animation explains the difference between interpreters and compilers. It is from Episode 6 of the classic 1983 television series, Bits and ...

Typesafe cofounder forking Scala compiler
The main contributor to the Scala compiler, Paul Phillips, has announced on GitHub that he is forking the compiler to “fix some of the innumerable ...

Does Apple's new developer agreement ban Adobe's Flash-to-iPhone compiler?
Given that any kind of formal truce between Apple and Adobe was essentially blown out of the water by Steve Job's very public slating of Flash ...

Apple seeds devs with Safari 5.2 for Lion, Xcode 4.4 with new LLVM compiler
... to the general public this summer. Among the new features: According to Apple, Xcode 4.4 includes an editor for Collada 3D files, compiler support ...

NVIDIA and Continuum Analytics Announce NumbaPro, A Python CUDA Compiler
... are announcing that they are bringing Python support to CUDA. Specifically, Continuum Analytics’ will be introducing a new Python CUDA compiler, ...

IntelliJ Releases IDEA 12, Brings Improved UI, New Compiler Mode, Android UI Designer, And More
I'm not going to pretend to be a developer here, and I'll openly admit that the bulk of what IDEA 12 does is over my head. However, I do understand ...

Resources last updated: 3/3/2016 11:31:57 AM