12633Sahl /*
22633Sahl  * CDDL HEADER START
32633Sahl  *
42633Sahl  * The contents of this file are subject to the terms of the
52633Sahl  * Common Development and Distribution License (the "License").
62633Sahl  * You may not use this file except in compliance with the License.
72633Sahl  *
82633Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl  * or http://www.opensolaris.org/os/licensing.
102633Sahl  * See the License for the specific language governing permissions
112633Sahl  * and limitations under the License.
122633Sahl  *
132633Sahl  * When distributing Covered Code, include this CDDL HEADER in each
142633Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl  * If applicable, add the following below this CDDL HEADER, with the
162633Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl  *
192633Sahl  * CDDL HEADER END
202633Sahl  */
212633Sahl 
222633Sahl /*
232633Sahl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
242633Sahl  * Use is subject to license terms.
252633Sahl  */
262633Sahl 
272633Sahl #pragma ident	"%Z%%M%	%I%	%E% SMI"
282633Sahl 
292633Sahl /*
302633Sahl  * ASSERTION:
312633Sahl  * Verify the nested behavior of structs.
322633Sahl  *
332633Sahl  * SECTION: Structs and Unions/Structs
342633Sahl  *
352633Sahl  */
362633Sahl 
372633Sahl #pragma D option quiet
382633Sahl 
392633Sahl struct InnerMost {
402633Sahl 	int position;
412633Sahl 	char content;
422633Sahl };
432633Sahl 
442633Sahl struct InnerMore {
452633Sahl 	struct InnerMost IMost;
462633Sahl 	int dummy_More;
472633Sahl };
482633Sahl 
492633Sahl struct Inner {
502633Sahl 	struct InnerMore IMore;
512633Sahl 	int dummy_More;
522633Sahl };
532633Sahl 
542633Sahl struct Outer {
552633Sahl 	struct Inner I;
562633Sahl 	int dummy_More;
572633Sahl };
582633Sahl 
592633Sahl struct OuterMore {
602633Sahl 	struct Outer O;
612633Sahl 	int dummy_More;
622633Sahl };
632633Sahl 
642633Sahl struct OuterMost {
652633Sahl 	struct OuterMore OMore;
662633Sahl 	int dummy_More;
672633Sahl } OMost;
682633Sahl 
69*2804Stomee struct OuterMost OMostCopy;
70*2804Stomee 
712633Sahl BEGIN
722633Sahl {
732633Sahl 
742633Sahl 	OMost.dummy_More = 0;
752633Sahl 	OMost.OMore.dummy_More = 1;
762633Sahl 	OMost.OMore.O.dummy_More = 2;
772633Sahl 	OMost.OMore.O.I.dummy_More = 3;
782633Sahl 	OMost.OMore.O.I.IMore.dummy_More = 4;
792633Sahl 	OMost.OMore.O.I.IMore.IMost.position = 5;
802633Sahl 	OMost.OMore.O.I.IMore.IMost.content = 'e';
812633Sahl 
822633Sahl 	printf("OMost.dummy_More: %d\nOMost.OMore.dummy_More: %d\n",
832633Sahl 	OMost.dummy_More, OMost.OMore.dummy_More);
842633Sahl 
852633Sahl 	printf("OMost.OMore.O.dummy_More: %d\n",
862633Sahl 	OMost.OMore.O.dummy_More);
872633Sahl 
882633Sahl 	printf("OMost.OMore.O.I.dummy_More: %d\n",
892633Sahl 	OMost.OMore.O.I.dummy_More);
902633Sahl 
912633Sahl 	printf("OMost.OMore.O.I.IMore.dummy_More:%d\n",
922633Sahl 	OMost.OMore.O.I.IMore.dummy_More);
932633Sahl 
942633Sahl 	printf("OMost.OMore.O.I.IMore.IMost.position: %d\n",
952633Sahl 	OMost.OMore.O.I.IMore.IMost.position);
962633Sahl 
972633Sahl 	printf("OMost.OMore.O.I.IMore.IMost.content: %c\n",
982633Sahl 	OMost.OMore.O.I.IMore.IMost.content);
992633Sahl 
100*2804Stomee 	OMostCopy = OMost;
1012633Sahl 
1022633Sahl 	exit(0);
1032633Sahl }
1042633Sahl 
1052633Sahl END
1062633Sahl /(0 != OMost.dummy_More) || (1 != OMost.OMore.dummy_More) ||
1072633Sahl     (2 != OMost.OMore.O.dummy_More) || (3 != OMost.OMore.O.I.dummy_More) ||
1082633Sahl     (4 != OMost.OMore.O.I.IMore.dummy_More) ||
1092633Sahl     (5 != OMost.OMore.O.I.IMore.IMost.position) ||
1102633Sahl     ('e' != OMost.OMore.O.I.IMore.IMost.content)/
1112633Sahl {
1122633Sahl 	exit(1);
1132633Sahl }
1142633Sahl 
1152633Sahl END
116*2804Stomee /(0 != OMostCopy.dummy_More) || (1 != OMostCopy.OMore.dummy_More) ||
117*2804Stomee     (2 != OMostCopy.OMore.O.dummy_More) ||
118*2804Stomee     (3 != OMostCopy.OMore.O.I.dummy_More) ||
119*2804Stomee     (4 != OMostCopy.OMore.O.I.IMore.dummy_More) ||
120*2804Stomee     (5 != OMostCopy.OMore.O.I.IMore.IMost.position) ||
121*2804Stomee     ('e' != OMostCopy.OMore.O.I.IMore.IMost.content)/
1222633Sahl {
1232633Sahl 	exit(2);
1242633Sahl }
125