OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/gcc-4.2.2/libmudflap/testsuite/libmudflap.cth
    from Rev 38 to Rev 154
    Reverse comparison

Rev 38 → Rev 154

/pass39-frag.c
0,0 → 1,57
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <sched.h>
#include <assert.h>
 
static void *
func (void *p)
{
int *counter = (int *) p;
unsigned i;
enum { numarrays = 100, numels = 17 };
char *arrays [numarrays];
 
for (i=0; i<numarrays; i++)
{
(*counter) ++;
unsigned x = i % numels;
arrays[i] = calloc (numels, sizeof(arrays[i][0]));
assert (arrays[i] != NULL);
arrays[i][x] = i;
free (arrays[i]);
sched_yield (); /* sleep (1); */
}
 
return (NULL);
}
 
 
int main ()
{
int rc;
unsigned i;
enum foo { NT=10 };
pthread_t threads[NT];
int counts[NT];
 
 
for (i=0; i<NT; i++)
{
counts[i] = 0;
rc = pthread_create (& threads[i], NULL, func, (void *) & counts[i]);
if (rc) abort();
}
 
for (i=0; i<NT; i++)
{
rc = pthread_join (threads[i], NULL);
if (rc) abort();
printf ("%d%s", counts[i], (i==NT-1) ? "\n" : " ");
}
 
return 0;
}
/* { dg-output "100 100 100 100 100 100 100 100 100 100" } */
/* { dg-repetitions 20 } */
/* { dg-timeout 10 } */
/pass40-frag.c
0,0 → 1,59
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
 
static void *
func (void *p)
{
return (NULL);
}
 
static void
test (void)
{
int rc;
pthread_attr_t my_pthread_attr;
pthread_t h;
long i;
 
rc = pthread_attr_init (&my_pthread_attr);
 
for (i = 1; i <= 10000; ++i) {
if (i%100 == 0) fprintf (stderr, "%i ", i);
if (i%1000 == 0) fprintf (stderr, "\n");
#ifndef STATIC
/* Some glibc versions don't like static multithreaded programs doing this. */
if (i==5000) __mf_set_options ("-thread-stack=192");
#endif
rc = pthread_create (&h, &my_pthread_attr,
func, NULL);
if (rc)
break;
 
rc = pthread_join (h, NULL);
if (rc)
break;
}
rc = pthread_attr_destroy (&my_pthread_attr);
}
int main ()
{
test ();
return (0);
}
 
/* { dg-timeout 20 } */
/* { dg-output "100 200 300 400 500 600 700 800 900 1000 \n" } */
/* { dg-output "1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 \n" } */
/* { dg-output "2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 \n" } */
/* { dg-output "3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 \n" } */
/* { dg-output "4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 \n" } */
/* { dg-output "5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 \n" } */
/* { dg-output "6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 \n" } */
/* { dg-output "7100 7200 7300 7400 7500 7600 7700 7800 7900 8000 \n" } */
/* { dg-output "8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 \n" } */
/* { dg-output "9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 \n" } */
 
/cthfrags.exp
0,0 → 1,25
global MUDFLAP_FLAGS
set MUDFLAP_FLAGS [list {} {-static -DSTATIC} {-O2} {-O3}]
 
libmudflap-init c
 
dg-init
 
global srcdir
foreach flags $MUDFLAP_FLAGS {
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.cth/*.c]] {
set bsrc [file tail $srcfile]
setenv MUDFLAP_OPTIONS "-viol-segv"
if {$libmudflapth} then {
# --noinhibit-exec works around a ld problem that causes
# "Dwarf Error: Invalid or unhandled FORM value: 14"
# to fail builds unnecessarily.
dg-runtest $srcfile $flags "-fmudflapth -lmudflapth -lpthread -Wl,--noinhibit-exec"
} else {
if {$flags != ""} {set f " ($flags)"} {set f ""}
untested "libmudflap.cth/$bsrc$f"
}
}
}
 
dg-finish
/pass37-frag.c
0,0 → 1,58
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <sched.h>
 
static void *
func (void *p)
{
int *counter = (int *) p;
unsigned i;
for (i=0; i<100; i++)
{
(*counter) ++;
{
int array[17];
unsigned x = i % (sizeof(array)/sizeof(array[0]));
/* VRP could prove that x is within [0,16], but until then, the
following access will ensure that array[] is registered to
libmudflap. */
array[x] = i;
}
sched_yield (); /* sleep (1); */
}
 
return (NULL);
}
 
 
int main ()
{
int rc;
unsigned i;
enum foo { NT=10 };
pthread_t threads[NT];
int counts[NT];
 
 
for (i=0; i<NT; i++)
{
counts[i] = 0;
rc = pthread_create (& threads[i], NULL, func, (void *) & counts[i]);
if (rc) abort();
}
 
for (i=0; i<NT; i++)
{
rc = pthread_join (threads[i], NULL);
if (rc) abort();
printf ("%d%s", counts[i], (i==NT-1) ? "\n" : " ");
}
 
return 0;
}
 
/* { dg-output "100 100 100 100 100 100 100 100 100 100" } */
/* { dg-repetitions 20 } */
/* { dg-timeout 10 } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.