www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8608] New: CTFE seems to be invoked implicitly(std.parallelism.task)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608

           Summary: CTFE seems to be invoked
                    implicitly(std.parallelism.task)
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: eyyub.pangearaion gmail.com



11:36:58 PDT ---
Hi,

<code>
import std.stdio;
import std.datetime;
import std.parallelism;

void doFor(File file)
{
    static uint n;
        ++n;
    file.writeln("Task n°", n, " begin: ", Clock.currAppTick);
    for(uint i = 0; i < 100; ++i)
    {}
    file.writeln("Task n°", n, " end : ", Clock.currAppTick);
}

void main()
{
    writeln("begin");
    auto file = File("task.txt", "w");
    for(uint i = 0; i < 10; ++i)
    {
        auto test = task!(doFor(file));
        test.executeInNewThread();
    }
    file.close();
    writeln("end");
}
</code>
That code produces this error :

Assertion failed: (v2->hasValue()), function interpret, file interpret.c, line
677.
Abort trap: 6
And, with dustmite, the result is : <code> import std.stdio; import std.parallelism; void doFor(File ) { } void main() { auto file = File; test = task!(doFor(file)); } </code> So, why is CTFE invoked here ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 02 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, ice
                 CC|                            |clugdbug yahoo.com.au



CTFE is invoked because doFor(file) is an expression, and therefore cannot be
an alias. So that's not a bug. The internal compiler error obviously is,
though.
It needs to be reduced a bit further to see what's triggering it.

Partly reduced test case:

import std.stdio;

void task(F)(F fun) {}


void doFor(File ) { }

void main() {
    File file;
    task!(doFor(file));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608




01:58:26 PDT ---

 CTFE is invoked because doFor(file) is an expression
Oh indeed, I didn't notice that...sorry.
The internal compiler error obviously is, though.
Yes, the error is strange. Thanks, -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 03 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D2
            Summary|CTFE seems to be invoked    |ICE(interpret.c): CTFE of
                   |implicitly(std.parallelism. |erroneous struct with
                   |task)                       |postblit



Reduced test case shows it is related to postblit.
-----------------
struct Bug8608{
    this(this) {}
}

void func08(Bug8608 x) { }

void task08(F)(F fun) {}

void bug8608() {
    Bug8608 file;
    task08!(func08(file));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D2                          |D1 & D2
            Summary|ICE(interpret.c): CTFE of   |ICE(interpret.c): CTFE
                   |erroneous struct with       |using runtime variable as
                   |postblit                    |ref parameter



Further reduced. Does not involve postblit, also applies to D1.
--------
void bug8608(ref int m) {}
void test8608()
{
  int z;
  bool foo()
  {
      bug8608(z);
      return true;
  }
  static assert(foo());
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/419ceeed0f56ad23fdd36216ab4763e0d9f148a3
Fix issue 8608 ICE(interpret.c): CTFE using runtime variable as ref parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
            Version|D1 & D2                     |D1



https://github.com/D-Programming-Language/dmd/pull/1130

Fixed in D2 branch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/016aacaf6b97644102e476106092673913431d68


fix Issue 8608 - ICE(interpret.c): CTFE using runtime variable as ref parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 23 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8608


Kenji Hara <k.hara.pg gmail.com> changed:

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


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