aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-07-03 22:44:32 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-07-03 15:44:32 -0700
commit24b93bd603c942aa8c9af256a6387b9094404dda (patch)
tree0d0b07899e98b798e7d8f869091d3f216cb4e06e /gcc
parentd3ca3d6bd706bd629168a7e467ae1efdd923fed8 (diff)
downloadgcc-24b93bd603c942aa8c9af256a6387b9094404dda.zip
gcc-24b93bd603c942aa8c9af256a6387b9094404dda.tar.gz
gcc-24b93bd603c942aa8c9af256a6387b9094404dda.tar.bz2
Add a testcase for PR 44806.
2010-07-03 H.J. Lu <hongjiu.lu@intel.com> PR c/44806 * gcc.dg/torture/pr44806.c: New. From-SVN: r161787
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr44806.c90
2 files changed, 95 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d64f505..a815dd1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/44806
+ * gcc.dg/torture/pr44806.c: New.
+
2010-07-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/cond_expr1.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr44806.c b/gcc/testsuite/gcc.dg/torture/pr44806.c
new file mode 100644
index 0000000..d0002d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr44806.c
@@ -0,0 +1,90 @@
+/* { dg-do run } */
+
+#include <stdint.h>
+
+extern void abort (void);
+
+#define N_DEV_BITS_4 5
+#define N_INO_BITS_4 (32 - N_DEV_BITS_4 - 2 - 1)
+
+#define N_DEV_BITS_8 8
+#define N_INO_BITS_8 (64 - N_DEV_BITS_8 - 2 - 1)
+
+struct dev_ino_4
+{
+ uint32_t mode:2;
+ uint32_t short_ino:N_INO_BITS_4;
+ uint32_t mapped_dev:N_DEV_BITS_4;
+ uint32_t always_set:1;
+};
+
+struct dev_ino_8
+{
+ uint32_t mode:2;
+ uint64_t short_ino:N_INO_BITS_8;
+ uint32_t mapped_dev:N_DEV_BITS_8;
+ uint32_t always_set:1;
+};
+
+struct dev_ino_full
+{
+ uint32_t mode:2;
+ uint32_t dev;
+ uint32_t ino;
+};
+
+enum di_mode
+{
+ DI_MODE_4 = 1,
+ DI_MODE_8 = 2,
+ DI_MODE_FULL = 3
+};
+
+struct di_ent
+{
+ union
+ {
+ struct dev_ino_4 di4;
+ struct dev_ino_8 di8;
+ struct dev_ino_full full;
+ uint32_t u32;
+ uint64_t u64;
+ void *ptr;
+ } u;
+};
+
+static struct di_ent
+decode_ptr (struct di_ent const *v)
+{
+ struct di_ent di;
+ di.u.ptr = (void *) v;
+ return di;
+}
+
+static int
+di_ent_equal (void const *x, void const *y)
+{
+ struct di_ent a = decode_ptr (x);
+ struct di_ent b = decode_ptr (y);
+ if (a.u.di4.mode != b.u.di4.mode)
+ return 0;
+
+ if (a.u.di4.mode == DI_MODE_4)
+ return (a.u.di4.short_ino == b.u.di4.short_ino
+ && a.u.di4.mapped_dev == b.u.di4.mapped_dev);
+
+ if (a.u.di8.mode == DI_MODE_8)
+ return (a.u.di8.short_ino == b.u.di8.short_ino
+ && a.u.di8.mapped_dev == b.u.di8.mapped_dev);
+
+ return (a.u.full.ino == b.u.full.ino
+ && a.u.full.dev == b.u.full.dev);
+}
+
+int
+main ()
+{
+ if (di_ent_equal ((void *) 0x80143c4d, (void *) 0x80173851) != 0)
+ abort ();
+ return 0;
+}