blob: f6d98e2d228f66063d8ef30de8df620ad0aa5bdd [file] [log] [blame]
David Malcolmba4ad402015-05-13 13:58:18 +00001Consider compiling test.c, with this content:
2VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
3#include "test.h"
4
5int
6main (int argc, char **argv)
7{
8 int a = PLUS (1,2);
9 int b = PLUS (3,4);
10 return 0;
11}
12^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14...where test.h has this content:
15VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
16extern int foo ();
17
18#define PLUS(A, B) A + B
19^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
21
22The undocumented -fdump-internal-locations option outputs this information
David Malcolm620e5942018-11-13 20:05:03 +000023to stderr, showing what each location_t value means. Source code
24lines are quoted, showing both per-line location_t values and
25per-line&column location_t values (written vertically under the
David Malcolmba4ad402015-05-13 13:58:18 +000026corresponding character of source code).
27
28VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
29RESERVED LOCATIONS
David Malcolm620e5942018-11-13 20:05:03 +000030 location_t interval: 0 <= loc < 2
David Malcolmba4ad402015-05-13 13:58:18 +000031
32ORDINARY MAP: 0
David Malcolm620e5942018-11-13 20:05:03 +000033 location_t interval: 32 <= loc < 64
David Malcolmba4ad402015-05-13 13:58:18 +000034 file: test.c
35 starting at line: 1
Mike Gulickbc65bad2018-11-27 16:04:31 +000036 column and range bits: 12
37 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +000038 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +000039 reason: 0 (LC_ENTER)
40 included from location: 0
David Malcolmebedc9a2015-11-13 16:29:59 +000041test.c: 1|loc: 32|#include "test.h"
42 |69269258258148147
43 |46802468024680246
David Malcolmba4ad402015-05-13 13:58:18 +000044
45ORDINARY MAP: 1
David Malcolm620e5942018-11-13 20:05:03 +000046 location_t interval: 64 <= loc < 96
David Malcolmba4ad402015-05-13 13:58:18 +000047 file: <built-in>
48 starting at line: 0
Mike Gulickbc65bad2018-11-27 16:04:31 +000049 column and range bits: 0
David Malcolmba4ad402015-05-13 13:58:18 +000050 column bits: 0
David Malcolmebedc9a2015-11-13 16:29:59 +000051 range bits: 0
Mike Gulickbc65bad2018-11-27 16:04:31 +000052 reason: 2 (LC_RENAME)
53 included from location: 0
David Malcolmba4ad402015-05-13 13:58:18 +000054
55ORDINARY MAP: 2
David Malcolm620e5942018-11-13 20:05:03 +000056 location_t interval: 96 <= loc < 128
David Malcolmba4ad402015-05-13 13:58:18 +000057 file: <command-line>
58 starting at line: 0
Mike Gulickbc65bad2018-11-27 16:04:31 +000059 column and range bits: 0
David Malcolmba4ad402015-05-13 13:58:18 +000060 column bits: 0
David Malcolmebedc9a2015-11-13 16:29:59 +000061 range bits: 0
Mike Gulickbc65bad2018-11-27 16:04:31 +000062 reason: 2 (LC_RENAME)
63 included from location: 0
David Malcolmba4ad402015-05-13 13:58:18 +000064
65ORDINARY MAP: 3
Mike Gulickbc65bad2018-11-27 16:04:31 +000066 location_t interval: 128 <= loc < 250240
David Malcolmba4ad402015-05-13 13:58:18 +000067 file: /usr/include/stdc-predef.h
68 starting at line: 1
Mike Gulickbc65bad2018-11-27 16:04:31 +000069 column and range bits: 12
70 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +000071 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +000072 reason: 0 (LC_ENTER)
73 included from location: 127 (in ordinary map 2)
David Malcolmba4ad402015-05-13 13:58:18 +000074(contents of /usr/include/stdc-predef.h snipped for brevity)
75
76ORDINARY MAP: 4
Mike Gulickbc65bad2018-11-27 16:04:31 +000077 location_t interval: 250240 <= loc < 250272
David Malcolmba4ad402015-05-13 13:58:18 +000078 file: <command-line>
David Malcolmebedc9a2015-11-13 16:29:59 +000079 starting at line: 32
Mike Gulickbc65bad2018-11-27 16:04:31 +000080 column and range bits: 12
81 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +000082 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +000083 reason: 1 (LC_LEAVE)
84 included from location: 0
David Malcolmba4ad402015-05-13 13:58:18 +000085
86ORDINARY MAP: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +000087 location_t interval: 250272 <= loc < 254368
David Malcolmba4ad402015-05-13 13:58:18 +000088 file: test.c
89 starting at line: 1
Mike Gulickbc65bad2018-11-27 16:04:31 +000090 column and range bits: 12
91 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +000092 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +000093 reason: 2 (LC_RENAME)
94 included from location: 0
95test.c: 1|loc:250272|#include "test.h"
96 |00000000000000000
97 |33344445556667778
98 |03603692692582581
99 |46802468024680246
David Malcolmba4ad402015-05-13 13:58:18 +0000100
101ORDINARY MAP: 6
Mike Gulickbc65bad2018-11-27 16:04:31 +0000102 location_t interval: 254368 <= loc < 266720
David Malcolmba4ad402015-05-13 13:58:18 +0000103 file: test.h
104 starting at line: 1
Mike Gulickbc65bad2018-11-27 16:04:31 +0000105 column and range bits: 12
106 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +0000107 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +0000108 reason: 0 (LC_ENTER)
109 included from location: 250272 (in ordinary map 5)
110test.h: 1|loc:254368|extern int foo ();
111 |444444444444444444
112 |444455566677788899
113 |036926925825814814
114 |024680246802468024
115test.h: 2|loc:258464|
116 |
117 |
118 |
119 |
120test.h: 3|loc:262560|#define PLUS(A, B) A + B
121 |222222222222233333333333
122 |566677788899900011122223
123 |925825814814704703603692
124 |246802468024680246802468
125test.h: 4|loc:266656|
126 |
127 |
128 |
129 |
David Malcolmba4ad402015-05-13 13:58:18 +0000130
131ORDINARY MAP: 7
Mike Gulickbc65bad2018-11-27 16:04:31 +0000132 location_t interval: 266720 <= loc < 299520
David Malcolmba4ad402015-05-13 13:58:18 +0000133 file: test.c
134 starting at line: 2
Mike Gulickbc65bad2018-11-27 16:04:31 +0000135 column and range bits: 12
136 column bits: 7
David Malcolmebedc9a2015-11-13 16:29:59 +0000137 range bits: 5
Mike Gulickbc65bad2018-11-27 16:04:31 +0000138 reason: 1 (LC_LEAVE)
139 included from location: 0
140test.c: 2|loc:266720|
141 |
142 |
143 |
144 |
145test.c: 3|loc:270816|int
146 |000
147 |889
148 |481
149 |802
150test.c: 4|loc:274912|main (int argc, char **argv)
151 |4455555555555555555555555555
152 |9900011122223334445556667778
153 |4704703603692692582581481470
154 |4680246802468024680246802468
155test.c: 5|loc:279008|{
156 |9
157 |0
158 |4
159 |0
160test.c: 6|loc:283104| int a = PLUS (1,2);
161 |333333333333333333333
162 |112222333444555666777
163 |360369269258258148147
164 |680246802468024680246
165test.c: 7|loc:287200| int b = PLUS (3,4);
166 |777777777777777777777
167 |222333444555666777888
168 |369269258258148147047
169 |246802468024680246802
170test.c: 8|loc:291296| return 0;
171 |11111111111
172 |33344455566
173 |26925825814
174 |80246802468
175test.c: 9|loc:295392|}
176 |5
177 |4
178 |2
179 |4
180test.c: 10|loc:299488|
181 |
182 |
183 |
184 |
David Malcolmba4ad402015-05-13 13:58:18 +0000185
186UNALLOCATED LOCATIONS
Mike Gulickbc65bad2018-11-27 16:04:31 +0000187 location_t interval: 299520 <= loc < 2147483632
David Malcolmba4ad402015-05-13 13:58:18 +0000188
Mike Gulickbc65bad2018-11-27 16:04:31 +0000189MACRO 3: PLUS (7 tokens)
190 location_t interval: 2147483632 <= loc < 2147483639
191test.c:7:11: note: expansion point is location 287555
192 7 | int b = PLUS (3,4);
193 | ^~~~
194 map->start_location: 2147483632
David Malcolmba4ad402015-05-13 13:58:18 +0000195 macro_locations:
Mike Gulickbc65bad2018-11-27 16:04:31 +0000196 0: 287744, 263200
197test.c:7:17: note: token 0 has x-location == 287744
198 7 | int b = PLUS (3,4);
199 | ^
200test.c:7:17: note: token 0 has y-location == 263200
201 1: 263264, 263264
202In file included from test.c:1:
203test.h:3:22: note: token 1 has x-location == y-location == 263264
204 3 | #define PLUS(A, B) A + B
205 | ^
206 2: 287808, 263328
207test.c:7:19: note: token 2 has x-location == 287808
208 7 | int b = PLUS (3,4);
209 | ^
210test.c:7:19: note: token 2 has y-location == 263328
211 3: 0, 0
212cc1: note: token 3 has x-location == y-location == 0
213 4: 0, 0
214cc1: note: token 4 has x-location == y-location == 0
215 5: 0, 0
216cc1: note: token 5 has x-location == y-location == 0
217 6: 0, 0
218cc1: note: token 6 has x-location == y-location == 0
David Malcolmebedc9a2015-11-13 16:29:59 +0000219
Mike Gulickbc65bad2018-11-27 16:04:31 +0000220MACRO 2: PLUS (7 tokens)
221 location_t interval: 2147483639 <= loc < 2147483646
222test.c:6:11: note: expansion point is location 283459
223 6 | int a = PLUS (1,2);
224 | ^~~~
225 map->start_location: 2147483639
David Malcolmba4ad402015-05-13 13:58:18 +0000226 macro_locations:
Mike Gulickbc65bad2018-11-27 16:04:31 +0000227 0: 283648, 263200
228test.c:6:17: note: token 0 has x-location == 283648
229 6 | int a = PLUS (1,2);
230 | ^
231test.c:6:17: note: token 0 has y-location == 263200
232 1: 263264, 263264
233In file included from test.c:1:
234test.h:3:22: note: token 1 has x-location == y-location == 263264
235 3 | #define PLUS(A, B) A + B
236 | ^
237 2: 283712, 263328
238test.c:6:19: note: token 2 has x-location == 283712
239 6 | int a = PLUS (1,2);
240 | ^
241test.c:6:19: note: token 2 has y-location == 263328
242 3: 0, 0
243cc1: note: token 3 has x-location == y-location == 0
244 4: 0, 0
245cc1: note: token 4 has x-location == y-location == 0
246 5: 0, 0
247cc1: note: token 5 has x-location == y-location == 0
248 6: 0, 0
249cc1: note: token 6 has x-location == y-location == 0
David Malcolmebedc9a2015-11-13 16:29:59 +0000250
Mike Gulickbc65bad2018-11-27 16:04:31 +0000251MACRO 1: __GCC_IEC_559_COMPLEX (1 tokens)
252 location_t interval: 2147483646 <= loc < 2147483647
253In file included from <command-line>:31:
254/usr/include/stdc-predef.h:45:6: note: expansion point is location 180564
255 45 | # if __GCC_IEC_559_COMPLEX > 0
256 | ^~~~~~~~~~~~~~~~~~~~~
257 map->start_location: 2147483646
258 macro_locations:
259 0: 1, 1
260<built-in>: note: token 0 has x-location == y-location == 1
David Malcolmebedc9a2015-11-13 16:29:59 +0000261
Mike Gulickbc65bad2018-11-27 16:04:31 +0000262MACRO 0: __GCC_IEC_559 (1 tokens)
263 location_t interval: 2147483647 <= loc < 2147483648
264/usr/include/stdc-predef.h:37:6: note: expansion point is location 147788
265 37 | # if __GCC_IEC_559 > 0
266 | ^~~~~~~~~~~~~
267 map->start_location: 2147483647
268 macro_locations:
269 0: 1, 1
270<built-in>: note: token 0 has x-location == y-location == 1
David Malcolmba4ad402015-05-13 13:58:18 +0000271
David Malcolm620e5942018-11-13 20:05:03 +0000272MAX_LOCATION_T
273 location_t interval: 2147483647 <= loc < 2147483648
David Malcolmba4ad402015-05-13 13:58:18 +0000274
275AD-HOC LOCATIONS
David Malcolm620e5942018-11-13 20:05:03 +0000276 location_t interval: 2147483648 <= loc < 4294967295
David Malcolmba4ad402015-05-13 13:58:18 +0000277^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^