• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2# Copyright (C) 2017 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77589
21#
22# program repro
23#   type small_stride
24#      character*40 long_string
25#      integer      small_pad
26#   end type small_stride
27#   type(small_stride), dimension (20), target :: unpleasant
28#   character*40, pointer, dimension(:):: c40pt
29#   integer i
30#   do i = 0,19
31#      unpleasant(i+1)%small_pad = i+1
32#      unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
33#   end do
34#   c40pt => unpleasant%long_string
35#   print *, c40pt  ! break-here
36# end program repro
37#
38# Needs GCC7+
39# gfortran -o testfile-stridex dwarf-stridex.f90 -Wall -g
40
41testfiles testfile-stridex
42
43testrun_compare ${abs_top_builddir}/tests/varlocs --exprlocs -e testfile-stridex <<\EOF
44module 'testfile-stridex'
45[b] CU 'dwarf-stridex.f90'@400717
46  producer (strp)
47  language (data1)
48  identifier_case (data1)
49  name (strp)
50  comp_dir (strp)
51  low_pc (addr)
52  high_pc (data8)
53  stmt_list (sec_offset)
54  [2e] base_type "integer(kind=8)"
55    byte_size (data1)
56    encoding (data1)
57    name (strp)
58  [35] structure_type "small_stride"
59    name (strp)
60    byte_size (data1)
61    decl_file (data1)
62    decl_line (data1)
63    sibling (ref4)
64    [41] member "long_string"
65      name (strp)
66      decl_file (data1)
67      decl_line (data1)
68      type (ref4)
69      data_member_location (data1) {plus_uconst(0)}
70    [4d] member "small_pad"
71      name (strp)
72      decl_file (data1)
73      decl_line (data1)
74      type (ref4)
75      data_member_location (data1) {plus_uconst(40)}
76  [5a] string_type
77    byte_size (data1)
78  [5c] base_type "integer(kind=4)"
79    byte_size (data1)
80    encoding (data1)
81    name (strp)
82  [63] const_type
83    type (ref4)
84  [68] subprogram "main"
85    external (flag_present)
86    name (strp)
87    decl_file (data1)
88    decl_line (data1)
89    type (ref4)
90    low_pc (addr)
91    high_pc (data8)
92    frame_base (exprloc) {call_frame_cfa {bregx(7,8)}}
93    GNU_all_tail_call_sites (flag_present)
94    sibling (ref4)
95    [89] formal_parameter "argc"
96      name (strp)
97      decl_file (data1)
98      decl_line (data1)
99      type (ref4)
100      location (exprloc) {fbreg(-20)}
101    [97] formal_parameter "argv"
102      name (strp)
103      decl_file (data1)
104      decl_line (data1)
105      type (ref4)
106      location (exprloc) {fbreg(-32), deref}
107  [a7] pointer_type
108    byte_size (data1)
109    type (ref4)
110  [ad] base_type "character(kind=1)"
111    byte_size (data1)
112    encoding (data1)
113    name (strp)
114  [b4] subprogram "repro"
115    name (strp)
116    decl_file (data1)
117    decl_line (data1)
118    main_subprogram (flag_present)
119    calling_convention (data1)
120    low_pc (addr)
121    high_pc (data8)
122    frame_base (exprloc) {call_frame_cfa {bregx(7,8)}}
123    GNU_all_tail_call_sites (flag_present)
124    sibling (ref4)
125    [d2] variable "c40pt"
126      name (strp)
127      decl_file (data1)
128      decl_line (data1)
129      type (ref4)
130      location (exprloc) {fbreg(-128)}
131    [e1] variable "span.0"
132      name (strp)
133      type (ref4)
134      artificial (flag_present)
135      location (exprloc) {fbreg(-80)}
136    [ee] variable "i"
137      name (string)
138      decl_file (data1)
139      decl_line (data1)
140      type (ref4)
141      location (exprloc) {fbreg(-68)}
142    [fb] variable "unpleasant"
143      name (strp)
144      decl_file (data1)
145      decl_line (data1)
146      type (ref4)
147      location (exprloc) {fbreg(-1008)}
148    [10a] lexical_block
149      low_pc (addr)
150      high_pc (data8)
151      sibling (ref4)
152      [11f] lexical_block
153        low_pc (addr)
154        high_pc (data8)
155    [131] lexical_block
156      low_pc (addr)
157      high_pc (data8)
158      [142] lexical_block
159        low_pc (addr)
160        high_pc (data8)
161        [153] lexical_block
162          low_pc (addr)
163          high_pc (data8)
164  [167] array_type
165    data_location (exprloc) {push_object_address, deref}
166    associated (exprloc) {push_object_address, deref, lit0, ne}
167    type (ref4)
168    sibling (ref4)
169    [178] subrange_type
170      lower_bound (exprloc) {push_object_address, plus_uconst(32), deref}
171      upper_bound (exprloc) {push_object_address, plus_uconst(40), deref}
172      byte_stride (exprloc) {push_object_address, plus_uconst(24), deref, GNU_variable_value([e1]) {fbreg(-80)}, mul}
173  [18f] array_type
174    type (ref4)
175    [194] subrange_type
176      type (ref4)
177      upper_bound (sdata)
178EOF
179
180exit 0
181