xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d (revision e5803b76927480e8f9b67b22201c484ccf4c2bcf)
1*e5803b76SAdam H. Leventhal /*
2*e5803b76SAdam H. Leventhal  * CDDL HEADER START
3*e5803b76SAdam H. Leventhal  *
4*e5803b76SAdam H. Leventhal  * This file and its contents are supplied under the terms of the
5*e5803b76SAdam H. Leventhal  * Common Development and Distribution License ("CDDL"), version 1.0.
6*e5803b76SAdam H. Leventhal  * You may only use this file in accordance with the terms of version
7*e5803b76SAdam H. Leventhal  * 1.0 of the CDDL.
8*e5803b76SAdam H. Leventhal  *
9*e5803b76SAdam H. Leventhal  * A full copy of the text of the CDDL should have accompanied this
10*e5803b76SAdam H. Leventhal  * source.  A copy of the CDDL is also available via the Internet at
11*e5803b76SAdam H. Leventhal  * http://www.illumos.org/license/CDDL.
12*e5803b76SAdam H. Leventhal  *
13*e5803b76SAdam H. Leventhal  * CDDL HEADER END
14*e5803b76SAdam H. Leventhal  */
15*e5803b76SAdam H. Leventhal 
16*e5803b76SAdam H. Leventhal /*
17*e5803b76SAdam H. Leventhal  * Copyright (c) 2012 by Delphix. All rights reserved.
18*e5803b76SAdam H. Leventhal  */
19*e5803b76SAdam H. Leventhal 
20*e5803b76SAdam H. Leventhal /*
21*e5803b76SAdam H. Leventhal  * Test narrowing at assignment.
22*e5803b76SAdam H. Leventhal  */
23*e5803b76SAdam H. Leventhal 
24*e5803b76SAdam H. Leventhal #pragma D option quiet
25*e5803b76SAdam H. Leventhal 
26*e5803b76SAdam H. Leventhal uint16_t x;
27*e5803b76SAdam H. Leventhal uint32_t y;
28*e5803b76SAdam H. Leventhal 
29*e5803b76SAdam H. Leventhal BEGIN
30*e5803b76SAdam H. Leventhal {
31*e5803b76SAdam H. Leventhal 	x = 0xbeefcafe;
32*e5803b76SAdam H. Leventhal 	y = x;
33*e5803b76SAdam H. Leventhal 	printf("%x", y); /* where's the beef? */
34*e5803b76SAdam H. Leventhal 
35*e5803b76SAdam H. Leventhal 	exit(0);
36*e5803b76SAdam H. Leventhal }
37