parasoft c test – 编译内联汇编代码

我想在parasoft c测试软件中编译和测试样本内联嵌入式汇编代码.

源代码 :

#include <stdio.h>
void example()   { int arg1, arg2, add, sub, mul, quo, rem ;

 printf( "Enter two integer numbers : " );
 scanf( "%d%d", &arg1, &arg2 );


 __asm__ ( "addl %%ebx, %%eax;" : "=a" (add) : "a" (arg1) , "b" (arg2) );
 __asm__ ( "subl %%ebx, %%eax;" : "=a" (sub) : "a" (arg1) , "b" (arg2) );
 __asm__ ( "imull %%ebx, %%eax;" : "=a" (mul) : "a" (arg1) , "b" (arg2) );

 __asm__ ( "movl $0x0, %%edx;"
           "movl %2, %%eax;"
           "movl %3, %%ebx;"
            "idivl %%ebx;" : "=a" (quo), "=d" (rem) : "g" (arg1), "g" (arg2) );

 printf( "%d + %d = %d\n", arg1, arg2, add );
 printf( "%d - %d = %d\n", arg1, arg2, sub );
 printf( "%d * %d = %d\n", arg1, arg2, mul );
 printf( "%d / %d = %d\n", arg1, arg2, quo );
 printf( "%d %% %d = %d\n", arg1, arg2, rem );


 }

代码有错误.每个单词的错误是:

The word 'ebx' is not correctly spelled.

我该怎么办 ?

最佳答案 很可能这不是Parasoft C测试本身检测到的错误,而是您从Eclipse CDT IDE(代码编辑器)获得的提示.您可能正在使用Parasoft C测试作为Eclipse插件.

点赞