473,785 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ti d,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
Nov 14 '05 #1
6 2667
Matthew <ma**@holly.com .au> spoke thus:
I am using sun's CC (c++ compiler) to compile the follow code:
#include <pthread.h>
This is purify's output: Is it the compiler/linker bug or it purify making things up?


(All this suggests that you'd be better served in a more topical
newsgroup.)

Your post is off-topic for comp.lang.c. Please visit

http://www.csclub.uwaterloo.ca/u/dj3...lc-welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
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(ti d,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

man pthread_attr_se tstackaddr

/J
Nov 14 '05 #3
Johan Lindh wrote:
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(ti d,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


man pthread_attr_se tstackaddr

/J


Uh, I meant

man pthread_attr_se tstacksize

...(of course :P)

Nov 14 '05 #4
Johan Lindh wrote:

Johan Lindh wrote:

man pthread_attr_se tstackaddr

/J


Uh, I meant

man pthread_attr_se tstacksize


Do you know any newsgroups where threads are on topic ?

--
pete
Nov 14 '05 #5
pete wrote:
Johan Lindh wrote:
Johan Lindh wrote:


man pthread_attr_se tstackaddr

/J


Uh, I meant

man pthread_attr_se tstacksize

Do you know any newsgroups where threads are on topic ?


Sure!
alt.sex.spam

Nov 14 '05 #6
Johan Lindh wrote:

pete wrote:
Johan Lindh wrote:
Johan Lindh wrote:


man pthread_attr_se tstackaddr

/J

Uh, I meant

man pthread_attr_se tstacksize

Do you know any newsgroups where threads are on topic ?


Sure!
alt.sex.spam


Then take your discussion to there.

--
pete
Nov 14 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3810
by: Tomer Ben-David | last post by:
Hi I downloaded purify. Im running a simple hello world through purify on windows2000 machine. However whenever the purify runs it i get in the console window: Error occurred during initialization of VM Unable to load native library: Access is denied
7
605
by: Matthew | last post by:
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);
3
2233
by: grahamo | last post by:
Hey, maybe a little off topic but I'm running round in circles here... I am aware of a couple of other memory tracking products out there but I would like to know of ALL of them. So far I have; 1) BoundsChecker 2) Insure++
4
2031
by: hcc | last post by:
Hi, Does anyone have experience with using Purify with db2 CLI application? We're using Purify to diagnose some problem in our multi-thread CLI application, and we're getting lots of the "UMR: Uninitialized memory read" error reported by Purify. I wrote a very short test CLI program that simply calls SQLAllocHandle, SQLConnect, SQLDisconnect and SQLDisconnect; and Purify still reports the same error. The following is one of them:
6
2555
by: sangeetha_b | last post by:
Hello, I've writen one simple program to automate some manual process. I've written that in c program. It works fine so far no problem reported on this. Last week, i get chance to run my program on purify tool. I'm very new to purify tool use. Q1. Purify reports Uninitialized memory read in the following line A and Line B
10
14059
by: eyh5 | last post by:
Hi, My C code (running on Soalris Unix) has some "segmentation fault" that I wish to use purify to do it. I poked around the web, and found some information about adding some lines in a Makefile file to use purify. However, my code is a rather simple single-source C program, and I didn't write a Makefile for it. I'm wondering if anybody can tell me which commands are to be entered at the Unix prompt to use purify. And, I don't know if...
2
3251
by: saby | last post by:
Can anybody knowing Rational Purify help me? I am instrumenting an exe on solaris using Rational Purify. While building the exe, known as "DPSRun", it does not give any problem. But while I use Rational Purify, it gives a link error as given below. Linking Undefined first referenced
1
1659
by: Teddy | last post by:
Hey guyes I am getting problem with purify. I am using g++ compiler on Solaris 5.10 and linking it with purify. Whenever I compiled program with purify option I get CORE DUMP error with message that terminate() was called recursively by getprotobyname() function. Without purify program compiles without error. Please help me to solve problem.
2
2279
by: Achint Mehta | last post by:
Hi, I am running purify on my program (on linux with gcc ver. 3.4.6) I have installed a signal handler (for timer) using sigaction. I am passing a pointer (data) into the sival_ptr which I intend to access later in the signal handler. timer_event.sigev_notify = SIGEV_SIGNAL; timer_event.sigev_signo = SIGRTMIN; timer_event.sigev_value.sival_ptr = data;
4
2999
by: sudheer786 | last post by:
A purify error while doing build is setup -------------------------------------------------------------------------------- Hi all, I was facing a strange error while trying to run my labeled build once after the make depend and make all was sucessful in solaris. When I tried to attach dbx and run the build on solaris 5.4 release , it shows a wrong a menory address which is cascaded. Neither of the memory is freed. dbx: cannot...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.