[pypy-commit] stmgc use-gcc: Add a bug example
arigo
noreply at buildbot.pypy.org
Thu Jul 2 13:24:27 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: use-gcc
Changeset: r1888:4cf19da2ec99
Date: 2015-07-02 13:25 +0200
http://bitbucket.org/pypy/stmgc/changeset/4cf19da2ec99/
Log: Add a bug example
diff --git a/gcc-seg-gs/bug1.c b/gcc-seg-gs/bug1.c
new file mode 100644
--- /dev/null
+++ b/gcc-seg-gs/bug1.c
@@ -0,0 +1,21 @@
+typedef struct {
+ int a[20];
+} foo_t;
+
+
+int sum1(__seg_gs foo_t *p)
+{
+ int i, total=0;
+ for (i=0; i<20; i++)
+ total += p->a[i];
+ return total;
+}
+
+int sum2(void)
+{
+ __seg_gs foo_t *p = (__seg_gs foo_t *)0x1234;
+ int i, total=0;
+ for (i=0; i<20; i++)
+ total += p->a[i]; // <= this memory read is missing %gs:
+ return total;
+}
More information about the pypy-commit
mailing list