[PATCH 5/57][Arm][GAS] Add support for MVE instructions: vmull{b,t}
[binutils-gdb.git] / gdb / testsuite / gdb.base / vla-sideeffect.exp
blob2251f3983e73ee13bdebf547191cb3b61075a51f
1 # Copyright 2014-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 # Tests side-effects of sizeof evaluation.
17 # Based on gcc/testsuite/gcc.dg/vla-4.c; vla-15.c
19 standard_testfile
21 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
22     return -1
25 if ![runto_main] {
26     return -1
29 gdb_breakpoint [gdb_get_line_number "vla-filled"]
30 gdb_continue_to_breakpoint "vla-filled"
32 # Check side effects for sizeof argument.
33 set sizeof_int [get_sizeof "int" 4]
34 set sizeof_vla [ expr "10" * "$sizeof_int" ]
36 gdb_test "print sizeof (vla1\[i++\])" " = ${sizeof_int}" \
37          "print sizeof (vla1\[i++\])"
38 gdb_test "print i" " = 0" \
39          "print i - sizeof no side effects"
41 gdb_test "print sizeof (++vla1\[0\])" " = ${sizeof_int}" \
42          "print sizeof (++vla1\[0\])"
43 gdb_test "print vla1\[0\]" " = 10" \
44          "print vla1\[0\] - sizeof no side effects"
46 gdb_test "ptype ++vla1\[0\]" "type = int" "ptype ++vla1\[0\]"
47 gdb_test "print vla1\[0\]" " = 10" \
48          "print vla1\[0\] - ptype no side effects"
50 gdb_test "whatis ++vla1\[0\]" "type = int" "whatis ++vla1\[0\]"
51 gdb_test "print vla1\[0\]" " = 10" \
52          "print vla1\[0\] - whatis no side effects"
55 gdb_test "print sizeof (vla2\[i++\])" " = ${sizeof_vla}" \
56          "print sizeof (vla2\[i++\])"
57 gdb_test "print i" " = 1" \
58          "print i - sizeof with side effects (1)"
60 gdb_test "print sizeof (vla2\[i++ + sizeof(j++)\])" " = ${sizeof_vla}" \
61          "print sizeof (vla2\[i++ + sizeof(j++)\])"
62 gdb_test "print i" " = 2" \
63          "print i - sizeof with side effects (2)"
64 gdb_test "print j" " = 0" \
65          "print j - sizeof with no side effects"
67 gdb_test "ptype vla2\[i++\]" "type = int \\\[10\\\]" \
68          "ptype vla2\[i++\]"
69 gdb_test "print i" " = 2" \
70          "print i - ptype with side effects (1)"
72 gdb_test "ptype vla2\[i++ + sizeof(j++)\]" "type = int \\\[10\\\]" \
73          "ptype vla2\[i++ + sizeof(j++)\]"
74 gdb_test "print i" " = 2" \
75          "print i - ptype with side effects (2)"
76 gdb_test "print j" " = 0" \
77          "print j - ptype with no side effects"
79 gdb_test "whatis vla2\[i++\]" "type = int \\\[10\\\]" \
80          "whatis vla2\[i++\]"
81 gdb_test "print i" " = 2" \
82          "print i - whatis with side effects (1)"
84 gdb_test "whatis vla2\[i++ + sizeof(j++)\]" "type = int \\\[10\\\]" \
85          "whatis vla2\[i++ + sizeof(j++)\]"
86 gdb_test "print i" " = 2" \
87          "print i - whatis with side effects (2)"
88 gdb_test "print j" " = 0" \
89          "print j - whatis with no side effects"