www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6774] New: Assertion failure: '0' on line 1117 in file 'glue.c'

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

           Summary: Assertion failure: '0' on line 1117 in file 'glue.c'
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



16:56:46 PDT ---
This is derived from a ~2000 line module, I'm beat:

import std.traits;

struct PointImpl(T) 
{ 
     property auto test() 
    { 
        return PointImpl!int(); 
    }
}

struct Wrapper(T)
{
    T payload;

    auto test()
    {
        static if (is(ReturnType!(T.test) == void)) { }
        return payload.test;
    }
}

Wrapper!(PointImpl!int) point;

void main()
{
    auto x = point.test;
}


It's hard to explain the point of this code like this, but anyway I get back:
Assertion failure: '0' on line 1117 in file 'glue.c'

If I remove the `static if` statement the assertion goes away. I also had some
Expression assertion errors, but it's too damn tiring to produce a minimal
test-case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6774


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code



Remove dependency to std.traits.

----
private template staticLength(tuple...)
{
    enum size_t staticLength = tuple.length;
}
template ReturnType(func...)
    if (staticLength!(func) == 1)    // (a)
{
    static if (is(typeof(func) R == return))
        alias R ReturnType;
    else
        static assert(0, "argument has no return type");
}

struct PointImpl(T)
{
     property auto test()
    {
        return PointImpl!int();
    }
}

struct Wrapper(T)
{
    T payload;

    auto test()
    {
        //pragma(msg, ReturnType!(T.test));
        //static if (is(ReturnType!(T.test))) { }
        static if (is(ReturnType!(T.test) == void)) { }
        return payload.test;
    }
}

Wrapper!(PointImpl!int) point;

void main()
{
    auto x = point.test;
}
----

A gagged forward reference error at (a) causes this problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6774


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha yahoo.com
            Summary|ICE(glue.c) gagged forward  |ICE(glue.c) totym gagged
                   |reference error             |forward reference error



I just spent a bunch of time reducing a test case only to then stumble on this
duplicate bug.  To add some detail so that anyone who runs into it in the
future can find it, the ICE error message is:

glue.c:1065: virtual unsigned int Type::totym(): Assertion `0' failed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6774




18:55:30 PDT ---
Updates:
OP sample works in 2.057+.

Kenji's sample works in 2.059.

Heywood's sample still ICEs, except it seems to ice regardless of the -g flag:
Assertion failure: '0' on line 1114 in file 'glue.c'

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


Roman D. Boiko <rb d-coding.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rb d-coding.com



struct S(T) {
  pure nothrow static void foo(immutable(T) data) {}
  pure nothrow static void foo(ref immutable(T) data) {}
}
unittest {
  immutable a = 2.0f;
  S!float.foo(a);
}

compiler is run with the following flags:
-m64 -w -debug -gc -fPIC -unittest

on Ubuntu 12.10 x64.

Result:

Error: 2 is not an lvalue
dmd: glue.c:1114: virtual unsigned int Type::totym(): Assertion `0' failed.
Aborted (core dumped)
make: *** [build/client] Error 134

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





 compiler is run with the following flags:
 -m64 -w -debug -gc -fPIC -unittest
Actually, -unittest is enough, other flags don't affect the result. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6774




Reduced test case for comment 5:
----
void foo(T)(ref immutable(T) data) {}

void test6774() {
  immutable a = 2.0f;
  foo!(float)(a);
}

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WORKSFORME



20:26:52 PDT ---

 Reduced test case for comment 5:
 ----
 void foo(T)(ref immutable(T) data) {}
 
 void test6774() {
   immutable a = 2.0f;
   foo!(float)(a);
 }
This compiles without error on 2.064 head. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 05 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6774




06:06:53 PDT ---
Kenji or others, can you confirmed this was deliberately fixed? We should add
it to the test-suite if not (it affects multiple people).

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