1 # Copyright 1998-2019 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 if [get_compiler_info] {
46 clean_restart ${binfile}
49 if ![runto_main] then {
50 perror "couldn't run to breakpoint"
54 gdb_test_no_output "set variable x=14" "set variable x=14"
55 gdb_test_no_output "set variable y=2" "set variable y=2"
56 gdb_test_no_output "set variable z=2" "set variable z=2"
57 gdb_test_no_output "set variable w=3" "set variable w=3"
59 gdb_test "print (0 && (x+y))" ".$decimal = $false" \
60 "print value of (0 && (x+y))"
62 gdb_test "print (0 && (x-y))" ".$decimal = $false" \
63 "print value of (0 && (x-y))"
65 gdb_test "print (0 && (x*y))" ".$decimal = $false" \
66 "print value of (0 && (x*y))"
68 gdb_test "print (0 && (x/y))" ".$decimal = $false" \
69 "print value of (0 && (x/y))"
71 gdb_test "print (0 && (x%y))" ".$decimal = $false" \
72 "print value of (0 && (x%y))"
74 gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
75 "print value of (0 && (x&&y))"
77 gdb_test "print (0 && (x||y))" ".$decimal = $false" \
78 "print value of (0 && (x||y))"
80 gdb_test "print (0 && (x&y))" ".$decimal = $false" \
81 "print value of (0 && (x&y))"
83 gdb_test "print (0 && (x|y))" ".$decimal = $false" \
84 "print value of (0 && (x|y))"
86 gdb_test "print (0 && (x^y))" ".$decimal = $false" \
87 "print value of (0 && (x^y))"
89 gdb_test "print (0 && (x < y))" ".$decimal = $false" \
90 "print value of (0 && (x < y))"
92 gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
93 "print value of (0 && (x <= y))"
95 gdb_test "print (0 && (x>y))" ".$decimal = $false" \
96 "print value of (0 && (x>y))"
98 gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
99 "print value of (0 && (x>=y))"
101 gdb_test "print (0 && (x==y))" ".$decimal = $false" \
102 "print value of (0 && (x==y))"
104 gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
105 "print value of (0 && (x!=y))"
107 gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
108 "print value of (0 && (x<<31))"
110 gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
111 "print value of (0 && (x>>31))"
113 gdb_test "print (0 && (!x))" ".$decimal = $false" \
114 "print value of (0 && (!x))"
116 gdb_test "print (0 && (~x))" ".$decimal = $false" \
117 "print value of (0 && (~x))"
119 gdb_test "print (0 && (-x))" ".$decimal = $false" \
120 "print value of (0 && (-x))"
122 gdb_test "print (0 && (x++))" ".$decimal = $false" \
123 "print value of (0 && (x++))"
125 gdb_test "print (0 && (++x))" ".$decimal = $false" \
126 "print value of (0 && (++x))"
128 gdb_test "print (0 && (x--))" ".$decimal = $false" \
129 "print value of (0 && (x--))"
131 gdb_test "print (0 && (--x))" ".$decimal = $false" \
132 "print value of (0 && (--x))"
134 gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
135 "print value of (0 && (x+=7))"
137 gdb_test "print (0 && (x=y))" ".$decimal = $false" \
138 "print value of (0 && (x=y))"