Status: New
Owner: ----
New issue 3556 by [email protected]: data type size issue in
v8-3.28/test/cctest/test-platform.cc file
https://code.google.com/p/v8/issues/detail?id=3556
Intel compiler flag this issue while compiling v8 source code. sp_address
is declared as "int" type on Intel64 platform. Size of int on Intel64
platform is 32 bits while width of rsp is 64 bits on Intel64 platform. We
believe this is bug in v8 source code as this assignment will cause
loss/overwrite of most significant 32 bits.
File found: v8-3.28/test/cctest/test-platform.cc
Line Number: 40
Code:
38 #if defined(_M_X64) || defined(__x86_64__)
39 #define GET_STACK_POINTER() \
40 static int sp_addr = 0; \
41 do { \
42 ASM("mov %%rsp, %0" : "=g" (sp_addr)); \
43 } while (0)
44 #elif defined(_M_IX86) || defined(__i386__)
We believe the fix for this issue is to change above code
From:
40 static int sp_addr = 0;
To:
40 static uintptr_t sp_addr = 0;
Following are note from our compiler expert:
static int sp_addr = 0; do { __asm__ __volatile__("mov %%rsp, %0" : "=g"
(sp_a
ddr)); } while (0);
On an Intel64 platform, int is only 32 bits, yet this inline asm is storing
rsp into that variable. On gcc this compiles and
assembles because the operand that gcc subsitites for %0 is a memory
operand. With the Intel compiler, it chooses
%0 to be a register operand, and the resulting instruction it generates is
mov %rsp, %r13d
which causes a register size mismatch when run through the assembler.
The code that gcc generates is clearly incorrect, as it causes a 64 bit
store, but the size of the memory it is storing
into is only 4 bytes in size in the object file, so it is overwriting other
memory. When accessed, the application only uses
the low 32 integer bits that were stored in this location. This is an
error in V8.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.