Thread overview
[Issue 8349] New: CTFE memcpy Error with ctRegex
Jul 05, 2012
David Simcha
Jul 05, 2012
Dmitry Olshansky
Jul 05, 2012
Jonathan M Davis
Nov 12, 2012
Denis Shelomovskij
Nov 30, 2012
Dmitry Olshansky
Dec 01, 2012
Dmitry Olshansky
July 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349

           Summary: CTFE memcpy Error with ctRegex
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2012-07-05 06:42:57 PDT ---
import std.regex;

enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>";
enum peakRegex = ctRegex!(peakRegexStr);

d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1334): Error: memcpy
cannot be interpreted at compile time, because it has no available source code
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1431):        called from
here: move(front(src),front(tgt))
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1239):        called from
here: moveAll(this.ir[offset + 1u..__dollar],this.ir[offset..__dollar - 1u])
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1123):        called from
here: this.parseQuantifier(fix)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(876):        called from here:
this.parseRegex()
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6428):        called from
here: parser.this(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6412):        called from
here: regexImpl(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6437):        called from
here: regex("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[])
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1334): Error: memcpy
cannot be interpreted at compile time, because it has no available source code
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1431):        called from
here: move(front(src),front(tgt))
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1239):        called from
here: moveAll(this.ir[offset + 1u..__dollar],this.ir[offset..__dollar - 1u])
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1123):        called from
here: this.parseQuantifier(fix)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(876):        called from here:
this.parseRegex()
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6428):        called from
here: parser.this(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6412):        called from
here: regexImpl(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6439):        called from
here: regex("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[])
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6439):        called from
here:
ctGenRegExCode(regex("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[]))
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1334): Error: memcpy
cannot be interpreted at compile time, because it has no available source code
d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1431):        called from
here: move(front(src),front(tgt))
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1239):        called from
here: moveAll(this.ir[offset + 1u..__dollar],this.ir[offset..__dollar - 1u])
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(1123):        called from
here: this.parseQuantifier(fix)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(876):        called from here:
this.parseRegex()
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6428):        called from
here: parser.this(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6412):        called from
here: regexImpl(pattern,flags)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6446):        called from
here: regex("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[])
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6446):        called from
here:
StaticRegex(null,Regex(null,null,null,0u,0u,0u,0u,0u,null,null,ShiftOr(null,0u,0u))).this(regex("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[]),&
func)
d:\dmd2\windows\bin\..\..\src\phobos\std\regex.d(6463): Error: template
instance
std.regex.ctRegexImpl!("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>",[])
error instantiating
D:\home\dsimcha\bin\test.d(4):        instantiated from here:
ctRegex!("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>")
D:\home\dsimcha\bin\test.d(4): Error: template instance
std.regex.ctRegex!("\\>(wgEncode.*Tfbs.*\\.(?:narrow)|(?:broad)Peak.gz)</a>")
error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-07-05 06:52:37 PDT ---
(In reply to comment #0)
> import std.regex;
> 
> enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>";
> enum peakRegex = ctRegex!(peakRegexStr);
> 
> d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1334): Error: memcpy
> cannot be interpreted at compile time, because it has no available source code
> d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1431):        called from
> here: move(front(src),front(tgt))

Too bad somebody clever enough made std.algorithm.move to use memcpy... and forgot to provide a fallback for CTFE.

We'll have these sort of problems till the day we finally replace ALL of C magic with proper D equivalents. In this case array ops should do just fine (if not faster).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-05 08:41:54 PDT ---
As has been pointed out before, we really should start adding unit tests which verify CTFEability. And honestly, I really think that std.algorithm needs better testing anyway. It's actually pretty poorly tested. For instance, one of the major things that I'd like to do with its tests is make sure that all of it works with reference type ranges. I'm pretty sure that the reality of the matter is that a lot of it doesn't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg@gmail.com


--- Comment #3 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-11-12 10:11:08 MSK ---
Fixed in: https://github.com/D-Programming-Language/phobos/pull/923

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349



--- Comment #4 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-11-30 12:45:28 PST ---
A separate pull for std.regex only: https://github.com/D-Programming-Language/phobos/pull/984

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8349


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #5 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-01 00:15:05 PST ---
https://github.com/D-Programming-Language/phobos/commit/f7a2b9aa78247333e09b8d8237534bcf427f9b67

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------