err.InvalidAddress4.d (249575) | err.InvalidAddress4.d (253726) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 10 unchanged lines hidden (view full) --- 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 10 unchanged lines hidden (view full) --- 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 |
27#pragma ident "%Z%%M% %I% %E% SMI" | 27/* 28 * Copyright (c) 2012 by Delphix. All rights reserved. 29 */ |
28 29/* 30 * ASSERTION: Demonstrating valid memory access. 31 * 32 * SECTION: Pointers and Arrays/Pointers and Addresses 33 * 34 * NOTES: 35 * 36 */ 37 38#pragma D option quiet 39 40BEGIN 41{ 42 x = (int *)alloca(sizeof (int)); | 30 31/* 32 * ASSERTION: Demonstrating valid memory access. 33 * 34 * SECTION: Pointers and Arrays/Pointers and Addresses 35 * 36 * NOTES: 37 * 38 */ 39 40#pragma D option quiet 41 42BEGIN 43{ 44 x = (int *)alloca(sizeof (int)); |
43 printf("Address x: %x\n", (int) x); 44 y = (int *) (x - 2); | 45 printf("Address x: %x\n", (int)x); 46 y = (int *)(x - 2); |
45 *y = 3; | 47 *y = 3; |
46 printf("Address y: %x\tValue: %d\n", (int) y, *y); | 48 printf("Address y: %x\tValue: %d\n", (int)y, *y); 49 exit(0); |
47} 48 49ERROR 50{ 51 exit(1); 52} | 50} 51 52ERROR 53{ 54 exit(1); 55} |