location-example.txt 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. Consider compiling test.c, with this content:
  2. VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  3. #include "test.h"
  4. int
  5. main (int argc, char **argv)
  6. {
  7. int a = PLUS (1,2);
  8. int b = PLUS (3,4);
  9. return 0;
  10. }
  11. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  12. ...where test.h has this content:
  13. VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  14. extern int foo ();
  15. #define PLUS(A, B) A + B
  16. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  17. The undocumented -fdump-internal-locations option outputs this information
  18. to stderr, showing what each location_t value means. Source code
  19. lines are quoted, showing both per-line location_t values and
  20. per-line&column location_t values (written vertically under the
  21. corresponding character of source code).
  22. VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  23. RESERVED LOCATIONS
  24. location_t interval: 0 <= loc < 2
  25. ORDINARY MAP: 0
  26. location_t interval: 32 <= loc < 64
  27. file: test.c
  28. starting at line: 1
  29. column and range bits: 12
  30. column bits: 7
  31. range bits: 5
  32. reason: 0 (LC_ENTER)
  33. included from location: 0
  34. test.c: 1|loc: 32|#include "test.h"
  35. |69269258258148147
  36. |46802468024680246
  37. ORDINARY MAP: 1
  38. location_t interval: 64 <= loc < 96
  39. file: <built-in>
  40. starting at line: 0
  41. column and range bits: 0
  42. column bits: 0
  43. range bits: 0
  44. reason: 2 (LC_RENAME)
  45. included from location: 0
  46. ORDINARY MAP: 2
  47. location_t interval: 96 <= loc < 128
  48. file: <command-line>
  49. starting at line: 0
  50. column and range bits: 0
  51. column bits: 0
  52. range bits: 0
  53. reason: 2 (LC_RENAME)
  54. included from location: 0
  55. ORDINARY MAP: 3
  56. location_t interval: 128 <= loc < 250240
  57. file: /usr/include/stdc-predef.h
  58. starting at line: 1
  59. column and range bits: 12
  60. column bits: 7
  61. range bits: 5
  62. reason: 0 (LC_ENTER)
  63. included from location: 127 (in ordinary map 2)
  64. (contents of /usr/include/stdc-predef.h snipped for brevity)
  65. ORDINARY MAP: 4
  66. location_t interval: 250240 <= loc < 250272
  67. file: <command-line>
  68. starting at line: 32
  69. column and range bits: 12
  70. column bits: 7
  71. range bits: 5
  72. reason: 1 (LC_LEAVE)
  73. included from location: 0
  74. ORDINARY MAP: 5
  75. location_t interval: 250272 <= loc < 254368
  76. file: test.c
  77. starting at line: 1
  78. column and range bits: 12
  79. column bits: 7
  80. range bits: 5
  81. reason: 2 (LC_RENAME)
  82. included from location: 0
  83. test.c: 1|loc:250272|#include "test.h"
  84. |00000000000000000
  85. |33344445556667778
  86. |03603692692582581
  87. |46802468024680246
  88. ORDINARY MAP: 6
  89. location_t interval: 254368 <= loc < 266720
  90. file: test.h
  91. starting at line: 1
  92. column and range bits: 12
  93. column bits: 7
  94. range bits: 5
  95. reason: 0 (LC_ENTER)
  96. included from location: 250272 (in ordinary map 5)
  97. test.h: 1|loc:254368|extern int foo ();
  98. |444444444444444444
  99. |444455566677788899
  100. |036926925825814814
  101. |024680246802468024
  102. test.h: 2|loc:258464|
  103. |
  104. |
  105. |
  106. |
  107. test.h: 3|loc:262560|#define PLUS(A, B) A + B
  108. |222222222222233333333333
  109. |566677788899900011122223
  110. |925825814814704703603692
  111. |246802468024680246802468
  112. test.h: 4|loc:266656|
  113. |
  114. |
  115. |
  116. |
  117. ORDINARY MAP: 7
  118. location_t interval: 266720 <= loc < 299520
  119. file: test.c
  120. starting at line: 2
  121. column and range bits: 12
  122. column bits: 7
  123. range bits: 5
  124. reason: 1 (LC_LEAVE)
  125. included from location: 0
  126. test.c: 2|loc:266720|
  127. |
  128. |
  129. |
  130. |
  131. test.c: 3|loc:270816|int
  132. |000
  133. |889
  134. |481
  135. |802
  136. test.c: 4|loc:274912|main (int argc, char **argv)
  137. |4455555555555555555555555555
  138. |9900011122223334445556667778
  139. |4704703603692692582581481470
  140. |4680246802468024680246802468
  141. test.c: 5|loc:279008|{
  142. |9
  143. |0
  144. |4
  145. |0
  146. test.c: 6|loc:283104| int a = PLUS (1,2);
  147. |333333333333333333333
  148. |112222333444555666777
  149. |360369269258258148147
  150. |680246802468024680246
  151. test.c: 7|loc:287200| int b = PLUS (3,4);
  152. |777777777777777777777
  153. |222333444555666777888
  154. |369269258258148147047
  155. |246802468024680246802
  156. test.c: 8|loc:291296| return 0;
  157. |11111111111
  158. |33344455566
  159. |26925825814
  160. |80246802468
  161. test.c: 9|loc:295392|}
  162. |5
  163. |4
  164. |2
  165. |4
  166. test.c: 10|loc:299488|
  167. |
  168. |
  169. |
  170. |
  171. UNALLOCATED LOCATIONS
  172. location_t interval: 299520 <= loc < 2147483632
  173. MACRO 3: PLUS (7 tokens)
  174. location_t interval: 2147483632 <= loc < 2147483639
  175. test.c:7:11: note: expansion point is location 287555
  176. 7 | int b = PLUS (3,4);
  177. | ^~~~
  178. map->start_location: 2147483632
  179. macro_locations:
  180. 0: 287744, 263200
  181. test.c:7:17: note: token 0 has x-location == 287744
  182. 7 | int b = PLUS (3,4);
  183. | ^
  184. test.c:7:17: note: token 0 has y-location == 263200
  185. 1: 263264, 263264
  186. In file included from test.c:1:
  187. test.h:3:22: note: token 1 has x-location == y-location == 263264
  188. 3 | #define PLUS(A, B) A + B
  189. | ^
  190. 2: 287808, 263328
  191. test.c:7:19: note: token 2 has x-location == 287808
  192. 7 | int b = PLUS (3,4);
  193. | ^
  194. test.c:7:19: note: token 2 has y-location == 263328
  195. 3: 0, 0
  196. cc1: note: token 3 has x-location == y-location == 0
  197. 4: 0, 0
  198. cc1: note: token 4 has x-location == y-location == 0
  199. 5: 0, 0
  200. cc1: note: token 5 has x-location == y-location == 0
  201. 6: 0, 0
  202. cc1: note: token 6 has x-location == y-location == 0
  203. MACRO 2: PLUS (7 tokens)
  204. location_t interval: 2147483639 <= loc < 2147483646
  205. test.c:6:11: note: expansion point is location 283459
  206. 6 | int a = PLUS (1,2);
  207. | ^~~~
  208. map->start_location: 2147483639
  209. macro_locations:
  210. 0: 283648, 263200
  211. test.c:6:17: note: token 0 has x-location == 283648
  212. 6 | int a = PLUS (1,2);
  213. | ^
  214. test.c:6:17: note: token 0 has y-location == 263200
  215. 1: 263264, 263264
  216. In file included from test.c:1:
  217. test.h:3:22: note: token 1 has x-location == y-location == 263264
  218. 3 | #define PLUS(A, B) A + B
  219. | ^
  220. 2: 283712, 263328
  221. test.c:6:19: note: token 2 has x-location == 283712
  222. 6 | int a = PLUS (1,2);
  223. | ^
  224. test.c:6:19: note: token 2 has y-location == 263328
  225. 3: 0, 0
  226. cc1: note: token 3 has x-location == y-location == 0
  227. 4: 0, 0
  228. cc1: note: token 4 has x-location == y-location == 0
  229. 5: 0, 0
  230. cc1: note: token 5 has x-location == y-location == 0
  231. 6: 0, 0
  232. cc1: note: token 6 has x-location == y-location == 0
  233. MACRO 1: __GCC_IEC_559_COMPLEX (1 tokens)
  234. location_t interval: 2147483646 <= loc < 2147483647
  235. In file included from <command-line>:31:
  236. /usr/include/stdc-predef.h:45:6: note: expansion point is location 180564
  237. 45 | # if __GCC_IEC_559_COMPLEX > 0
  238. | ^~~~~~~~~~~~~~~~~~~~~
  239. map->start_location: 2147483646
  240. macro_locations:
  241. 0: 1, 1
  242. <built-in>: note: token 0 has x-location == y-location == 1
  243. MACRO 0: __GCC_IEC_559 (1 tokens)
  244. location_t interval: 2147483647 <= loc < 2147483648
  245. /usr/include/stdc-predef.h:37:6: note: expansion point is location 147788
  246. 37 | # if __GCC_IEC_559 > 0
  247. | ^~~~~~~~~~~~~
  248. map->start_location: 2147483647
  249. macro_locations:
  250. 0: 1, 1
  251. <built-in>: note: token 0 has x-location == y-location == 1
  252. MAX_LOCATION_T
  253. location_t interval: 2147483647 <= loc < 2147483648
  254. AD-HOC LOCATIONS
  255. location_t interval: 2147483648 <= loc < 4294967295
  256. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^