Changeset f5478c8 for src/tests/alloc.c
- Timestamp:
- Nov 24, 2017, 8:57:00 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 2b716ec
- Parents:
- 50abab9 (diff), 3de176d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/alloc.c
r50abab9 rf5478c8 32 32 // allocation, non-array types 33 33 34 p = ( void *)malloc( sizeof(*p) ); // C malloc, type unsafe34 p = (int *)(void *)malloc( sizeof(*p) ); // C malloc, type unsafe 35 35 *p = 0xdeadbeef; 36 36 printf( "C malloc %#x\n", *p ); … … 54 54 printf( "\n" ); 55 55 56 p = calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe56 p = (int *)calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe 57 57 printf( "C array calloc, fill 0\n" ); 58 58 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } … … 83 83 printf( "\n" ); 84 84 85 p = ( void *)realloc( p, dim * sizeof(*p) ); // C realloc85 p = (int *)(void *)realloc( p, dim * sizeof(*p) ); // C realloc 86 86 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; } 87 87 printf( "C realloc\n" ); … … 256 256 stp = malloc(); 257 257 printf( "\nSHOULD FAIL\n" ); 258 #ifdef ERR1 258 259 p = alloc( stp, dim * sizeof(*stp) ); 259 260 p = memset( stp, 10 ); 260 261 p = memcpy( &st1, &st ); 262 #endif 261 263 } // main 262 264
Note: See TracChangeset
for help on using the changeset viewer.