www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - IPF on certain invalid code involving a const

reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Using DMD 0.131, Windows 98SE.

----------
void main() {
	const char[] qwert = "\U000579bd";

	yuiop(asdfg(qwert));
}

void yuiop(char[] jhkl) {}
----------
D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): undefined identifier 
asdfg
D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function expected 
before (), not asdfg of type int
D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function ipf1.yuiop 
(char[]) does not match argument types (int)
----------
DMD caused an invalid page fault in
module DMD.EXE at 0167:0040e42b.
Registers:
EAX=00000000 CS=0167 EIP=0040e42b EFLGS=00010246
EBX=00886114 SS=016f ESP=0071fa68 EBP=0073b3dc
ECX=000579bd DS=016f ESI=0073b3dc FS=4877
EDX=004cd3d2 ES=016f EDI=0073a248 GS=455e
Bytes at CS:EIP:
66 f7 04 4a 57 01 74 1a ff 74 24 0c 8b ce e8 f6
Stack dump:
00886114 00000000 00000004 000579bd 0040c5ff 0073b3dc 00000000 0073ce4c 
00000001 0073b3dc 0073b3dc 00411a36 0073b3dc 0073a248 0073b3dc 00735110
----------

Seems to crash only if the string is declared as const and the 
initialiser contains a codepoint beyond U+FFFF, whether notated with \U, 
\x or x"...".

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++  a->--- UB  P+ L E  W++  N+++ o K-  w++  O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
Sep 19 2005
next sibling parent zwang <nehzgnaw gmail.com> writes:
Confirmed on Windows XP.

Here's a reduced test case:

<code>
void main(char[][] a){
     main("\U00010000");
}
</code>


Stewart Gordon wrote:
 Using DMD 0.131, Windows 98SE.
 
 ----------
 void main() {
     const char[] qwert = "\U000579bd";
 
     yuiop(asdfg(qwert));
 }
 
 void yuiop(char[] jhkl) {}
 ----------
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): undefined identifier 
 asdfg
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function expected 
 before (), not asdfg of type int
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function ipf1.yuiop 
 (char[]) does not match argument types (int)
 ----------
 DMD caused an invalid page fault in
 module DMD.EXE at 0167:0040e42b.
 Registers:
 EAX=00000000 CS=0167 EIP=0040e42b EFLGS=00010246
 EBX=00886114 SS=016f ESP=0071fa68 EBP=0073b3dc
 ECX=000579bd DS=016f ESI=0073b3dc FS=4877
 EDX=004cd3d2 ES=016f EDI=0073a248 GS=455e
 Bytes at CS:EIP:
 66 f7 04 4a 57 01 74 1a ff 74 24 0c 8b ce e8 f6
 Stack dump:
 00886114 00000000 00000004 000579bd 0040c5ff 0073b3dc 00000000 0073ce4c 
 00000001 0073b3dc 0073b3dc 00411a36 0073b3dc 0073a248 0073b3dc 00735110
 ----------
 
 Seems to crash only if the string is declared as const and the 
 initialiser contains a codepoint beyond U+FFFF, whether notated with \U, 
 \x or x"...".
 
 Stewart.
 

Sep 19 2005
prev sibling parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb:
 Using DMD 0.131, Windows 98SE.
 
 ----------
 void main() {
     const char[] qwert = "\U000579bd";
 
     yuiop(asdfg(qwert));
 }
 
 void yuiop(char[] jhkl) {}
 ----------
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): undefined identifier
 asdfg
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function expected
 before (), not asdfg of type int
 D:\My Documents\Programming\D\Tests\bugs\ipf1.d(4): function ipf1.yuiop
 (char[]) does not match argument types (int)
 ----------
 DMD caused an invalid page fault in
 module DMD.EXE at 0167:0040e42b.
 Registers:
 EAX=00000000 CS=0167 EIP=0040e42b EFLGS=00010246
 EBX=00886114 SS=016f ESP=0071fa68 EBP=0073b3dc
 ECX=000579bd DS=016f ESI=0073b3dc FS=4877
 EDX=004cd3d2 ES=016f EDI=0073a248 GS=455e
 Bytes at CS:EIP:
 66 f7 04 4a 57 01 74 1a ff 74 24 0c 8b ce e8 f6
 Stack dump:
 00886114 00000000 00000004 000579bd 0040c5ff 0073b3dc 00000000 0073ce4c
 00000001 0073b3dc 0073b3dc 00411a36 0073b3dc 0073a248 0073b3dc 00735110
 ----------
 
 Seems to crash only if the string is declared as const and the
 initialiser contains a codepoint beyond U+FFFF, whether notated with \U,
 \x or x"...".
 
 Stewart.
 

Added to DStress as http://dstress.kuehne.cn/nocompile/c/const_24_A.d http://dstress.kuehne.cn/nocompile/c/const_24_B.d http://dstress.kuehne.cn/nocompile/c/const_24_C.d http://dstress.kuehne.cn/nocompile/c/const_24_D.d http://dstress.kuehne.cn/nocompile/c/const_24_E.d http://dstress.kuehne.cn/nocompile/c/const_24_F.d http://dstress.kuehne.cn/nocompile/c/const_24_G.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDL8m93w+/yD4P9tIRArnUAJ46HG/mkeC/RUWeMMsqdkJEMzN6dQCeKp7O CRpQLITt1lO3hCeEid5jxPo= =Am4S -----END PGP SIGNATURE-----
Sep 20 2005