- Timestamp:
- Nov 22, 2019, 3:37:28 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 9aa1317
- Parents:
- d74369b
- Location:
- tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/alloc-ERROR.txt
rd74369b r6a25b8f 1 alloc.cfa:31 1:1 error: No reasonable alternatives for expression Applying untyped:1 alloc.cfa:317:1 error: No reasonable alternatives for expression Applying untyped: 2 2 Name: ?=? 3 3 ...to: … … 19 19 20 20 21 alloc.cfa:31 2:1 error: No reasonable alternatives for expression Applying untyped:21 alloc.cfa:318:1 error: No reasonable alternatives for expression Applying untyped: 22 22 Name: ?=? 23 23 ...to: … … 39 39 40 40 41 alloc.cfa:31 3:1 error: No reasonable alternatives for expression Applying untyped:41 alloc.cfa:319:1 error: No reasonable alternatives for expression Applying untyped: 42 42 Name: ?=? 43 43 ...to: … … 50 50 51 51 52 alloc.cfa:3 14:1 error: No reasonable alternatives for expression Applying untyped:52 alloc.cfa:320:1 error: No reasonable alternatives for expression Applying untyped: 53 53 Name: ?=? 54 54 ...to: -
tests/.expect/alloc.txt
rd74369b r6a25b8f 30 30 CFA resize array alloc 31 31 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 32 CFA resize array alloc , fill32 CFA resize array alloc 33 33 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 34 CFA resize array alloc , fill34 CFA resize array alloc 35 35 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 36 36 CFA resize array alloc, fill 37 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x 1010101 0x1010101 0x1010101 0x10101010xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede37 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 38 38 39 39 C memalign 42 42.5 -
tests/alloc.cfa
rd74369b r6a25b8f 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 20 21:45:21201913 // Update Count : 39112 // Last Modified On : Fri Nov 22 15:34:19 2019 13 // Update Count : 404 14 14 // 15 15 … … 126 126 127 127 p = alloc( p, 2 * dim ); // CFA resize array alloc 128 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } 128 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } // fill upper part 129 129 printf( "CFA resize array alloc\n" ); 130 130 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } … … 139 139 140 140 p = alloc_set( p, 3 * dim, fill ); // CFA resize array alloc, fill 141 printf( "CFA resize array alloc , fill\n" );141 printf( "CFA resize array alloc\n" ); 142 142 for ( i; 3 * dim ) { printf( "%#x ", p[i] ); } 143 143 printf( "\n" ); … … 145 145 146 146 p = alloc_set( p, dim, fill ); // CFA resize array alloc, fill 147 printf( "CFA resize array alloc , fill\n" );147 printf( "CFA resize array alloc\n" ); 148 148 for ( i; dim ) { printf( "%#x ", p[i] ); } 149 149 printf( "\n" ); -
tests/heap.cfa
rd74369b r6a25b8f 10 10 // Created On : Tue Nov 6 17:54:56 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 19 08:22:34 201913 // Update Count : 1912 // Last Modified On : Wed Nov 20 16:10:24 2019 13 // Update Count : 25 14 14 // 15 15 … … 74 74 size_t s = (i + 1) * 20; 75 75 char * area = (char *)malloc( s ); 76 if ( area == 0 ) abort( "malloc/free out of memory" );76 if ( area == 0p ) abort( "malloc/free out of memory" ); 77 77 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last 78 78 area[malloc_usable_size( area ) - 1] = '\345'; // fill ultimate byte … … 83 83 size_t s = i + 1; // +1 to make initialization simpler 84 84 locns[i] = (char *)malloc( s ); 85 if ( locns[i] == 0 ) abort( "malloc/free out of memory" );85 if ( locns[i] == 0p ) abort( "malloc/free out of memory" ); 86 86 locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last 87 87 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte … … 99 99 size_t s = i + default_mmap_start(); // cross over point 100 100 char * area = (char *)malloc( s ); 101 if ( area == 0 ) abort( "malloc/free out of memory" );101 if ( area == 0p ) abort( "malloc/free out of memory" ); 102 102 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last 103 103 area[malloc_usable_size( area ) - 1] = '\345'; // fill ultimate byte … … 108 108 size_t s = i + default_mmap_start(); // cross over point 109 109 locns[i] = (char *)malloc( s ); 110 if ( locns[i] == 0 ) abort( "malloc/free out of memory" );110 if ( locns[i] == 0p ) abort( "malloc/free out of memory" ); 111 111 locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last 112 112 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte … … 124 124 size_t s = (i + 1) * 20; 125 125 char * area = (char *)calloc( 5, s ); 126 if ( area == 0 ) abort( "calloc/free out of memory" );126 if ( area == 0p ) abort( "calloc/free out of memory" ); 127 127 if ( area[0] != '\0' || area[s - 1] != '\0' || 128 128 area[malloc_usable_size( area ) - 1] != '\0' || … … 136 136 size_t s = i + 1; 137 137 locns[i] = (char *)calloc( 5, s ); 138 if ( locns[i] == 0 ) abort( "calloc/free out of memory" );138 if ( locns[i] == 0p ) abort( "calloc/free out of memory" ); 139 139 if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' || 140 140 locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' || … … 155 155 size_t s = i + default_mmap_start(); // cross over point 156 156 char * area = (char *)calloc( 1, s ); 157 if ( area == 0 ) abort( "calloc/free out of memory" );157 if ( area == 0p ) abort( "calloc/free out of memory" ); 158 158 if ( area[0] != '\0' || area[s - 1] != '\0' ) abort( "calloc/free corrupt storage4.1" ); 159 159 if ( area[malloc_usable_size( area ) - 1] != '\0' ) abort( "calloc/free corrupt storage4.2" ); … … 167 167 size_t s = i + default_mmap_start(); // cross over point 168 168 locns[i] = (char *)calloc( 1, s ); 169 if ( locns[i] == 0 ) abort( "calloc/free out of memory" );169 if ( locns[i] == 0p ) abort( "calloc/free out of memory" ); 170 170 if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' || 171 171 locns[i][malloc_usable_size( locns[i] ) - 1] != '\0' || … … 189 189 for ( s; 1 ~ NoOfAllocs ) { // allocation of size 0 can return null 190 190 char * area = (char *)memalign( a, s ); 191 if ( area == 0 ) abort( "memalign/free out of memory" );192 //sout | i | " " |area;191 if ( area == 0p ) abort( "memalign/free out of memory" ); 192 //sout | i | area; 193 193 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 194 194 abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, s, area ); 195 195 } // if 196 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last byte196 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last byte 197 197 area[malloc_usable_size( area ) - 1] = '\345'; // fill ultimate byte 198 198 free( area ); … … 207 207 size_t s = i + default_mmap_start(); // cross over point 208 208 char * area = (char *)memalign( a, s ); 209 if ( area == 0 ) abort( "memalign/free out of memory" );210 //sout | i | " " |area;209 if ( area == 0p ) abort( "memalign/free out of memory" ); 210 //sout | i | area; 211 211 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 212 212 abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)s, area ); … … 223 223 // initial N byte allocation 224 224 char * area = (char *)calloc( 5, i ); 225 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );225 if ( area == 0p ) abort( "calloc/realloc/free out of memory" ); 226 226 if ( area[0] != '\0' || area[i - 1] != '\0' || 227 227 area[malloc_usable_size( area ) - 1] != '\0' || … … 231 231 for ( s; i ~ 256 * 1024 ~ 26 ) { // start at initial memory request 232 232 area = (char *)realloc( area, s ); // attempt to reuse storage 233 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );233 if ( area == 0p ) abort( "calloc/realloc/free out of memory" ); 234 234 if ( area[0] != '\0' || area[s - 1] != '\0' || 235 235 area[malloc_usable_size( area ) - 1] != '\0' || … … 245 245 size_t s = i + default_mmap_start(); // cross over point 246 246 char * area = (char *)calloc( 1, s ); 247 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );247 if ( area == 0p ) abort( "calloc/realloc/free out of memory" ); 248 248 if ( area[0] != '\0' || area[s - 1] != '\0' || 249 249 area[malloc_usable_size( area ) - 1] != '\0' || … … 253 253 for ( r; i ~ 256 * 1024 ~ 26 ) { // start at initial memory request 254 254 area = (char *)realloc( area, r ); // attempt to reuse storage 255 if ( area == 0 ) abort( "calloc/realloc/free out of memory" );255 if ( area == 0p ) abort( "calloc/realloc/free out of memory" ); 256 256 if ( area[0] != '\0' || area[r - 1] != '\0' || 257 257 area[malloc_usable_size( area ) - 1] != '\0' || … … 267 267 // initial N byte allocation 268 268 char * area = (char *)memalign( a, amount ); // aligned N-byte allocation 269 if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?270 //sout | alignments[a] | " " |area;269 if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ? 270 //sout | alignments[a] | area; 271 271 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 272 272 abort( "memalign/realloc/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area ); … … 278 278 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" ); 279 279 area = (char *)realloc( area, s ); // attempt to reuse storage 280 if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?281 //sout | i | " " |area;280 if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ? 281 //sout | i | area; 282 282 if ( (size_t)area % a != 0 ) { // check for initial alignment 283 283 abort( "memalign/realloc/free bad alignment %p", area ); … … 294 294 for ( s; 1 ~ limit ) { // allocation of size 0 can return null 295 295 char * area = (char *)cmemalign( a, 1, s ); 296 if ( area == 0 ) abort( "cmemalign/free out of memory" );297 //sout | i | " " |area;296 if ( area == 0p ) abort( "cmemalign/free out of memory" ); 297 //sout | i | area; 298 298 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 299 299 abort( "cmemalign/free bad alignment : cmemalign(%d,%d) = %p", (int)a, s, area ); … … 313 313 // initial N byte allocation 314 314 char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation 315 if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?316 //sout | alignments[a] | " " |area;315 if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ? 316 //sout | alignments[a] | area; 317 317 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 318 318 abort( "cmemalign/realloc/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area ); … … 327 327 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc/free corrupt storage2" ); 328 328 area = (char *)realloc( area, s ); // attempt to reuse storage 329 if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?330 //sout | i | " " |area;329 if ( area == 0p ) abort( "cmemalign/realloc/free out of memory" ); // no storage ? 330 //sout | i | area; 331 331 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 332 332 abort( "cmemalign/realloc/free bad alignment %p", area ); 333 } // if 334 if ( area[s - 1] != '\0' || area[s - 1] != '\0' || 335 area[malloc_usable_size( area ) - 1] != '\0' || 336 ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc/free corrupt storage3" ); 337 area[s - 1] = '\345'; // fill last byte 338 } // for 339 free( area ); 340 } // for 341 342 // check memalign/realloc with align/free 343 344 amount = 2; 345 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 346 // initial N byte allocation 347 char * area = (char *)memalign( a, amount ); // aligned N-byte allocation 348 if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ? 349 //sout | alignments[a] | area | endl; 350 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 351 abort( "memalign/realloc with align/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area ); 352 } // if 353 area[0] = '\345'; area[amount - 2] = '\345'; // fill first/penultimate byte 354 355 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 356 for ( s; amount ~ 256 * 1024 ) { // start at initial memory request 357 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" ); 358 area = (char *)realloc( area, a * 2, s ); // attempt to reuse storage 359 if ( area == 0p ) abort( "memalign/realloc with align/free out of memory" ); // no storage ? 360 //sout | i | area | endl; 361 if ( (size_t)area % a * 2 != 0 ) { // check for initial alignment 362 abort( "memalign/realloc with align/free bad alignment %p", area ); 363 } // if 364 area[s - 1] = '\345'; // fill last byte 365 } // for 366 free( area ); 367 } // for 368 369 // check cmemalign/realloc with align/free 370 371 amount = 2; 372 for ( size_t a = libAlign() + libAlign(); a <= limit; a += a ) { // generate powers of 2 373 // initial N byte allocation 374 char *area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation 375 if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ? 376 //sout | alignments[a] | area | endl; 377 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 378 abort( "cmemalign/realloc with align/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area ); 379 } // if 380 if ( area[0] != '\0' || area[amount - 1] != '\0' || 381 area[malloc_usable_size( area ) - 1] != '\0' || 382 ! malloc_zero_fill( area ) ) abort( "cmemalign/realloc with align/free corrupt storage1" ); 383 area[0] = '\345'; area[amount - 2] = '\345'; // fill first/penultimate byte 384 385 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 386 for ( int s = amount; s < 256 * 1024; s += 1 ) { // start at initial memory request 387 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc with align/free corrupt storage2" ); 388 area = (char *)realloc( area, a * 2, s ); // attempt to reuse storage 389 if ( area == 0p ) abort( "cmemalign/realloc with align/free out of memory" ); // no storage ? 390 //sout | i | area | endl; 391 if ( (size_t)area % a * 2 != 0 || malloc_alignment( area ) != a * 2 ) { // check for initial alignment 392 abort( "cmemalign/realloc with align/free bad alignment %p %jd %jd", area, malloc_alignment( area ), a * 2 ); 333 393 } // if 334 394 if ( area[s - 1] != '\0' || area[s - 1] != '\0' ||
Note: See TracChangeset
for help on using the changeset viewer.