VirtualBox

Changeset 27270 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Mar 11, 2010 10:39:07 AM (15 years ago)
Author:
vboxsync
Message:

Runtime/testcase: improve RTMemEf testcase a bit, so that it provides correct status and provides the expected result with optimizing compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTMemEf.cpp

    r27269 r27270  
    4646static int tstMemAllocEfAccess()
    4747{
     48    char sz[1];
    4849    int32_t v;
    4950
     
    5253     * will crash no matter whether the fence is at the bottom or on top. */
    5354    int32_t *p = (int32_t *)RTMemEfAlloc(sizeof(int32_t));
    54     RTPrintf("tstRTMemAllocEfAccess: allocated int32_t at %#p\n");
     55    RTPrintf("tstRTMemAllocEfAccess: allocated int32_t at %#p\n", p);
    5556    RTPrintf("tstRTMemAllocEfAccess: triggering buffer overrun...\n");
    5657    v = *(p + 1);
     58    /* Dummy use of v so that the compiler cannot optimize it out */
     59    RTStrPrintf(sz, 0, "", v);
    5760    RTPrintf("tstRTMemAllocEfAccess: triggering buffer underrun...\n");
    5861    v = *(p - 1);
     62    /* Dummy use of v so that the compiler cannot optimize it out */
     63    RTStrPrintf(sz, 0, "", v);
    5964
    6065    /* Reaching this is a severe error. */
    61     return VERR_GENERAL_FAILURE;
     66    return 0;
    6267}
    6368
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette