aboutsummaryrefslogtreecommitdiff
path: root/libmudflap
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-15 23:52:53 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-15 23:52:53 +0200
commit8586aeeb9cf8ca7a2cd3dfd6cb589dbc070abd0f (patch)
tree442faf97b50015de3052a61cf9357c79ecc13982 /libmudflap
parent6a7a3f311b79f95e4a8bb19ffae268d4b5e6f565 (diff)
downloadgcc-8586aeeb9cf8ca7a2cd3dfd6cb589dbc070abd0f.zip
gcc-8586aeeb9cf8ca7a2cd3dfd6cb589dbc070abd0f.tar.gz
gcc-8586aeeb9cf8ca7a2cd3dfd6cb589dbc070abd0f.tar.bz2
re PR libmudflap/36397 (ICE with pointer cast and -fmudflap)
PR libmudflap/36397 * tree-mudflap.c (mf_xform_derefs_1): Handle VIEW_CONVERT_EXPR. * testsuite/libmudflap.c/pass64-frag.c: New test. From-SVN: r140374
Diffstat (limited to 'libmudflap')
-rw-r--r--libmudflap/ChangeLog5
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass64-frag.c38
2 files changed, 43 insertions, 0 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index e9eec10..6a87924 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR libmudflap/36397
+ * testsuite/libmudflap.c/pass64-frag.c: New test.
+
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.in: Regenerate.
diff --git a/libmudflap/testsuite/libmudflap.c/pass64-frag.c b/libmudflap/testsuite/libmudflap.c/pass64-frag.c
new file mode 100644
index 0000000..856eec0f
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass64-frag.c
@@ -0,0 +1,38 @@
+/* PR libmudflap/36397 */
+/* { dg-do run } */
+/* { dg-options "-O -fmudflap -fno-strict-aliasing -lmudflap" } */
+
+struct A
+{
+ int a[2];
+};
+
+long long int x;
+
+int __attribute__ ((noinline))
+baz (long long int *x)
+{
+ return *x;
+}
+
+int __attribute__ ((noinline))
+foo (int i)
+{
+ if (i > 10)
+ return baz (&x);
+ return ((struct A *) &x)->a[i];
+}
+
+int
+main (void)
+{
+ if (sizeof (long long) == 2 * sizeof (int)
+ && sizeof (long long) == sizeof (struct A))
+ {
+ struct A a = { .a[0] = 10, .a[1] = 20 };
+ __builtin_memcpy (&x, &a, sizeof (x));
+ if (foo (0) != 10 || foo (1) != 20)
+ __builtin_abort ();
+ }
+ return 0;
+}