June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #10 from Jerry Quinn <jlquinn@optonline.net> 2013-06-10 08:33:57 PDT ---
I tried building dmd on my machine but irstate.h is missing from the zip file.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #11 from Martin Nowak <code@dawg.eu> 2013-06-10 09:46:49 PDT ---
(In reply to comment #10)
> I tried building dmd on my machine but irstate.h is missing from the zip file.

No problem, I already found something. The +4 offset is wrong it should be +8
because it's the length field of rt.util.container.Array(T) and on X86_64 the
pointer before it is 8 byte.
<_D2rt14sections_linux12_static_dsosS2rt4util9container36__T5ArrayTPS2rt14sections_linux3DSOZ5Array+4>

Also the rest of your asm slightly differs from mine. So either we're not linking against the same library or your linker rewrites code (LTO?).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #12 from Jerry Quinn <jlquinn@optonline.net> 2013-06-10 09:56:26 PDT ---
(In reply to comment #11)
> (In reply to comment #10)
> > I tried building dmd on my machine but irstate.h is missing from the zip file.
> 
> No problem, I already found something. The +4 offset is wrong it should be +8
> because it's the length field of rt.util.container.Array(T) and on X86_64 the
> pointer before it is 8 byte.
> <_D2rt14sections_linux12_static_dsosS2rt4util9container36__T5ArrayTPS2rt14sections_linux3DSOZ5Array+4>

Good, I'm glad I'm not undergoing severe hallucination :-)


> Also the rest of your asm slightly differs from mine. So either we're not linking against the same library or your linker rewrites code (LTO?).

jlquinn@wyvern:~/re/test$ ldd --version
ldd (Ubuntu EGLIBC 2.15-0ubuntu20.1) 2.15

Here's the strace of all files opened while compiling:

jlquinn@wyvern:~/re/test$ strace -f -e open ~/dmd2/linux/bin64/dmd -g junk.d
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/home/jlquinn/dmd2/linux/bin64/dmd.conf", O_RDONLY) = 3
open("/home/jlquinn/dmd2/linux/bin64/dmd.conf", O_RDONLY) = 3
Process 22301 attached
[pid 22301] open("junk.d", O_RDONLY)    = 3
[pid 22301] open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 4
[pid 22300]
open("/home/jlquinn/dmd2/linux/bin64/../../src/druntime/import/object.di",
O_RDONLY) = 3
Process 22301 detached
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
open("junk.o", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 3
Process 22302 attached
[pid 22302] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 22302] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 22302] open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
[pid 22302] open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
[pid 22302] open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale/en_US.utf8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale/en_US/LC_MESSAGES/gcc-4.7.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale/en.UTF-8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale/en.utf8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale/en/LC_MESSAGES/gcc-4.7.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
[pid 22302]
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22302]
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale-langpack/en_US/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22302] open("/usr/share/locale-langpack/en/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
Process 22303 attached
Process 22302 suspended
[pid 22303] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 22303] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 22303] open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
[pid 22303] open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
[pid 22303] open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale/en_US.utf8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale/en_US/LC_MESSAGES/gcc-4.7.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale/en.UTF-8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale/en.utf8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale/en/LC_MESSAGES/gcc-4.7.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
[pid 22303]
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22303]
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/gcc-4.7.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale-langpack/en_US/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/usr/share/locale-langpack/en/LC_MESSAGES/gcc-4.7.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 22303] open("/tmp/cchy5rqP.c", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
[pid 22303] open("/tmp/ccannUTm.o", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
[pid 22303] open("/tmp/ccCqnnnU.ld", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
[pid 22303] open("/tmp/ccCA2QQr.le", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
[pid 22303] open("/tmp/ccCqnnnU.ld", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
[pid 22303] open("/tmp/ccCA2QQr.le", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
Process 22304 attached
Process 22303 suspended
[pid 22304] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6",
O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 22304] open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o",
O_RDONLY|O_CLOEXEC) = 3
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o",
O_RDONLY|O_CLOEXEC) = 5
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o",
O_RDONLY|O_CLOEXEC) = 6
[pid 22304] open("junk.o", O_RDONLY|O_CLOEXEC) = 7
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o",
O_RDONLY|O_CLOEXEC) = 8
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o",
O_RDONLY|O_CLOEXEC) = 9
[pid 22304] open("/home/jlquinn/dmd2/linux/bin64/../lib64/libphobos2.a",
O_RDONLY|O_CLOEXEC) = 10
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libpthread.so",
O_RDONLY|O_CLOEXEC) = 11
[pid 22304] open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) =
12
[pid 22304] open("/usr/lib/x86_64-linux-gnu/libpthread_nonshared.a",
O_RDONLY|O_CLOEXEC) = 13
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libm.so",
O_RDONLY|O_CLOEXEC) = 14
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/librt.so",
O_RDONLY|O_CLOEXEC) = 15
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a",
O_RDONLY|O_CLOEXEC) = 16
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so",
O_RDONLY|O_CLOEXEC) = 17
[pid 22304]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libc.so",
O_RDONLY|O_CLOEXEC) = 18
[pid 22304] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 19
[pid 22304] open("/usr/lib/x86_64-linux-gnu/libc_nonshared.a",
O_RDONLY|O_CLOEXEC) = 20
[pid 22304] open("/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2",
O_RDONLY|O_CLOEXEC) = 21
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a",
O_RDONLY|O_CLOEXEC) = 22
[pid 22304] open("/usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so",
O_RDONLY|O_CLOEXEC) = 23
[pid 22304] open("junk", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0777) = 24
Process 22303 resumed
Process 22304 detached
[pid 22303] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 22303] open("/tmp/ccCqnnnU.ld", O_RDONLY) = 3
[pid 22303] open("/tmp/ccCA2QQr.le", O_RDONLY) = 3
Process 22302 resumed
Process 22303 detached
[pid 22302] --- SIGCHLD (Child exited) @ 0 (0) ---
Process 22302 detached
--- SIGCHLD (Child exited) @ 0 (0) ---
jlquinn@wyvern:~/re/test$

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #13 from Walter Bright <bugzilla@digitalmars.com> 2013-06-10 23:11:35 PDT ---
Jerry reported on the n.g. that valgrind reports an "Invalid write of size 8" at:

