4

I want to compile and test a sample inline embedded assembly code in parasoft c++ test software.

source code :

#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 code has error. The error for each word is :

The word 'ebx' is not correctly spelled.

what should I do ?

sjsam
  • 21,411
  • 5
  • 55
  • 102
Mahsa ehsani
  • 117
  • 12

1 Answers1

1

Most probably this is not an error detected by Parasoft C++test as itself, but rather a hint you are getting from Eclipse CDT IDE (code editor). You are probably using Parasoft C++test as an Eclipse plugin.

Bbb
  • 11
  • 1