tst.array.d revision 285830
145468Ssimokawa/* 233965Sjdp * CDDL HEADER START 333965Sjdp * 433965Sjdp * The contents of this file are subject to the terms of the 5130570Sobrien * Common Development and Distribution License (the "License"). 633965Sjdp * You may not use this file except in compliance with the License. 733965Sjdp * 8218822Sdim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9218822Sdim * or http://www.opensolaris.org/os/licensing. 1033965Sjdp * See the License for the specific language governing permissions 1133965Sjdp * and limitations under the License. 1233965Sjdp * 1333965Sjdp * When distributing Covered Code, include this CDDL HEADER in each 14130570Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15218822Sdim * If applicable, add the following below this CDDL HEADER, with the 16218822Sdim * fields enclosed by brackets "[]" replaced with your own identifying 17218822Sdim * information: Portions Copyright [yyyy] [name of copyright owner] 18218822Sdim * 19218822Sdim * CDDL HEADER END 20218822Sdim */ 21218822Sdim 22104846Sobrien/* 23104846Sobrien * Copyright (c) 2011 by Delphix. All rights reserved. 24104846Sobrien */ 2533965Sjdp 2689871Sobrien#pragma D option quiet 2789871Sobrien 28typedef struct bar { 29 int alpha; 30} bar_t; 31 32typedef struct foo { 33 int a[3]; 34 char b[30]; 35 bar_t c[2]; 36 char d[3]; 37} foo_t; 38 39BEGIN 40{ 41 this->f = (foo_t *)alloca(sizeof (foo_t)); 42 43 this->f->a[0] = 1; 44 this->f->a[1] = 2; 45 this->f->a[2] = 3; 46 this->f->b[0] = 'a'; 47 this->f->b[1] = 'b'; 48 this->f->b[2] = 0; 49 this->f->c[0].alpha = 5; 50 this->f->c[1].alpha = 6; 51 this->f->c[2].alpha = 7; 52 this->f->d[0] = 4; 53 this->f->d[1] = 0; 54 this->f->d[2] = 0; 55 56 print(this->f->a); 57 print(this->f->b); 58 print(this->f->c); 59 print(*this->f); 60 61 exit(0); 62} 63