19512fe85Sahl /* 29512fe85Sahl * CDDL HEADER START 39512fe85Sahl * 49512fe85Sahl * The contents of this file are subject to the terms of the 59512fe85Sahl * Common Development and Distribution License (the "License"). 69512fe85Sahl * You may not use this file except in compliance with the License. 79512fe85Sahl * 89512fe85Sahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99512fe85Sahl * or http://www.opensolaris.org/os/licensing. 109512fe85Sahl * See the License for the specific language governing permissions 119512fe85Sahl * and limitations under the License. 129512fe85Sahl * 139512fe85Sahl * When distributing Covered Code, include this CDDL HEADER in each 149512fe85Sahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159512fe85Sahl * If applicable, add the following below this CDDL HEADER, with the 169512fe85Sahl * fields enclosed by brackets "[]" replaced with your own identifying 179512fe85Sahl * information: Portions Copyright [yyyy] [name of copyright owner] 189512fe85Sahl * 199512fe85Sahl * CDDL HEADER END 209512fe85Sahl */ 219512fe85Sahl 229512fe85Sahl /* 239512fe85Sahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 249512fe85Sahl * Use is subject to license terms. 259512fe85Sahl */ 269512fe85Sahl 279512fe85Sahl /* 289512fe85Sahl * ASSERTION: 299512fe85Sahl * Verify the nested behavior of structs. 309512fe85Sahl * 319512fe85Sahl * SECTION: Structs and Unions/Structs 329512fe85Sahl * 339512fe85Sahl */ 349512fe85Sahl 359512fe85Sahl #pragma D option quiet 369512fe85Sahl 379512fe85Sahl struct InnerMost { 389512fe85Sahl int position; 399512fe85Sahl char content; 409512fe85Sahl }; 419512fe85Sahl 429512fe85Sahl struct InnerMore { 439512fe85Sahl struct InnerMost IMost; 449512fe85Sahl int dummy_More; 459512fe85Sahl }; 469512fe85Sahl 479512fe85Sahl struct Inner { 489512fe85Sahl struct InnerMore IMore; 499512fe85Sahl int dummy_More; 509512fe85Sahl }; 519512fe85Sahl 529512fe85Sahl struct Outer { 539512fe85Sahl struct Inner I; 549512fe85Sahl int dummy_More; 559512fe85Sahl }; 569512fe85Sahl 579512fe85Sahl struct OuterMore { 589512fe85Sahl struct Outer O; 599512fe85Sahl int dummy_More; 609512fe85Sahl }; 619512fe85Sahl 629512fe85Sahl struct OuterMost { 639512fe85Sahl struct OuterMore OMore; 649512fe85Sahl int dummy_More; 659512fe85Sahl } OMost; 669512fe85Sahl 67*23b5c241Stomee struct OuterMost OMostCopy; 68*23b5c241Stomee 699512fe85Sahl BEGIN 709512fe85Sahl { 719512fe85Sahl 729512fe85Sahl OMost.dummy_More = 0; 739512fe85Sahl OMost.OMore.dummy_More = 1; 749512fe85Sahl OMost.OMore.O.dummy_More = 2; 759512fe85Sahl OMost.OMore.O.I.dummy_More = 3; 769512fe85Sahl OMost.OMore.O.I.IMore.dummy_More = 4; 779512fe85Sahl OMost.OMore.O.I.IMore.IMost.position = 5; 789512fe85Sahl OMost.OMore.O.I.IMore.IMost.content = 'e'; 799512fe85Sahl 809512fe85Sahl printf("OMost.dummy_More: %d\nOMost.OMore.dummy_More: %d\n", 819512fe85Sahl OMost.dummy_More, OMost.OMore.dummy_More); 829512fe85Sahl 839512fe85Sahl printf("OMost.OMore.O.dummy_More: %d\n", 849512fe85Sahl OMost.OMore.O.dummy_More); 859512fe85Sahl 869512fe85Sahl printf("OMost.OMore.O.I.dummy_More: %d\n", 879512fe85Sahl OMost.OMore.O.I.dummy_More); 889512fe85Sahl 899512fe85Sahl printf("OMost.OMore.O.I.IMore.dummy_More:%d\n", 909512fe85Sahl OMost.OMore.O.I.IMore.dummy_More); 919512fe85Sahl 929512fe85Sahl printf("OMost.OMore.O.I.IMore.IMost.position: %d\n", 939512fe85Sahl OMost.OMore.O.I.IMore.IMost.position); 949512fe85Sahl 959512fe85Sahl printf("OMost.OMore.O.I.IMore.IMost.content: %c\n", 969512fe85Sahl OMost.OMore.O.I.IMore.IMost.content); 979512fe85Sahl 98*23b5c241Stomee OMostCopy = OMost; 999512fe85Sahl 1009512fe85Sahl exit(0); 1019512fe85Sahl } 1029512fe85Sahl 1039512fe85Sahl END 1049512fe85Sahl /(0 != OMost.dummy_More) || (1 != OMost.OMore.dummy_More) || 1059512fe85Sahl (2 != OMost.OMore.O.dummy_More) || (3 != OMost.OMore.O.I.dummy_More) || 1069512fe85Sahl (4 != OMost.OMore.O.I.IMore.dummy_More) || 1079512fe85Sahl (5 != OMost.OMore.O.I.IMore.IMost.position) || 1089512fe85Sahl ('e' != OMost.OMore.O.I.IMore.IMost.content)/ 1099512fe85Sahl { 1109512fe85Sahl exit(1); 1119512fe85Sahl } 1129512fe85Sahl 1139512fe85Sahl END 114*23b5c241Stomee /(0 != OMostCopy.dummy_More) || (1 != OMostCopy.OMore.dummy_More) || 115*23b5c241Stomee (2 != OMostCopy.OMore.O.dummy_More) || 116*23b5c241Stomee (3 != OMostCopy.OMore.O.I.dummy_More) || 117*23b5c241Stomee (4 != OMostCopy.OMore.O.I.IMore.dummy_More) || 118*23b5c241Stomee (5 != OMostCopy.OMore.O.I.IMore.IMost.position) || 119*23b5c241Stomee ('e' != OMostCopy.OMore.O.I.IMore.IMost.content)/ 1209512fe85Sahl { 1219512fe85Sahl exit(2); 1229512fe85Sahl } 123