发件人: Wuweijia
发送时间: 2017年9月12日 12:34
收件人: 'valgrind-users@lists.sourceforge.net' 
<valgrind-users@lists.sourceforge.net>
抄送: Fanbohao <fanbo...@huawei.com>
主题: [HELP] Is there any bug with the program built by the clang4.0 with 
thumbv7--linux-android command para.

Hello:
                First, I build the program with clang 4.0 with 32 bit command  
param,  but  it run failed because there is unknown instruction;
                Second , I build the program with clang 4.0 with 64 bit command 
param, and  it run success.
Third,  I build the same program with clang 3.8  with 32 bit command param, and 
I run success, there is no unknown instructions.

                There is the error log:
                disInstr(thumb): unhandled instruction: 0x450B 0xD104
==24328== valgrind: Unrecognised instruction at address 0x1089c5.
==24328==    at 0x1089C4: compare_exchange_strong (atomic:943)
==24328==    by 0x1089C4: atomic_compare_exchange_strong_explicit<unsigned int> 
(atomic:1376)
==24328==    by 0x1089C4: main (testClang.cpp:22)

                There is some point :
                1: I build the arm application which is 32 bit , but it ran in 
the aarch64  server which is 64 bit;

                The rar pack  contain:
                1: the compile command with clang 4.0:
                2: the error log
                3: the function  main instruction (that compile with clang3.8 
and clang4.0)

                I had search the code. In the implementation,  no matter 
clang3.8 or clang4.0  they all call __c11_atomic_compare_exchange_strong 
function to check the value. I think the source code maybe it is the same and 
fine.

                If you need any more information , Please send e-mail to me and 
how to gather it step by step. I am waiting for reponse.

BR
Owen



#include <errno.h>
#include <limits.h>
#include <stdatomic.h>
#include <string.h>
#include <sys/cdefs.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>


_Atomic(unsigned int ) g_status;


int main(int argc __unused , char ** argv __unused ) {
        unsigned int init = 1;
        int flag = 1;
        unsigned int expect = random();
        unsigned int value = 2;
        atomic_init(&g_status, init);

        if (__predict_true(atomic_compare_exchange_strong_explicit(&g_status, 
&expect,
                             value, memory_order_acquire, 
memory_order_relaxed))) {
            flag = 0;
        }

        printf("Done  flag:%d \n", flag );
        return  1;
}

Attachment: clang4.0.rar
Description: clang4.0.rar

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to