1132718Skan/*
2169689Skan * CDDL HEADER START
390075Sobrien *
450397Sobrien * The contents of this file are subject to the terms of the
550397Sobrien * Common Development and Distribution License (the "License").
6132718Skan * You may not use this file except in compliance with the License.
750397Sobrien *
8132718Skan * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
950397Sobrien * or http://www.opensolaris.org/os/licensing.
1050397Sobrien * See the License for the specific language governing permissions
1150397Sobrien * and limitations under the License.
1250397Sobrien *
13132718Skan * When distributing Covered Code, include this CDDL HEADER in each
1450397Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1550397Sobrien * If applicable, add the following below this CDDL HEADER, with the
1650397Sobrien * fields enclosed by brackets "[]" replaced with your own identifying
1750397Sobrien * information: Portions Copyright [yyyy] [name of copyright owner]
1850397Sobrien *
19132718Skan * CDDL HEADER END
20169689Skan */
21169689Skan
2250397Sobrien/*
2350397Sobrien * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2450397Sobrien * Use is subject to license terms.
2550397Sobrien */
2650397Sobrien
2750397Sobrien#pragma	ident	"%Z%%M%	%I%	%E% SMI"
2850397Sobrien
2950397Sobrien/*
3096263Sobrien * ASSERTION:
3150397Sobrien *	Verify relational operators with pointers
3250397Sobrien *
3350397Sobrien * SECTION: Types, Operators, and Expressions/Relational Operators;
3450397Sobrien *	Types, Operators, and Expressions/Logical Operators;
35169689Skan *	Types, Operators, and Expressions/Precedence
36169689Skan *
3750397Sobrien */
3850397Sobrien
3950397Sobrien#pragma D option quiet
4050397Sobrien
4150397Sobrien
4250397SobrienBEGIN
4350397Sobrien{
4450397Sobrien	ptr_1 = &`kmem_flags;
4550397Sobrien	ptr_2 = (&`kmem_flags) + 1;
4650397Sobrien	ptr_3 = (&`kmem_flags) - 1 ;
47132718Skan}
4850397Sobrien
4950397Sobrientick-1
5050397Sobrien/ptr_1 >= ptr_2 || ptr_2 <= ptr_1 || ptr_1 == ptr_2/
5150397Sobrien{
5250397Sobrien	printf("Shouldn't end up here (1)\n");
5350397Sobrien	printf("ptr_1 = %x ptr_2 = %x ptr_3 = %x\n",
5450397Sobrien		(int) ptr_1, (int) ptr_2, (int) ptr_3);
5550397Sobrien	exit(1);
5650397Sobrien}
5750397Sobrien
5850397Sobrientick-1
5950397Sobrien/ptr_3 > ptr_1 || ptr_1 < ptr_3 || ptr_3 == ptr_1/
6050397Sobrien{
6150397Sobrien	printf("Shouldn't end up here (2)\n");
6250397Sobrien	printf("ptr_1 = %x ptr_2 = %x ptr_3 = %x\n",
6350397Sobrien		(int) ptr_1, (int) ptr_2, (int) ptr_3);
6450397Sobrien	exit(1);
6550397Sobrien}
6650397Sobrien
6750397Sobrientick-1
6896263Sobrien/ptr_3 > ptr_2 || ptr_1 < ptr_2 ^^ ptr_3 == ptr_2 && !(ptr_1 != ptr_2)/
6996263Sobrien{
7096263Sobrien	exit(0);
7150397Sobrien}
7250397Sobrien