aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c b/SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c
new file mode 100644
index 00000000..24b7bdd7
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/20081218-1.c
@@ -0,0 +1,39 @@
+struct A { int i, j; char pad[512]; } a;
+
+int __attribute__((noinline))
+foo (void)
+{
+ __builtin_memset (&a, 0x26, sizeof a);
+ return a.i;
+}
+
+void __attribute__((noinline))
+bar (void)
+{
+ __builtin_memset (&a, 0x36, sizeof a);
+ a.i = 0x36363636;
+ a.j = 0x36373636;
+}
+
+int
+main (void)
+{
+ int i;
+ if (sizeof (int) != 4 || __CHAR_BIT__ != 8)
+ return 0;
+
+ if (foo () != 0x26262626)
+ __builtin_abort ();
+ for (i = 0; i < sizeof a; i++)
+ if (((char *)&a)[i] != 0x26)
+ __builtin_abort ();
+
+ bar ();
+ if (a.j != 0x36373636)
+ __builtin_abort ();
+ a.j = 0x36363636;
+ for (i = 0; i < sizeof a; i++)
+ if (((char *)&a)[i] != 0x36)
+ __builtin_abort ();
+ return 0;
+}