Thread overview
[Issue 8608] New: CTFE seems to be invoked implicitly(std.parallelism.task)
Sep 02, 2012
Eyyüb Sari
Sep 03, 2012
Don
Sep 03, 2012
Eyyüb Sari
[Issue 8608] ICE(interpret.c): CTFE of erroneous struct with postblit
Sep 10, 2012
Don
[Issue 8608] ICE(interpret.c): CTFE using runtime variable as ref parameter
Sep 20, 2012
Don
Sep 21, 2012
Kenji Hara
Sep 24, 2012
Kenji Hara
September 02, 2012
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


--- Comment #0 from Eyyüb Sari <eyyub.pangearaion@gmail.com> 2012-09-02 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: -------
September 03, 2012
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


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2012-09-03 00:45:07 PDT ---
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: -------
September 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8608



--- Comment #2 from Eyyüb Sari <eyyub.pangearaion@gmail.com> 2012-09-03 01:58:26 PDT ---
(In reply to comment #1)
> 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: -------
September 10, 2012
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


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2012-09-10 01:03:22 PDT ---
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: -------
September 20, 2012
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


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2012-09-20 00:07:25 PDT ---
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: -------
September 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8608



--- Comment #5 from github-bugzilla@puremagic.com 2012-09-21 08:34:41 PDT ---
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: -------
September 21, 2012
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


--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-21 09:00:27 PDT ---
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: -------
September 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8608



--- Comment #7 from github-bugzilla@puremagic.com 2012-09-23 15:41:48 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/016aacaf6b97644102e476106092673913431d68 merge D2 pull #1130

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: -------
September 24, 2012
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: -------