Losing 32 bits of a void pointer

sumo sumitraja at gmail.com
Tue Feb 18 18:39:38 PST 2014


I am using D & epoll on Fedora 3.12.10-300.fc20.x86_64 and am 
running into a very odd issue.

The data.ptr value of the epoll_event struct when it comes back 
from the epoll_wait call seems to have lost the top 32 bits.

GDB session produced the following:

Before epoll

$3 = {events = 1, data = {ptr = 0x7ffff7ee2e80, fd = -135385472, 
u32 = 4159581824, u64 = 140737352969856}}

(gdb) x/20g ev
0x7ffff7ee5ff0: 0x0000000000000001      0x00007ffff7ee2e80
0x7ffff7ee6000: 0x0000000000000000      0x0000000000000000

After epoll
$4 = {events = 1, data = {ptr = 0xf7ee2e80, fd = -135385472, u32 
= 4159581824, u64 = 4159581824}}

0x7fffffffe0e0: 0x0000000000000001      0x00000000f7ee2e80
0x7fffffffe0f0: 0x0000000000000001      0x0000000000000000

A similar gdb session with a simple C program produced the 
following:
Before epoll
$1 = {events = 1, data = {ptr = 0x7fbe184d9d00, fd = 407739648, 
u32 = 407739648, u64 = 140454428253440}}

after epoll
$2 = {ptr = 0x7fbe184d9d00, fd = 407739648, u32 = 407739648, u64 
= 1404544282534

Source is at 
https://bitbucket.org/sumitraja/sioford/src/64ee53513876c1763a5e04b9611da64a5d96cced/source/devent/eventqueue.d?at=master 
with break points at eventqueue.d:238 and eventqueue.d:253

I can't figure out what exactly I am doing wrong here so any 
insights would be of great help. I have seen the issue on Debian 
with a 3.2 kernel as well. Happens with both "DMD64 D Compiler 
v2.064" and the Fedora repository version of "LDC - the LLVM D 
compiler (0.12.0)" (Release     : 53.20130805git967b986.fc20).

Thanks

Sumit



More information about the Digitalmars-d mailing list