diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index 30d6d52c801d025a7ffb71da8f96c4ad8f6d6e8a..9c27f68012fab6ef7a094b3f1c8ca897c220b983 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -2273,7 +2273,7 @@ typedef struct kmp_task_stack {
 
 #endif // BUILD_TIED_TASK_STACK
 
-#if LIBOMP_USE_VARDEP
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
 /* extra deps in task data */
 struct kmp_extra_depinfo {
   kmp_uint32           ed_size;             // extra dependencies for the next task
@@ -2332,7 +2332,7 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
   unsigned reserved30 : 5; /* reserved for library use */
   /* Compilator flags: */
   unsigned depsinalloc : 1; /* 1== __kmpc_omp_task_alloc has 2 more kmp_int32 fields for deps and deps_noalias sizes*/
-  unsigned depsfill : 1; /* 1== if td_deps of the task data already filled */
+  unsigned depsfill : 1;    /* 1== if td_deps of the task data already filled */
 } kmp_tasking_flags_t;
 
 struct kmp_taskdata { /* aligned during dynamic allocation       */
@@ -2369,11 +2369,11 @@ struct kmp_taskdata { /* aligned during dynamic allocation       */
   kmp_depnode_t
       *td_depnode; // Pointer to graph node if this task has dependencies
   kmp_depend_info_t*
-      td_deps;              // TG: store arrays of deps per task
+      td_deps;        // TG: store arrays of deps per task
   kmp_int32
       td_ndeps;
   kmp_depend_info_t*
-      td_deps_noalias;      // TG: store arrays of deps per task
+      td_deps_noalias; // TG: store arrays of deps without alias per task
   kmp_int32
       td_ndeps_noalias;
 #endif
@@ -2622,8 +2622,8 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
   kmp_uint32 th_reap_state; // Non-zero indicates thread is not
   // tasking, thus safe to reap
 
-#if LIBOMP_USE_VARDEP
-  kmp_uint32            th_edps_size[2];        // cummulative count in th_edeps
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
+  kmp_uint32              th_edps_size[2];        // cummulative count in th_edeps
   kmp_extra_depinfo_th_t  th_edeps[2];          // [alias/noalias]
   kmp_extra_depinfo_th_t* th_edeps_tail[2];     // TG: tail pointers
 #endif
diff --git a/runtime/src/kmp_ftn_entry.h b/runtime/src/kmp_ftn_entry.h
index 25c3e0c467b967ceca039bb1b524292def5f8c31..19720f71cdaf320239d0282b02365528f9f9d1f3 100644
--- a/runtime/src/kmp_ftn_entry.h
+++ b/runtime/src/kmp_ftn_entry.h
@@ -598,7 +598,7 @@ FTN_SET_DEPEND_INFO(void * addr, int flag)
     #endif
 }
 
-#if LIBOMP_USE_VARDEP
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
 int FTN_STDCALL
 FN_TASK_DECLDEPS( int mode, int count, void** array)
 {
diff --git a/runtime/src/kmp_runtime.cpp b/runtime/src/kmp_runtime.cpp
index 08a9c1b4cb84100e71420c33cef35028cc070798..35f8c77b95d6f53de7b1894e94b1b00ee95770d2 100644
--- a/runtime/src/kmp_runtime.cpp
+++ b/runtime/src/kmp_runtime.cpp
@@ -4046,7 +4046,7 @@ static void __kmp_initialize_info(kmp_info_t *this_thr, kmp_team_t *team,
 #if OMPT_SUPPORT
   this_thr->th.th_task_name    = 0;
 #endif
-#if LIBOMP_USE_VARDEP
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
   this_thr->th.th_edps_size[0] = 0;
   this_thr->th.th_edps_size[1] = 0;
   memset(&this_thr->th.th_edeps, 0, sizeof(this_thr->th.th_edeps) );
diff --git a/runtime/src/kmp_tasking.cpp b/runtime/src/kmp_tasking.cpp
index 97ff2f10dbd1cd7df0b85ebe575c2d5d94764719..804c19d6dc8ecaeb9a3bdf483d2fcdce758f0116 100644
--- a/runtime/src/kmp_tasking.cpp
+++ b/runtime/src/kmp_tasking.cpp
@@ -1676,18 +1676,18 @@ kmp_int32 __kmpc_omp_task(ident_t *loc_ref, kmp_int32 gtid,
   kmp_int32 res;
   KMP_SET_THREAD_STATE_BLOCK(EXPLICIT_TASK);
 
-#if LIBOMP_USE_VARDEP || KMP_DEBUG
+#if (LIBOMP_USE_VARDEP && OMP_40_ENABLED) || KMP_DEBUG
   kmp_taskdata_t * new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
 #endif
   KA_TRACE(10, ("__kmpc_omp_task(enter): T#%d loc=%p task=%p\n", gtid, loc_ref,
                 new_taskdata));
 
-#if LIBOMP_USE_VARDEP
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
   kmp_info_t* thread = __kmp_threads[ gtid ];
   if ((new_taskdata->td_deps==0)&&(thread->th.th_edps_size[0])&&(thread->th.th_edps_size[1]))
 #endif
     res =  __kmp_omp_task(gtid, new_task, true);
-#if LIBOMP_USE_VARDEP
+#if LIBOMP_USE_VARDEP && OMP_40_ENABLED
   else
     res = __kmpc_omp_task_with_deps(loc_ref, gtid, new_task, 0, 0, 0, 0);
 #endif