modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug423.go (about) 1 // run 2 3 // Copyright 2012 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // gc used to overflow a counter when a variable was 8 // mentioned 256 times, and generate stack corruption. 9 10 package main 11 12 func main() { 13 F(1) 14 } 15 16 func F(arg int) { 17 var X interface{} 18 _ = X // used once 19 X = 0 20 X = 0 21 X = 0 22 X = 0 23 X = 0 24 X = 0 25 X = 0 26 X = 0 27 X = 0 28 X = 0 29 X = 0 30 X = 0 31 X = 0 32 X = 0 33 X = 0 34 X = 0 35 X = 0 36 X = 0 37 X = 0 38 X = 0 39 X = 0 40 X = 0 41 X = 0 42 X = 0 43 X = 0 44 X = 0 45 X = 0 46 X = 0 47 X = 0 48 X = 0 49 X = 0 // used 32 times 50 X = 0 51 X = 0 52 X = 0 53 X = 0 54 X = 0 55 X = 0 56 X = 0 57 X = 0 58 X = 0 59 X = 0 60 X = 0 61 X = 0 62 X = 0 63 X = 0 64 X = 0 65 X = 0 66 X = 0 67 X = 0 68 X = 0 69 X = 0 70 X = 0 71 X = 0 72 X = 0 73 X = 0 74 X = 0 75 X = 0 76 X = 0 77 X = 0 78 X = 0 79 X = 0 80 X = 0 81 X = 0 // used 64 times 82 X = 0 83 X = 0 84 X = 0 85 X = 0 86 X = 0 87 X = 0 88 X = 0 89 X = 0 90 X = 0 91 X = 0 92 X = 0 93 X = 0 94 X = 0 95 X = 0 96 X = 0 97 X = 0 98 X = 0 99 X = 0 100 X = 0 101 X = 0 102 X = 0 103 X = 0 104 X = 0 105 X = 0 106 X = 0 107 X = 0 108 X = 0 109 X = 0 110 X = 0 111 X = 0 112 X = 0 113 X = 0 114 X = 0 115 X = 0 116 X = 0 117 X = 0 118 X = 0 119 X = 0 120 X = 0 121 X = 0 // used 96 times 122 X = 0 123 X = 0 124 X = 0 125 X = 0 126 X = 0 127 X = 0 128 X = 0 129 X = 0 130 X = 0 131 X = 0 132 X = 0 133 X = 0 134 X = 0 135 X = 0 136 X = 0 137 X = 0 138 X = 0 139 X = 0 140 X = 0 141 X = 0 142 X = 0 143 X = 0 144 X = 0 145 X = 0 // used 128 times 146 X = 0 147 X = 0 148 X = 0 149 X = 0 150 X = 0 151 X = 0 152 X = 0 153 X = 0 154 X = 0 155 X = 0 156 X = 0 157 X = 0 158 X = 0 159 X = 0 160 X = 0 161 X = 0 162 X = 0 163 X = 0 164 X = 0 165 X = 0 166 X = 0 167 X = 0 168 X = 0 169 X = 0 170 X = 0 171 X = 0 172 X = 0 173 X = 0 174 X = 0 175 X = 0 176 X = 0 177 X = 0 178 X = 0 179 X = 0 180 X = 0 181 X = 0 182 X = 0 183 X = 0 184 X = 0 185 X = 0 186 X = 0 187 X = 0 188 X = 0 189 X = 0 190 X = 0 191 X = 0 192 X = 0 193 X = 0 194 X = 0 195 X = 0 196 X = 0 197 X = 0 198 X = 0 199 X = 0 200 X = 0 201 X = 0 202 X = 0 203 X = 0 204 X = 0 205 X = 0 206 X = 0 207 X = 0 208 X = 0 209 X = 0 // used 200 times 210 X = 0 211 X = 0 212 X = 0 213 X = 0 214 X = 0 215 X = 0 216 X = 0 217 X = 0 218 X = 0 219 X = 0 220 X = 0 221 X = 0 222 X = 0 223 X = 0 224 X = 0 225 X = 0 226 X = 0 227 X = 0 228 X = 0 229 X = 0 230 X = 0 231 X = 0 232 X = 0 233 X = 0 234 X = 0 235 X = 0 236 X = 0 237 X = 0 238 X = 0 239 X = 0 240 X = 0 241 X = 0 242 X = 0 243 X = 0 244 X = 0 245 X = 0 246 X = 0 247 X = 0 248 X = 0 249 X = 0 250 X = 0 251 X = 0 252 X = 0 253 X = 0 254 X = 0 255 X = 0 256 X = 0 257 X = 0 258 X = 0 259 X = 0 260 X = 0 261 X = 0 262 X = 0 263 X = 0 264 X = 0 265 X = 0 266 X = 0 267 X = 0 268 X = 0 269 X = 0 270 X = 0 271 X = 0 272 X = 0 273 X = 0 // used 256 times 274 if arg != 1 { 275 panic("argument was changed") 276 } 277 }