You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
If I run the following program to emit an executable from terra then run it under valgrind, valgrind complains about there being an illegal instruction:
stdlib = terralib.includec("stdlib.h")
local length = 8
local struct Entry{
key : int,
}
local struct Table{
occupancy : uint64,
entries : &Entry
}
terra Table:find_entry(key : int) : &Entry
if self.occupancy >= 6.0 then
self:find_entry(key)
return self:find_entry(key)
else
self.entries.key = key
return self.entries
end
end
terra main()
var x : Table
x.occupancy = 0
x.entries = [&Entry](stdlib.calloc(length, sizeof(Entry)))
x:find_entry(1)
return 0
end
terralib.saveobj("bug", {main=main})
Valgrind error:
vex amd64->IR: unhandled instruction bytes: 0xC5 0xFA 0x7E 0x3 0xC5 0xF9 0x62 0x5
==22573== valgrind: Unrecognised instruction at address 0x400518.
==22573== at 0x400518: Table_methods_find_entry0 (in /home/david/projects/terra/bug)
==22573== Your program just tried to execute an instruction that Valgrind
==22573== did not recognise. There are two possible reasons for this.
==22573== 1. Your program has a bug and erroneously jumped to a non-code
==22573== location. If you are running Memcheck and you just saw a
==22573== warning about a bad jump, it's probably your program's fault.
==22573== 2. The instruction is legitimate but Valgrind doesn't handle it,
==22573== i.e. it's Valgrind's fault. If you think this is the case or
==22573== you are not sure, please let us know and we'll try to fix it.
==22573== Either way, Valgrind will now raise a SIGILL signal which will
==22573== probably kill your program.
==22573==
==22573== Process terminating with default action of signal 4 (SIGILL)
==22573== Illegal opcode at address 0x400518
==22573== at 0x400518: Table_methods_find_entry0 (in /home/david/projects/terra/bug)
The text was updated successfully, but these errors were encountered:
The instruction bytes correspond to: vmovq xmm0,QWORD PTR [rbx], which is an AVX instruction that is relatively new. valgrind (or the version installed) might not know it yet. Does the code actually run for you? We currently just assume AVX instructions are available, but that wouldn't be too difficult to fix.
Ah, I beg your pardon, you're entirely right. The code runs fine, and upgrading valgrind causes it to stop complaining.
The one I had was the latest version packaged with Ubuntu, so this will probably be a fairly common problem until the new version makes it into various repos, but as long as there's a version that works I don't really mind upgrading.
If I run the following program to emit an executable from terra then run it under valgrind, valgrind complains about there being an illegal instruction:
Valgrind error:
The text was updated successfully, but these errors were encountered: