Thread overview
gdc for D1 on x86_64
Oct 16, 2010
Jérôme M. Berger
Oct 16, 2010
Iain Buclaw
Oct 17, 2010
Jérôme M. Berger
Oct 17, 2010
Iain Buclaw
Oct 18, 2010
Jérôme M. Berger
October 16, 2010
	Hi,

	Gdc (c3e22fb3bf19) fails to build phobos on x86_64:

> /home/jerome/abs/gdc-hg/src/gcc-build/./gcc/gdc -B/home/jerome/abs/gdc-hg/src/gcc-build/./gcc/ -B/usr/x86_64-unknown-linux-gnu/bin/ -B/usr/x86_64-unknown-linux-gnu/lib/ -isystem /usr/x86_64-unknown-linux-gnu/include -isystem /usr/x86_64-unknown-linux-gnu/sys-include -o std/regexp.o -g -frelease -O2 -fversion=GC_Use_Alloc_MMap -fversion=GC_Use_Stack_GLibC -fversion=GC_Use_Data_Fixed -nostdinc -pipe   \
> 	-I ../../../gcc-4.4.5-build/libphobos -I ../../../gcc-4.4.5-build/libphobos/internal/gc -I ./x86_64-unknown-linux-gnu -c ../../../gcc-4.4.5-build/libphobos/std/regexp.d
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1632: Error: function std.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint)
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1632: Error: cannot implicitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of type uint* to ulong*
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1647: Error: function std.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint)
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1647: Error: cannot implicitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of type uint* to ulong*
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1662: Error: function std.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint)
> ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1662: Error: cannot implicitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of type uint* to ulong*
> make[3]: *** [std/regexp.o] Error 1
> make[3]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build/x86_64-unknown-linux-gnu/libphobos'
> make[2]: *** [all] Error 2
> make[2]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build/x86_64-unknown-linux-gnu/libphobos'
> make[1]: *** [all-target-libphobos] Error 2
> make[1]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build'
> make: *** [all] Error 2

	The attached patch allows it to build (but I haven't tested the
resulting lib since I don't use regexp myself).

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


October 16, 2010
== Quote from "Jérôme M. Berger" (jeberger@free.fr)'s article
> This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
> --------------enigFA970E325419AA4704D394C4
> Content-Type: multipart/mixed;
>  boundary="------------020802090108050507010000"
> This is a multi-part message in MIME format.
> --------------020802090108050507010000
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> 	Hi,
> 	Gdc (c3e22fb3bf19) fails to build phobos on x86_64:
> > /home/jerome/abs/gdc-hg/src/gcc-build/./gcc/gdc -B/home/jerome/abs/gdc-=
> hg/src/gcc-build/./gcc/ -B/usr/x86_64-unknown-linux-gnu/bin/ -B/usr/x86_6= 4-unknown-linux-gnu/lib/ -isystem /usr/x86_64-unknown-linux-gnu/include -= isystem /usr/x86_64-unknown-linux-gnu/sys-include -o std/regexp.o -g -fre= lease -O2 -fversion=3DGC_Use_Alloc_MMap -fversion=3DGC_Use_Stack_GLibC -f= version=3DGC_Use_Data_Fixed -nostdinc -pipe   \
> > 	-I ../../../gcc-4.4.5-build/libphobos -I ../../../gcc-4.4.5-build/libp=
> hobos/internal/gc -I ./x86_64-unknown-linux-gnu -c ../../../gcc-4.4.5-bui= ld/libphobos/std/regexp.d
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1632: Error: function s=
> td.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint=
> )
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1632: Error: cannot imp=
> licitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of =
> type uint* to ulong*
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1647: Error: function s=
> td.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint=
> )
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1647: Error: cannot imp=
> licitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of =
> type uint* to ulong*
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1662: Error: function s=
> td.intrinsic.bt (ulong*,ulong) does not match parameter types (uint*,uint=
> )
> > ../../../gcc-4.4.5-build/libphobos/std/regexp.d:1662: Error: cannot imp=
> licitly convert expression (cast(uint*)&this.program[pc + 1LU + 4LU]) of =
> type uint* to ulong*
> > make[3]: *** [std/regexp.o] Error 1
> > make[3]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build/x86_6=
> 4-unknown-linux-gnu/libphobos'
> > make[2]: *** [all] Error 2
> > make[2]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build/x86_6=
> 4-unknown-linux-gnu/libphobos'
> > make[1]: *** [all-target-libphobos] Error 2
> > make[1]: Leaving directory `/home/jerome/abs/gdc-hg/src/gcc-build'
> > make: *** [all] Error 2
> 	The attached patch allows it to build (but I haven't tested the
> resulting lib since I don't use regexp myself).
> 		Jerome
> --=20
> mailto:jeberger@free.fr
> http://jeberger.free.fr
> Jabber: jeberger@jabber.fr
> --------------020802090108050507010000
> Content-Type: text/x-patch;
>  name="regexp-x86_64.patch"
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: inline;
>  filename="regexp-x86_64.patch"
> # HG changeset patch
> # Parent c3e22fb3bf19523679289f50b83bd0c5c39fc463
> Fix phobos 1 build issues on x86_64.
> diff -r c3e22fb3bf19 -r f424bf435a88 d/phobos/std/regexp.d
> --- a/d/phobos/std/regexp.d	Thu Oct 14 14:15:30 2010 +0100
> +++ b/d/phobos/std/regexp.d	Sat Oct 16 09:09:09 2010 +0200
> @@ -1486,7 +1486,7 @@
>      size_t pop;
>      size_t ss;
>      regmatch_t *psave;
> -    uint c1;
> +    size_t c1;
>      uint c2;
>      ushort* pu;
>      uint* puint;
> @@ -1629,7 +1629,7 @@
>                  c1 =3D input[src];
>                  //printf("[x%02x]=3Dx%02x, x%02x\n", c1 >> 3, ((&program=
> [pc + 1 + 4])[c1 >> 3] ), (1 << (c1 & 7)));
>                  if (c1 <=3D pu[0] &&
> -                    !bt(cast(uint*)&(program[pc + 1 + 4]), c1)) // assum=
> es BitArray implementation
> +                    !bt(cast(size_t*)&(program[pc + 1 + 4]), c1)) // ass=
> umes BitArray implementation
>                      goto Lnomatch;
>                  pc +=3D 1 + 2 * ushort.sizeof + len;
>                  break;
> @@ -1644,7 +1644,7 @@
>                  c1 =3D input[src];
>                  if (c1 > pu[0])
>                      goto Lnomatch;
> -                if (!bt(cast(uint*)&(program[pc + 1 + 4]), c1)) // assum=
> es BitArray implementation
> +                if (!bt(cast(size_t*)&(program[pc + 1 + 4]), c1)) // ass=
> umes BitArray implementation
>                      goto Lnomatch;
>                  src++;
>                  pc +=3D 1 + 2 * ushort.sizeof + len;
> @@ -1659,7 +1659,7 @@
>                  len =3D pu[1];
>                  c1 =3D input[src];
>                  if (c1 <=3D pu[0] &&
> -                    bt(cast(uint*)&(program[pc + 1 + 4]), c1)) // assume=
> s BitArray implementation
> +                    bt(cast(size_t*)&(program[pc + 1 + 4]), c1)) // assu=
> mes BitArray implementation
>                      goto Lnomatch;
>                  src++;
>                  pc +=3D 1 + 2 * ushort.sizeof + len;
> --------------020802090108050507010000--
> --------------enigFA970E325419AA4704D394C4
> Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc"
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> iEYEARECAAYFAky5T94ACgkQd0kWM4JG3k87PgCghlzpo3/dPTAtBaW0D7Ordf7I
> 1v0AoLFdbWDHc1VnHiboqlCmMFidn5i1
> =mj9j
> -----END PGP SIGNATURE-----
> --------------enigFA970E325419AA4704D394C4--

Strange, I thought I fixed this in commit 282, but according to history it got reverted back in 288 by accident. Thanks for letting us know!

Regards
Iain
October 17, 2010
Iain Buclaw wrote:
> Strange, I thought I fixed this in commit 282, but according to history it got reverted back in 288 by accident. Thanks for letting us know!
> 
	I'm not sure if it is related, but the following code prints "NOK":

====================8<--------------------
import std.stdio;
import std.regexp;

void main()
{
   auto expr = new RegExp ("^a*\\[$", "g");
   if (expr.test ("["))
      writefln ("OK");
   else
      writefln ("NOK");
}
-------------------->8====================

	Removing the "a*" from the regexp or replacing the square bracket
with "b" causes it to print "OK". There are other cases where it
will fail, but all seem to involve a backslash in the expression.

	This used to work with gdc two years ago and it works with dmd 1.064.

==> gdc --version
gdc (GCC) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

==> uname -a
Linux wraith 2.6.35-ARCH #1 SMP PREEMPT Wed Sep 29 08:45:18 CEST
2010 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
AuthenticAMD GNU/Linux

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



October 17, 2010
== Quote from "Jérôme M. Berger" (jeberger@free.fr)'s article
> This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
> --------------enig4343E2F2AF5496438B0DC11D
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> 	I'm not sure if it is related, but the following code prints "NOK":
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D8<-----------=
> ---------
> import std.stdio;
> import std.regexp;
> void main()
> {
>    auto expr =3D new RegExp ("^a*\\[$", "g");
>    if (expr.test ("["))
>       writefln ("OK");
>    else
>       writefln ("NOK");
> }
> -------------------->8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D
> 	Removing the "a*" from the regexp or replacing the square bracket
> with "b" causes it to print "OK". There are other cases where it
> will fail, but all seem to involve a backslash in the expression.
> 	This used to work with gdc two years ago and it works with dmd 1.064.
> =3D=3D> gdc --version
> gdc (GCC) 4.4.5
> Copyright (C) 2010 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There
> is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> =3D=3D> uname -a
> Linux wraith 2.6.35-ARCH #1 SMP PREEMPT Wed Sep 29 08:45:18 CEST
> 2010 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
> AuthenticAMD GNU/Linux
> 		Jerome
> --=20

It worked up until the 1.064 Phobos merge it seems. The current changeset should have that fixed now, though is probably a sign that should really have more 64bit testers for GDC.

Regards
Iain
October 18, 2010
Iain Buclaw wrote:
> It worked up until the 1.064 Phobos merge it seems. The current changeset should have that fixed now, though is probably a sign that should really have more 64bit testers for GDC.
> 
	Yes, it works now.

	Thanks,
		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr