我們最近將代碼從gcc4.2.4
升級到gcc4.3.3
。彙編編譯錯誤(gcc4.2.4 = win,gcc4.3.3 = fail)
void testAndSet( volatile int* s, int* val)
{
__asm__ __volatile__ ("btsl $0, %0\n "
"jc bitSet\n "
"movl $0, %1\n "
"jmp returnVector\n"
"bitSet:\n "
"movl $1, %1\n"
"returnVector: " : "=m"(*s), "=m"(*val));
}
我們的代碼現在失敗,出現以下錯誤,
lock.cxx: Assembler messages:
lock.cxx:59: Error: symbol `bitSet' is already defined
lock.cxx:61: Error: symbol `returnVector' is already defined
lock.cxx:59: Error: symbol `bitSet' is already defined
lock.cxx:61: Error: symbol `returnVector' is already defined
這些符號,未發現其他地方。 (重命名它們會導致與新名稱相同的錯誤)。
這是怎麼回事?爲什麼我會錯誤兩次?
很好。就是這樣。有趣的是,使用gcc選項-02失敗,但使用-O – user48956 2009-05-18 17:40:12