URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/tags/gnu-src/gcc-4.5.1/gcc-4.5.1-or32-1.0rc2/libmudflap/testsuite/libmudflap.cth
- from Rev 275 to Rev 384
- ↔ Reverse comparison
Rev 275 → Rev 384
/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 } */ |
pass39-frag.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pass59-frag.c
===================================================================
--- pass59-frag.c (nonexistent)
+++ pass59-frag.c (revision 384)
@@ -0,0 +1,39 @@
+#include
+#include
+
+/* PR 28578 */
+
+void* test_thread(void* arg)
+{
+ printf("Hello from thread!\n");
+ pthread_exit(NULL);
+ return 0;
+}
+
+int main()
+{
+ pthread_t thread;
+ void *arg = NULL;
+ pthread_create(&thread, NULL, test_thread, arg);
+ pthread_join(thread, NULL);
+ pthread_exit(NULL);
+ return 0;
+}
+
+/* { dg-output "Hello from thread!\n" } */
+
+#if 0
+
+/* Even this test case replicates the problem. However, when built in
+ static mode, it blows up during __mf_init (?!?!?!) with a
+ pthread_mutex_lock deadlock error. */
+
+#include
+#include
+
+int main ()
+{
+ pthread_exit(NULL);
+ return 0;
+}
+#endif
pass59-frag.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pass40-frag.c
===================================================================
--- pass40-frag.c (nonexistent)
+++ pass40-frag.c (revision 384)
@@ -0,0 +1,59 @@
+#include
+#include
+#include
+
+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" } */
+
pass40-frag.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cthfrags.exp
===================================================================
--- cthfrags.exp (nonexistent)
+++ cthfrags.exp (revision 384)
@@ -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
Index: pass37-frag.c
===================================================================
--- pass37-frag.c (nonexistent)
+++ pass37-frag.c (revision 384)
@@ -0,0 +1,58 @@
+#include
+#include
+#include
+#include
+
+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
pass37-frag.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property