0x0000000000438cc8 <+512>:    mov    %r14,-0x8(%rax)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #14 from Martin Nowak <code@dawg.eu> 2013-06-11 04:56:16 PDT ---
OK, let's start with a simple thing.

sha1sum /usr/lib64/libphobos2.a 40cddd5a8a9f28c000346014cbb4221a3bbd91b4  /usr/lib64/libphobos2.a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #15 from Jerry Quinn <jlquinn@optonline.net> 2013-06-11 06:23:47 PDT ---
jlquinn@wyvern:~/re/test$ sha1sum /home/jlquinn/dmd2/linux/lib64/libphobos2.*
40cddd5a8a9f28c000346014cbb4221a3bbd91b4
/home/jlquinn/dmd2/linux/lib64/libphobos2.a
8494571c0d7487e75345ab0c979530667626fdda
/home/jlquinn/dmd2/linux/lib64/libphobos2.so
jlquinn@wyvern:~/re/test$ sha1sum /home/jlquinn/dmd2/linux/bin64/dmd
8cdb0c1903774d12a8593dc2ecc2d260b9c02bcd  /home/jlquinn/dmd2/linux/bin64/dmd

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #16 from Jerry Quinn <jlquinn@optonline.net> 2013-06-11 06:26:12 PDT ---
Additional data - the following gives me a working program:

dmd -c junk.d
copy junk.o libphobos2.a to centos6.4 x86_64 machine
on centos6.4, link using gcc link line given by dmd -v junk.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #17 from Jerry Quinn <jlquinn@optonline.net> 2013-06-11 06:27:07 PDT ---
Also, the stdio bits are a red herring.  The following also segfaults:


void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #18 from Jerry Quinn <jlquinn@optonline.net> 2013-06-11 06:31:36 PDT ---
Created an attachment (id=1224)
Crashing binary

cat > junk.d
void main() {
}

dmd junk.d

This is the executable junk.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10274



--- Comment #19 from Martin Nowak <code@dawg.eu> 2013-06-11 07:03:15 PDT ---
OK, can you dump the linker output?
dmd junk -L--verbose

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------