public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/2932: new operator segfaults for arrays using pthreads on hpux
@ 2001-06-26 17:15 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2001-06-26 17:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rob.renfrew

Synopsis: new operator segfaults for arrays using pthreads on hpux

State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Tue Jun 26 17:15:44 2001
State-Changed-Why:
    Deprecated library.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2932&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/2932: new operator segfaults for arrays using pthreads on hpux
@ 2001-06-13 10:04 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2001-06-13 10:04 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rob.renfrew

Synopsis: new operator segfaults for arrays using pthreads on hpux

State-Changed-From-To: suspended->feedback
State-Changed-By: bkoz
State-Changed-When: Wed Jun 13 10:04:12 2001
State-Changed-Why:
    This bug tracking system is for libstdc++-v3. Please trill try this again with the gcc-3 release, and see if you still have the same bug.
    
    thanks

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2932&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/2932: new operator segfaults for arrays using pthreads on hpux
@ 2001-05-24 16:56 rob.renfrew
  0 siblings, 0 replies; 3+ messages in thread
From: rob.renfrew @ 2001-05-24 16:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2932
>Category:       libstdc++
>Synopsis:       new operator segfaults for arrays using pthreads on hpux
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 24 16:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     rob.renfrew@epiphany.com
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
HP-UX 11
>Description:
spawning many threads which each allocate new arrays will cause a segmentation fault on HPUX11.  error does not occur using new to allocate non-arrays, or with malloc().
>How-To-Repeat:
build as:
gcc -o RTT RTT.cpp -lpthread
run ./RTT

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="RTT.cpp"
Content-Disposition: inline; filename="RTT.cpp"

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

#define NUM_THREADS	100
#define NUM_LOOPS 100
#define RT_SIZE 100

//typedef unsigned short Rtype;
typedef char Rtype;

void* memory_test(void *arg) {
	for (int i = 0; i < NUM_LOOPS; i++) {
		Rtype* rt = new Rtype[RT_SIZE];
		delete rt;
	}
}

int main(int argc, char **argv) {
	int status;
	pthread_t *threads;
	threads = new pthread_t[NUM_THREADS];
	for (int i = 0; i < NUM_THREADS; i++) {
		status = pthread_create(&(threads[i]), NULL, memory_test, NULL);
		if (status != 0) {
			fprintf(stderr, "failed: pthread_create: %d\n", i);
			exit(-1);
		}
	}
	void *trash;
	for (int i = 0; i < NUM_THREADS; i++) {
		status = pthread_join(threads[i], &trash);
		if (status != 0) {
			fprintf(stderr, "failed: pthread_join: %d\n", i);
			exit(-1);
		}
	}
	return 0;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-06-26 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-26 17:15 libstdc++/2932: new operator segfaults for arrays using pthreads on hpux bkoz
  -- strict thread matches above, loose matches on Subject: below --
2001-06-13 10:04 bkoz
2001-05-24 16:56 rob.renfrew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).