Changeset 502


Ignore:
Timestamp:
May 12, 2014 6:27:02 AM (7 years ago)
Author:
kulshres
Message:

do not segfault if trace_off is called before trace_on

segfault is bad, even though a user doing this is clearly brain-dead.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

Location:
trunk/ADOL-C/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/src/fo_rev.c

    r501 r502  
    450450            sizeof(revreal));
    451451    if (rp_T == NULL) fail(ADOLC_MALLOC_FAILED);
     452    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_FOS_REVERSE;
    452453#ifdef _ABS_NORM_
    453454    memset(results,0,sizeof(double)*(indep+swchk));
     
    476477            sizeof(revreal));
    477478    if (rp_T == NULL) fail(ADOLC_MALLOC_FAILED);
     479    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_FOV_REVERSE;
    478480#if !defined(ADOLC_USE_CALLOC)
    479481    c_Ptr = (char *) ADOLC_GLOBAL_TAPE_VARS.dpp_A;
     
    25872589#endif
    25882590
     2591    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_NO_MODE;
    25892592    end_sweep();
    25902593
  • trunk/ADOL-C/src/ho_rev.c

    r501 r502  
    488488    rp_Atemp2 = (revreal *)malloc(k1 * sizeof(revreal));
    489489    rp_Ttemp2 = (revreal *)malloc(k * sizeof(revreal));
     490    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_HOS_REVERSE;
    490491    /*----------------------------------------------------------------------*/
    491492#elif _HOV_                                                          /* HOV */
     
    513514    rp_Atemp2 = (revreal*) malloc(pk1 * sizeof(revreal));
    514515    rp_Ttemp2 = (revreal*) malloc(k * sizeof(revreal));
     516    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_HOV_REVERSE;
    515517    /*----------------------------------------------------------------------*/
    516518#elif _HOS_OV_                                                    /* HOS_OV */
     
    538540    rp_Atemp2 = (revreal*) malloc(pk1 * sizeof(revreal));
    539541    rp_Ttemp2 = (revreal*) malloc(p*k*sizeof(revreal));
     542    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_HOV_REVERSE;
    540543#endif
    541544    rp_Ttemp  = (revreal*) malloc(k*sizeof(revreal));
     
    25872590    free((char*) x);
    25882591
     2592    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_NO_MODE;
    25892593    end_sweep();
    25902594
  • trunk/ADOL-C/src/tape_handling.cpp

    r446 r502  
    966966    ADOLC_OPENMP_THREAD_NUMBER;
    967967    ADOLC_OPENMP_GET_THREAD_NUMBER;
     968    if (ADOLC_CURRENT_TAPE_INFOS.workMode != ADOLC_TAPING) {
     969        failAdditionalInfo1 = ADOLC_CURRENT_TAPE_INFOS.tapeID;
     970        fail(ADOLC_TAPING_NOT_ACTUALLY_TAPING);
     971    }
    968972    ADOLC_CURRENT_TAPE_INFOS.pTapeInfos.keepTape = flag;
    969973    keep_stock();         /* copy remaining live variables + trace_flag = 0 */
     
    971975    cout.flush();
    972976    ADOLC_CURRENT_TAPE_INFOS.tapingComplete = 1;
     977    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_NO_MODE;
    973978    releaseTape();
    974979}
  • trunk/ADOL-C/src/taping.c

    r468 r502  
    284284                    "ADOL-C error: Trace was created on a 32-bit platform, cannot be opened on 64-bit platform!\n"
    285285                );
     286            break;
     287        case ADOLC_TAPING_NOT_ACTUALLY_TAPING:
     288            fprintf(DIAG_OUT,
     289                    "ADOL-C error: Trace %d is not being currently created!\n",
     290                    failAdditionalInfo1);
    286291            break;
    287292
     
    10681073    ADOLC_CURRENT_TAPE_INFOS.num_eq_prod = 0;
    10691074    ADOLC_CURRENT_TAPE_INFOS.numSwitches = 0;
     1075    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_TAPING;
    10701076
    10711077    /* Put operation denoting the start_of_the tape */
  • trunk/ADOL-C/src/taping_p.h

    r466 r502  
    3838    ADOLC_FOV_REVERSE,
    3939    ADOLC_HOS_REVERSE,
    40     ADOLC_HOV_REVERSE
     40    ADOLC_HOV_REVERSE,
     41
     42    ADOLC_TAPING
    4143};
    4244
     
    115117    ADOLC_CHECKPOINTING_UNEXPECTED_REVOLVE_ACTION,
    116118    ADOLC_WRONG_PLATFORM_32,
    117     ADOLC_WRONG_PLATFORM_64
     119    ADOLC_WRONG_PLATFORM_64,
     120    ADOLC_TAPING_NOT_ACTUALLY_TAPING
    118121};
    119122/* additional infos fail can work with */
  • trunk/ADOL-C/src/uni5_for.c

    r501 r502  
    53315331#endif
    53325332
     5333    ADOLC_CURRENT_TAPE_INFOS.workMode = ADOLC_NO_MODE;
    53335334    end_sweep();
    53345335
Note: See TracChangeset for help on using the changeset viewer.