digitalmars.D - Linker error with array expressions
- Clemens (17/17) Jan 07 2010 Hey all,
- bearophile (5/6) Jan 07 2010 If you care for performance then *always* time your code (in this case t...
- Walter Bright (2/3) Jan 07 2010 Is this in bugzilla?
- bearophile (5/6) Jan 07 2010 I think most of them are already in bugzilla.
- Clemens (6/9) Jan 07 2010 I would like to use LDC, but my main target platform is Windows, and con...
Hey all, I've run across a bizarre linker error when using array expressions of the form buf1[] = buf1[] + 0.5f * buf2[]; The linker gives me errors like this one: OPTLINK (R) for Win32 Release 8.00.2 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html Test.obj(Test) Offset 0037AH Record Type 00C3 Error 1: Previous Definition Different : __arraySliceSliceExpMulAddSliceAssign_f --- errorlevel 2 This however only occurs under certain circumstances; I don't want to repeat the details, they are in http://d.puremagic.com/issues/show_bug.cgi?id=3683 I've only tested this with DMD on Windows for D1 so far, so it would be interesting to know if the attached example gives the same error with D2. In short, has anyone seen this before and knows of a workaround? Of course I could rewrite the array expressions as loops, but I seem to recall Walter mentioning that array expressions are optimized using SIMD operations. Is that true? If so, I'm hesitant to throw that overboard since performance is an issue (realtime audio synthesis). Thanks, Clemens
Jan 07 2010
Clemens:In short, has anyone seen this before and knows of a workaround? Of course I could rewrite the array expressions as loops, but I seem to recall Walter mentioning that array expressions are optimized using SIMD operations. Is that true? If so, I'm hesitant to throw that overboard since performance is an issue (realtime audio synthesis).<If you care for performance then *always* time your code (in this case the two alternative versions with and without array ops), because what Walter and docs say is always less important that what the reality is. I've yet to find situations where array expressions have given me a speed-up over the normal code generated by LDC (if performance is quite important then don't use DMD). Also note that currently array ops are quite buggy and slow when the arrays are short. Bye, bearophile
Jan 07 2010
bearophile wrote:Also note that currently array ops are quite buggyIs this in bugzilla?
Jan 07 2010
Walter Bright:Is this in bugzilla?I think most of them are already in bugzilla. I'll put some bugs there. Bye, bearophile
Jan 07 2010
bearophile Wrote:Walter Bright:FWIW, I just reported another, particularly nasty one where the array operations stomps over the memory lying after the array: http://d.puremagic.com/issues/show_bug.cgi?id=3687 ClemensIs this in bugzilla?I think most of them are already in bugzilla. I'll put some bugs there. Bye, bearophile
Jan 07 2010
Clemens Wrote:bearophile Wrote:I now posted a patch to this ticket, though actually it's against druntime. To patches against druntime go on Bugzilla or on the druntime space on dsource? The latter seems pretty deserted. Anyway I wasn't sure, so I posted to both, sorry. ClemensWalter Bright:FWIW, I just reported another, particularly nasty one where the array operations stomps over the memory lying after the array: http://d.puremagic.com/issues/show_bug.cgi?id=3687 ClemensIs this in bugzilla?I think most of them are already in bugzilla. I'll put some bugs there. Bye, bearophile
Jan 08 2010
Clemens wrote:Clemens Wrote:It should go in Bugzilla.bearophile Wrote:I now posted a patch to this ticket, though actually it's against druntime. To patches against druntime go on Bugzilla or on the druntime space on dsource? The latter seems pretty deserted. Anyway I wasn't sure, so I posted to both, sorry.Walter Bright:FWIW, I just reported another, particularly nasty one where the array operations stomps over the memory lying after the array: http://d.puremagic.com/issues/show_bug.cgi?id=3687 ClemensIs this in bugzilla?I think most of them are already in bugzilla. I'll put some bugs there. Bye, bearophile
Jan 08 2010
bearophile Wrote:If you care for performance then *always* time your code (in this case the two alternative versions with and without array ops), because what Walter and docs say is always less important that what the reality is.Of course I would time the code; as it stands though, the version with array operations doesn't even compile (or link, rather), due to the bug I reported.I've yet to find situations where array expressions have given me a speed-up over the normal code generated by LDC (if performance is quite important then don't use DMD).I would like to use LDC, but my main target platform is Windows, and consensus seems to be that LDC isn't usable there. Or is it possible to use it if I don't need exception handling? Can it generate DLLs? In any case, no LDC binaries for Windows seem to be available. What's the status with GDC? I think it was resurrected a while back; is there a current version available? Again, Windows? As far as I can tell at this point, I'm stuck with DMD for Windows development, for better or for worse. For now, I'll probably revert to loops for the offending code sections and replace them with hand-written inline SSE assembly if profiling shows a need for this. The simple loops I'm using here shouldn't be hard to write by hand. Still, it would be great if at some point DMD could do it by itself. Probably a distant dream at this point... Clemens
Jan 07 2010