summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/20000603-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20000603-1.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
index 9c9f69baf04..4e31eee4563 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20000603-1.c
@@ -1,5 +1,10 @@
+/* It is not clear whether this test is conforming. See DR#236
+ http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_236.htm. However,
+ there seems to be consensus that the presence of a union to aggregate
+ struct s1 and struct s2 should make it conforming. */
struct s1 { double d; };
struct s2 { double d; };
+union u { struct s1 x; struct s2 y; };
double f(struct s1 *a, struct s2 *b)
{
@@ -9,9 +14,9 @@ double f(struct s1 *a, struct s2 *b)
int main()
{
- struct s1 a;
- a.d = 0.0;
- if (f (&a, (struct s2 *)&a) != 2.0)
+ union u a;
+ a.x.d = 0.0;
+ if (f (&a.x, &a.y) != 2.0)
abort ();
return 0;
}