Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Compiler emits invalid byte sequence

hyungseok
Beginner
184 Views

I discovered that the latest x86-64 ICX 2024.0.0 emits invalid registers when it generates x86 binaries.

This error has been identified in 16 opcodes.

 

Buggy code.

```

/* Type your code here, or load an example. */
void bug(int num) {
__asm__(
".intel_syntax noprefix\n"
"cmpbxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmplexadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmplxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnbexadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnbxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpbexadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnlxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnoxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnpxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnsxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpnzxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpoxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmppxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpbexadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpsxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
"cmpzxadd DWORD PTR [1], EDI, EBP\n" ".align 32\n"
);
}
```

Compile Option: -m32

Compiled Code
```
bug:
push ebp
mov ebp,esp
mov eax,DWORD PTR [ebp+0x8]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
xchg ax,ax
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
(bad)
cmp eax,0x1
data16 data16 data16 data16 data16 nop WORD PTR cs:[eax+eax*1+0x0]
nop DWORD PTR [eax+eax*1+0x0]
pop ebp
ret
```

I tested it through godbolt.

 

0 Kudos
2 Replies
Alex_Y_Intel
Moderator
153 Views

I've escalated your issue to our internal engineering team

0 Kudos
Alex_Y_Intel
Moderator
116 Views

This has been fixed in version 2024.1

http://cmplrexplorer.intel.com/z/3qfb4e

0 Kudos
Reply