Commit 8fb96d9
authored
Fix compiler assert about bounds expression already existing. (#537)
The children() method for iterating over chidren of AST cast expressions
was incorrectly including compiler-generated bounds expressions. Child AST
nodes should be nodes that appear in the source program and additional
information shouldn't be treated as child nodes. There were
complex IR invariants about when a bounds expression stored within a cast
expression was child AST node or not.
This change fixes the bug and simplifies the AST invariants. This fixes
issue #526. for cast expressions, there is now one entry for bounds expressions
declared as part of the program. There are separate nodes for normalized
bounds and inferred bounds.
Testing:
- Added a new regression test case for the failing case.
- Passes existing Checked C and clang Checked C tests.1 parent aba5f72 commit 8fb96d9
File tree
6 files changed
+68
-40
lines changed- include/clang/AST
- lib
- AST
- Sema
- test/CheckedC
- inferred-bounds
- regression-cases
6 files changed
+68
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2958 | 2958 | | |
2959 | 2959 | | |
2960 | 2960 | | |
2961 | | - | |
| 2961 | + | |
| 2962 | + | |
2962 | 2963 | | |
2963 | 2964 | | |
2964 | 2965 | | |
| |||
3067 | 3068 | | |
3068 | 3069 | | |
3069 | 3070 | | |
3070 | | - | |
3071 | | - | |
3072 | | - | |
3073 | | - | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
3074 | 3075 | | |
3075 | | - | |
| 3076 | + | |
3076 | 3077 | | |
3077 | 3078 | | |
3078 | 3079 | | |
3079 | 3080 | | |
3080 | 3081 | | |
3081 | | - | |
3082 | | - | |
3083 | | - | |
3084 | | - | |
3085 | 3082 | | |
3086 | | - | |
| 3083 | + | |
3087 | 3084 | | |
3088 | 3085 | | |
3089 | 3086 | | |
3090 | 3087 | | |
3091 | 3088 | | |
3092 | 3089 | | |
3093 | 3090 | | |
3094 | | - | |
3095 | | - | |
3096 | | - | |
| 3091 | + | |
| 3092 | + | |
3097 | 3093 | | |
3098 | 3094 | | |
3099 | 3095 | | |
3100 | 3096 | | |
3101 | 3097 | | |
3102 | | - | |
3103 | | - | |
3104 | | - | |
3105 | 3098 | | |
3106 | 3099 | | |
3107 | 3100 | | |
| |||
3116 | 3109 | | |
3117 | 3110 | | |
3118 | 3111 | | |
3119 | | - | |
| 3112 | + | |
3120 | 3113 | | |
3121 | 3114 | | |
3122 | 3115 | | |
| |||
3129 | 3122 | | |
3130 | 3123 | | |
3131 | 3124 | | |
3132 | | - | |
| 3125 | + | |
| 3126 | + | |
3133 | 3127 | | |
3134 | 3128 | | |
3135 | 3129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2182 | 2182 | | |
2183 | 2183 | | |
2184 | 2184 | | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
2192 | 2196 | | |
2193 | 2197 | | |
2194 | 2198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2285 | 2285 | | |
2286 | 2286 | | |
2287 | 2287 | | |
| 2288 | + | |
2288 | 2289 | | |
2289 | 2290 | | |
2290 | 2291 | | |
| |||
2566 | 2567 | | |
2567 | 2568 | | |
2568 | 2569 | | |
2569 | | - | |
| 2570 | + | |
2570 | 2571 | | |
2571 | | - | |
| 2572 | + | |
2572 | 2573 | | |
2573 | 2574 | | |
2574 | 2575 | | |
2575 | | - | |
| 2576 | + | |
2576 | 2577 | | |
2577 | 2578 | | |
2578 | 2579 | | |
2579 | 2580 | | |
2580 | | - | |
| 2581 | + | |
2581 | 2582 | | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
2585 | 2586 | | |
2586 | 2587 | | |
2587 | 2588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
| 451 | + | |
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments