www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - char buffer resize appears broken on linux 1.162

reply William S. Lear <William_member pathlink.com> writes:
% cat t.d
void main() {
char[] buffer;
buffer.length = 0;
}
% dmd -v t.d
parse     t
semantic  t
semantic2 t
semantic3 t
code      t
generating code for function 'main'
gcc t.o -o t -m32 -lphobos -lpthread -lm
t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
: undefined reference to `_d_arraysetlength2'
collect2: ld returned 1 exit status
--- errorlevel 1

If I change char[] to int[], it works.

Bill
Jul 05 2006
next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
William S. Lear wrote:
 gcc t.o -o t -m32 -lphobos -lpthread -lm
 t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
 : undefined reference to `_d_arraysetlength2'

_d_arraysetlength2 should be defined in the new libphobos.a. Make sure the new one is installed over the old one.
Jul 06 2006
parent William S. Lear <William_member pathlink.com> writes:
In article <e8kopo$1f9d$1 digitaldaemon.com>, Walter Bright says...
William S. Lear wrote:
 gcc t.o -o t -m32 -lphobos -lpthread -lm
 t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
 : undefined reference to `_d_arraysetlength2'

_d_arraysetlength2 should be defined in the new libphobos.a. Make sure the new one is installed over the old one.

Ah, I had forgotten about libphobos.a in /usr/lib. Indeed, this was the cause. Thank you. Bill
Jul 07 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

William S  Lear schrieb am 2006-07-05:
 % cat t.d
 void main() {
 char[] buffer;
 buffer.length = 0;
 }
 % dmd -v t.d
 parse     t
 semantic  t
 semantic2 t
 semantic3 t
 code      t
 generating code for function 'main'
 gcc t.o -o t -m32 -lphobos -lpthread -lm
 t.o(.gnu.linkonce.t_Dmain+0x1f): In function `_Dmain':
: undefined reference to `_d_arraysetlength2'
 collect2: ld returned 1 exit status
 --- errorlevel 1

 If I change char[] to int[], it works.

I can't replicate this issue. Did you rebuild Phobos or are you trying to use GDC's GPhobos in combination with DMD? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFErXYVLK5blCcjpWoRAkwcAKCKlW4xE/6cw+jd/Dtn1BM7D2FzVgCfdcB+ 6CNSGNtXbByVcsZ8ADxmioY= =G7Ov -----END PGP SIGNATURE-----
Jul 06 2006