digitalmars.D.bugs - Compiler throws assertion failure on filename containing certain
- Stewart Gordon <smjg_1998 yahoo.com> May 04 2004
- "Walter" <newshound digitalmars.com> May 04 2004
- "Unknown W. Brackets" <unknown at.simplemachines.dot.org> May 04 2004
- "Walter" <newshound digitalmars.com> May 05 2004
- "Ivan Senji" <ivan.senji public.srce.hr> May 04 2004
- Stewart Gordon <smjg_1998 yahoo.com> May 12 2004
This is a newly encountered problem when I upgraded to DMD 0.86. I was
driven mad to pinpoint the cause, trimming down one of my programs until
there was nothing left of it. I then finally realised that it wasn't
the code it doesn't like, but the filename!
Here's a minimal testcase:
----------
void qwert() {}
int main() { return 0; }
----------
Saved as good_filename.d and bad-filename.d. Compiler output:
----------
D:\My Documents\Programming\D\Tests\bugs>dmd good_filename.d
Max # of fixups = 4
E:\DMD\BIN\..\..\dm\bin\link.exe good_filename,,,user32+kernel32/noi;
D:\My Documents\Programming\D\Tests\bugs>dmd bad-filename.d
Assertion failure: 'result[i] == '_' || isalnum(result[i])' on line 34
in file 'mangle.c'
abnormal program termination
D:\My Documents\Programming\D\Tests\bugs>
----------
It seems that the compiler is trying to mangle the function name by
combining it with the filename. If I remove the dummy qwert function,
the error doesn't show, obviously as main isn't mangled (at least in
this way).
Is it legal for D code filenames to have characters other than
[_A-Za-z0-9] (besides the . near the end), if they're not used as module
names at all?
If so, it should be mangling the name in a way that makes sense.
If not, this should be clearly documented (don't ask me where though),
and the compiler should stop with a clean, human-readable error message
at the beginning.
Stewart.
--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.
May 04 2004
I hadn't thought of that, but you're right. The filename characters must only be allowable identifier characters, or the name mangling will fail. This needs to be documented, and a proper error message.
May 04 2004
Walter wrote:I hadn't thought of that, but you're right. The filename characters must only be allowable identifier characters, or the name mangling will fail. This needs to be documented, and a proper error message.
Wouldn't it be possible to strip out the bad characters, or replace them with underscores? Like, if you tried to use "bad-filename.d", it would use "bad_filename.d". If you tried to use "espaņol.d" it would use "espa_ol.d". Then again, this is taking a step away from the programmer, and could cause conflicts... -[Unknown]
May 04 2004
"Unknown W. Brackets" <unknown at.simplemachines.dot.org> wrote in message news:c78tos$18hg$1 digitaldaemon.com...Walter wrote:I hadn't thought of that, but you're right. The filename characters must only be allowable identifier characters, or the name mangling will fail. This needs to be documented, and a proper error message.
Wouldn't it be possible to strip out the bad characters, or replace them with underscores? Like, if you tried to use "bad-filename.d", it would use "bad_filename.d". If you tried to use "espaņol.d" it would use "espa_ol.d". Then again, this is taking a step away from the programmer, and could cause conflicts...
I think that such would cause more grief, like how Microsoft mangles long filenames into 8.3 ones.
May 05 2004
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:c786h9$332$1 digitaldaemon.com...This is a newly encountered problem when I upgraded to DMD 0.86. I was driven mad to pinpoint the cause, trimming down one of my programs until there was nothing left of it. I then finally realised that it wasn't the code it doesn't like, but the filename! Here's a minimal testcase: ---------- void qwert() {} int main() { return 0; } ---------- Saved as good_filename.d and bad-filename.d. Compiler output: ---------- D:\My Documents\Programming\D\Tests\bugs>dmd good_filename.d Max # of fixups = 4 E:\DMD\BIN\..\..\dm\bin\link.exe good_filename,,,user32+kernel32/noi; D:\My Documents\Programming\D\Tests\bugs>dmd bad-filename.d Assertion failure: 'result[i] == '_' || isalnum(result[i])' on line 34 in file 'mangle.c'
I got the exact same error with 0.86 but then Walter changed something and i redownloaded it and it now works! My filename also contained '-' but i didn't figure out this was the problem. I was having this problem with the version where dmd.exe is around 2MB, but in the new one it is back to its usual size.abnormal program termination D:\My Documents\Programming\D\Tests\bugs> ---------- It seems that the compiler is trying to mangle the function name by combining it with the filename. If I remove the dummy qwert function, the error doesn't show, obviously as main isn't mangled (at least in this way). Is it legal for D code filenames to have characters other than [_A-Za-z0-9] (besides the . near the end), if they're not used as module names at all? If so, it should be mangling the name in a way that makes sense. If not, this should be clearly documented (don't ask me where though), and the compiler should stop with a clean, human-readable error message at the beginning. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 04 2004
Stewart Gordon wrote:This is a newly encountered problem when I upgraded to DMD 0.86. I was driven mad to pinpoint the cause, trimming down one of my programs until there was nothing left of it. I then finally realised that it wasn't the code it doesn't like, but the filename!
I upgraded to 0.88 and it just stopped complaining! But still.... Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
May 12 2004









"Walter" <newshound digitalmars.com> 