Re: [PATCH 3/4] Put index check before use.

2020-05-05 Thread Jeff Law via Gcc-patches
On Tue, 2020-02-04 at 14:57 +0100, Martin Liska wrote:
> liboffloadmic/ChangeLog:
> 
> 2020-02-04  Martin Liska  
> 
>   PR other/89860.
>   * runtime/offload_target.cpp: Put index check
>   before its use.
OK
jeff
> 



[PATCH 3/4] Put index check before use.

2020-02-06 Thread Martin Liska

liboffloadmic/ChangeLog:

2020-02-04  Martin Liska  

PR other/89860.
* runtime/offload_target.cpp: Put index check
before its use.
---
 liboffloadmic/runtime/offload_target.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/liboffloadmic/runtime/offload_target.cpp b/liboffloadmic/runtime/offload_target.cpp
index 8273faac13b..16ba4a32991 100644
--- a/liboffloadmic/runtime/offload_target.cpp
+++ b/liboffloadmic/runtime/offload_target.cpp
@@ -329,7 +329,7 @@ void OffloadDescriptor::merge_var_descs(
 }
 }
 // instead of m_vars[i].type.dst we will use m_vars_extra[i].type_dst
-if (m_vars[i].type.dst == c_extended_type && i < vars_total) {
+if (i < vars_total && m_vars[i].type.dst == c_extended_type) {
 VarDescExtendedType *etype =
 reinterpret_cast(vars[i].into);
 m_vars_extra[i].type_dst = etype->extended_type;