11.6Srillig/* $NetBSD: d_packed_structs.c,v 1.6 2023/08/05 10:00:59 rillig Exp $ */ 21.2Srillig# 3 "d_packed_structs.c" 31.2Srillig 41.1Sjruoho/* packed tests */ 51.1Sjruoho 61.4Srillig/* lint1-extra-flags: -X 351 */ 71.4Srillig 81.1Sjruohostruct in_addr { 91.1Sjruoho int x; 101.1Sjruoho}; 111.3Srilligstruct ip_timestamp { 121.1Sjruoho char ipt_code; 131.1Sjruoho char ipt_len; 141.1Sjruoho char ipt_ptr; 151.3Srillig unsigned int 161.3Srillig ipt_flg: 4, 171.3Srillig ipt_oflw: 4; 181.1Sjruoho union ipt_timestamp { 191.3Srillig int ipt_time[1]; 201.3Srillig struct ipt_ta { 211.1Sjruoho struct in_addr ipt_addr; 221.1Sjruoho int ipt_time; 231.3Srillig } ipt_ta[1]__packed; 241.3Srillig } ipt_timestamp__packed; 251.1Sjruoho} __packed; 261.1Sjruoho 271.1Sjruohotypedef struct __packed { 281.1Sjruoho int x; 291.1Sjruoho} t; 301.1Sjruoho 311.1Sjruohostruct x { 321.1Sjruoho char c; 331.6Srillig long long l; 341.1Sjruoho} __packed; 351.1Sjruoho 361.1Sjruohostruct y { 371.1Sjruoho char c; 381.6Srillig long long l; 391.1Sjruoho}; 401.1Sjruoho 411.1Sjruohoint a[sizeof(struct y) - sizeof(struct x) - 1]; 421.5Srillig 431.5Srillig/* expect+1: error: negative array dimension (-9) [20] */ 441.5Srilligtypedef int sizeof_x[-(int)sizeof(struct x)]; 451.5Srillig/* expect+1: error: negative array dimension (-16) [20] */ 461.5Srilligtypedef int sizeof_y[-(int)sizeof(struct y)]; 47