1226046Sdes/* 2224642Sbrooks * CDDL HEADER START 392559Sdes * 457429Smarkm * The contents of this file are subject to the terms of the 557429Smarkm * Common Development and Distribution License (the "License"). 657429Smarkm * You may not use this file except in compliance with the License. 757429Smarkm * 857429Smarkm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 960576Skris * or http://www.opensolaris.org/os/licensing. 1065674Skris * See the License for the specific language governing permissions 1165674Skris * and limitations under the License. 1265674Skris * 1365674Skris * When distributing Covered Code, include this CDDL HEADER in each 1465674Skris * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1557429Smarkm * If applicable, add the following below this CDDL HEADER, with the 1657429Smarkm * fields enclosed by brackets "[]" replaced with your own identifying 1757429Smarkm * information: Portions Copyright [yyyy] [name of copyright owner] 1857429Smarkm * 1957429Smarkm * CDDL HEADER END 2057429Smarkm */ 2157429Smarkm 2257429Smarkm/* 2357429Smarkm * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2457429Smarkm * Use is subject to license terms. 2557429Smarkm */ 2665674Skris#pragma ident "%Z%%M% %I% %E% SMI" 2776262Sgreen 28204917Sdes/* 29137019Sdes * ASSERTION: 30162856Sdes * Test invocation of offsetof() with a struct type alias. 31226046Sdes * 3257429Smarkm * SECTION: Structs and Unions/Member Sizes and Offsets 3376262Sgreen * 3476262Sgreen * NOTES: 3576262Sgreen * 3676262Sgreen */ 3776262Sgreen 3876262Sgreen#pragma D option quiet 3976262Sgreen 40226046Sdestypedef struct record { 41226046Sdes char c; 42226046Sdes int x; 43226046Sdes int y; 44226046Sdes} record_t; 45137019Sdes 46181111SdesBEGIN 4776262Sgreen{ 48181111Sdes printf("offsetof(record_t, c) = %d\n", offsetof(record_t, c)); 49181111Sdes printf("offsetof(record_t, x) = %d\n", offsetof(record_t, x)); 50181111Sdes printf("offsetof(record_t, y) = %d\n", offsetof(record_t, y)); 5157429Smarkm exit(0); 52192595Sdes} 53192595Sdes 54192595SdesEND 5557429Smarkm/(8 != offsetof(record_t, y)) || (4 != offsetof(record_t, x)) || 5657429Smarkm (0 != offsetof(record_t, c))/ 57147005Sdes{ 5876262Sgreen exit(1); 5976262Sgreen} 60204917Sdes