[Openmp-dev] unused variable 'temp_val'

Bliss, Brian E brian.e.bliss at intel.com
Wed Jun 3 10:21:26 PDT 2015


That depends on wheter or not GOMP_FLAG is true or false.
GOMP_FLAG=1 means use a critical section for compatibility with gcc 4.2-4.5 (4.6?) ia32, and that makes temp_val dead code.
GOMP_FLAG=0 gets max performance, and that is why it was coded that way.

The issue should probably revisited as I believe ia32 libgomp has switched away from critical sections is some cases (thereby breaking libgomp backward compatibility).
We put the issue on the back burner until libgomp 4.5 was irrelevant, but it's about time.
Gcc for Intel64 uses inlined cmpxchg or locked add wherever possible & avoids critical sections calls.

-bb

-----Original Message-----
From: openmp-dev-bounces at cs.uiuc.edu [mailto:openmp-dev-bounces at cs.uiuc.edu] On Behalf Of Jack Howarth
Sent: Wednesday, June 03, 2015 12:00 PM
To: Peyton, Jonathan L; openmp-dev at dcs-maillist2.engr.illinois.edu
Subject: [Openmp-dev] unused variable 'temp_val'

Jonathan,
       It appears we have one more instance of dead code in runtime/src/kmp_atomic.c which produces numerous warnings of the form...

/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2266:1:
warning: unused variable 'temp_val' [-Wunused-variable]
ATOMIC_CMPXCHG_CPT_REV( fixed1,  div_cpt_rev, kmp_int8,    8, /,
KMP_ARCH_X86 )  // __kmpc_atomic_fixed1_div_cpt_rev ^
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2260:34:
note: expanded from macro 'ATOMIC_CMPXCHG_CPT_REV'
        TYPE KMP_ATOMIC_VOLATILE temp_val;                                \
                                 ^
Isn't the line...

        TYPE KMP_ATOMIC_VOLATILE temp_val;                                \

dead code in the macro definition....

#define ATOMIC_CMPXCHG_CPT_REV(TYPE_ID,OP_ID,TYPE,BITS,OP,GOMP_FLAG)       \
ATOMIC_BEGIN_CPT(TYPE_ID,OP_ID,TYPE,TYPE)                                  \
    TYPE new_value;                                                        \
        TYPE KMP_ATOMIC_VOLATILE temp_val;                                \
    OP_GOMP_CRITICAL_CPT_REV(OP,GOMP_FLAG)                                 \
    OP_CMPXCHG_CPT_REV(TYPE,BITS,OP)                                       \
}

      Jack
_______________________________________________
Openmp-dev mailing list
Openmp-dev at dcs-maillist2.engr.illinois.edu
http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev




More information about the Openmp-dev mailing list