1 # Copyright 1998-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
18 # This file is part of the gdb testsuite
21 # tests to cover evaluate_subexp_standard with the EVAL_SKIP flag set.
22 # this happens for instance when there is short circuit evaluation in the && and ||
23 # operators, or in the non returned part of a (x ? y: z) expression.
24 # the part that is not evaluated is parsed and evaluated anyway, but with
25 # the EVAL_SKIP flag set
27 # source file "int-type.c"
31 # Check to see if we have an executable to test. If not, then either we
32 # haven't tried to compile one, or the compilation failed for some reason.
33 # In either case, just notify the user and skip the tests in this file.
35 standard_testfile int-type.c
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
38 untested "failed to compile"
42 clean_restart ${binfile}
49 # This is used as an expected result value.
52 gdb_test_no_output "set variable x=14" "set variable x=14"
53 gdb_test_no_output "set variable y=2" "set variable y=2"
54 gdb_test_no_output "set variable z=2" "set variable z=2"
55 gdb_test_no_output "set variable w=3" "set variable w=3"
57 gdb_test "print (0 && (x+y))" ".$decimal = $false" \
58 "print value of (0 && (x+y))"
60 gdb_test "print (0 && (x-y))" ".$decimal = $false" \
61 "print value of (0 && (x-y))"
63 gdb_test "print (0 && (x*y))" ".$decimal = $false" \
64 "print value of (0 && (x*y))"
66 gdb_test "print (0 && (x/y))" ".$decimal = $false" \
67 "print value of (0 && (x/y))"
69 gdb_test "print (0 && (x%y))" ".$decimal = $false" \
70 "print value of (0 && (x%y))"
72 gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
73 "print value of (0 && (x&&y))"
75 gdb_test "print (0 && (x||y))" ".$decimal = $false" \
76 "print value of (0 && (x||y))"
78 gdb_test "print (0 && (x&y))" ".$decimal = $false" \
79 "print value of (0 && (x&y))"
81 gdb_test "print (0 && (x|y))" ".$decimal = $false" \
82 "print value of (0 && (x|y))"
84 gdb_test "print (0 && (x^y))" ".$decimal = $false" \
85 "print value of (0 && (x^y))"
87 gdb_test "print (0 && (x < y))" ".$decimal = $false" \
88 "print value of (0 && (x < y))"
90 gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
91 "print value of (0 && (x <= y))"
93 gdb_test "print (0 && (x>y))" ".$decimal = $false" \
94 "print value of (0 && (x>y))"
96 gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
97 "print value of (0 && (x>=y))"
99 gdb_test "print (0 && (x==y))" ".$decimal = $false" \
100 "print value of (0 && (x==y))"
102 gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
103 "print value of (0 && (x!=y))"
105 gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
106 "print value of (0 && (x<<31))"
108 gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
109 "print value of (0 && (x>>31))"
111 gdb_test "print (0 && (!x))" ".$decimal = $false" \
112 "print value of (0 && (!x))"
114 gdb_test "print (0 && (~x))" ".$decimal = $false" \
115 "print value of (0 && (~x))"
117 gdb_test "print (0 && (-x))" ".$decimal = $false" \
118 "print value of (0 && (-x))"
120 gdb_test "print (0 && (x++))" ".$decimal = $false" \
121 "print value of (0 && (x++))"
123 gdb_test "print (0 && (++x))" ".$decimal = $false" \
124 "print value of (0 && (++x))"
126 gdb_test "print (0 && (x--))" ".$decimal = $false" \
127 "print value of (0 && (x--))"
129 gdb_test "print (0 && (--x))" ".$decimal = $false" \
130 "print value of (0 && (--x))"
132 gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
133 "print value of (0 && (x+=7))"
135 gdb_test "print (0 && (x=y))" ".$decimal = $false" \
136 "print value of (0 && (x=y))"