9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * or http://www.opensolaris.org/os/licensing.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#pragma ident "%Z%%M% %I% %E% SMI"
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * ASSERTION:
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Verify the nested behavior of structs.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * SECTION: Structs and Unions/Structs
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#pragma D option quiet
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct InnerMost {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int position;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl char content;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct InnerMore {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct InnerMost IMost;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int dummy_More;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct Inner {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct InnerMore IMore;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int dummy_More;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct Outer {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct Inner I;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int dummy_More;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct OuterMore {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct Outer O;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int dummy_More;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstruct OuterMost {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct OuterMore OMore;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int dummy_More;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl} OMost;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeestruct OuterMost OMostCopy;
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
9512fe850e98fdd448c638ca63fdd92a8a510255ahlBEGIN
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.dummy_More = 0;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.dummy_More = 1;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.dummy_More = 2;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.dummy_More = 3;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.dummy_More = 4;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.IMost.position = 5;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.IMost.content = 'e';
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.dummy_More: %d\nOMost.OMore.dummy_More: %d\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.dummy_More, OMost.OMore.dummy_More);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.OMore.O.dummy_More: %d\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.dummy_More);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.OMore.O.I.dummy_More: %d\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.dummy_More);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.OMore.O.I.IMore.dummy_More:%d\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.dummy_More);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.OMore.O.I.IMore.IMost.position: %d\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.IMost.position);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("OMost.OMore.O.I.IMore.IMost.content: %c\n",
9512fe850e98fdd448c638ca63fdd92a8a510255ahl OMost.OMore.O.I.IMore.IMost.content);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee OMostCopy = OMost;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(0);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlEND
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/(0 != OMost.dummy_More) || (1 != OMost.OMore.dummy_More) ||
9512fe850e98fdd448c638ca63fdd92a8a510255ahl (2 != OMost.OMore.O.dummy_More) || (3 != OMost.OMore.O.I.dummy_More) ||
9512fe850e98fdd448c638ca63fdd92a8a510255ahl (4 != OMost.OMore.O.I.IMore.dummy_More) ||
9512fe850e98fdd448c638ca63fdd92a8a510255ahl (5 != OMost.OMore.O.I.IMore.IMost.position) ||
9512fe850e98fdd448c638ca63fdd92a8a510255ahl ('e' != OMost.OMore.O.I.IMore.IMost.content)/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(1);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlEND
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee/(0 != OMostCopy.dummy_More) || (1 != OMostCopy.OMore.dummy_More) ||
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee (2 != OMostCopy.OMore.O.dummy_More) ||
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee (3 != OMostCopy.OMore.O.I.dummy_More) ||
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee (4 != OMostCopy.OMore.O.I.IMore.dummy_More) ||
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee (5 != OMostCopy.OMore.O.I.IMore.IMost.position) ||
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee ('e' != OMostCopy.OMore.O.I.IMore.IMost.content)/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(2);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}