Changeset f5478c8 for src/tests/alloc.c


Ignore:
Timestamp:
Nov 24, 2017, 8:57:00 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/alloc.c

    r50abab9 rf5478c8  
    3232        // allocation, non-array types
    3333
    34         p = (void *)malloc( sizeof(*p) );                   // C malloc, type unsafe
     34        p = (int *)(void *)malloc( sizeof(*p) );                   // C malloc, type unsafe
    3535        *p = 0xdeadbeef;
    3636        printf( "C   malloc %#x\n", *p );
     
    5454        printf( "\n" );
    5555
    56         p = calloc( dim, sizeof( *p ) );                    // C array calloc, type unsafe
     56        p = (int *)calloc( dim, sizeof( *p ) );                    // C array calloc, type unsafe
    5757        printf( "C   array calloc, fill 0\n" );
    5858        for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); }
     
    8383        printf( "\n" );
    8484
    85         p = (void *)realloc( p, dim * sizeof(*p) );         // C realloc
     85        p = (int *)(void *)realloc( p, dim * sizeof(*p) );         // C realloc
    8686        for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; }
    8787        printf( "C   realloc\n" );
     
    256256        stp = malloc();
    257257        printf( "\nSHOULD FAIL\n" );
     258#ifdef ERR1
    258259        p = alloc( stp, dim * sizeof(*stp) );
    259260        p = memset( stp, 10 );
    260261        p = memcpy( &st1, &st );
     262#endif
    261263} // main
    262264
Note: See TracChangeset for help on using the changeset viewer.