Jump to page: 1 25  
Page
Thread overview
[Issue 2962] New: Assertion in glue.c fails
Aug 14, 2009
Sergey Gromov
Aug 14, 2009
Sergey Gromov
[Issue 2962] ICE(glue.c) or bad codegen passing variable as template value parameter
Aug 14, 2009
Don
Aug 14, 2009
Don
Aug 14, 2009
Don
Aug 14, 2009
Sergey Gromov
Aug 14, 2009
Don
Aug 14, 2009
Sergey Gromov
Aug 14, 2009
Sergey Gromov
Aug 14, 2009
Sergey Gromov
Aug 15, 2009
Don
Sep 10, 2009
Don
Sep 13, 2009
Don
Sep 21, 2009
Don
Oct 13, 2009
Don
Nov 05, 2009
Leandro Lucarella
Dec 01, 2009
David Simcha
Apr 10, 2010
Don
Dec 29, 2010
Haruki Shigemori
Dec 29, 2010
Haruki Shigemori
Dec 29, 2010
Don
Dec 29, 2010
Don
Dec 29, 2010
Haruki Shigemori
Dec 29, 2010
Haruki Shigemori
Jan 30, 2011
Rainer Schuetze
Feb 06, 2011
Rainer Schuetze
Feb 18, 2011
Bernard Helyer
May 23, 2011
Andriy
May 23, 2011
Don
Feb 03, 2012
Don
Mar 22, 2012
dawg@dawgfoto.de
Mar 23, 2012
Don
Apr 25, 2012
Walter Bright
Nov 08, 2012
tmn
Dec 12, 2012
Don
May 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962

           Summary: Assertion in glue.c fails
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: bugzilla@kyllingen.net


Created an attachment (id=358)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=358)
Compile and run this file

While porting a library from D1 to D2 I encountered the following DMD error:

dmd: glue.c:652: virtual void FuncDeclaration::toObjFile(int): Assertion
`!v->csym' failed.
Aborted

It's hard to say what causes the error, but I've been able to narrow it down to a point where almost any change I make makes the error disappear. The source files are attached. (There's four of them, but they are very short.)

To reproduce the error, compile and run the program with rdmd:
    rdmd moduleA.d
Strangely enough, running DMD directly does not reproduce the error:
    dmd moduleA.d moduleB.d moduleC.d moduleD.d
    ./moduleA

For some changes a runtime bug is introduced instead; see the commented section in moduleC.d.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962





--- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net>  2009-05-11 01:57:57 PDT ---
Created an attachment (id=359)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=359)
Imported by moduleA

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962





--- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net>  2009-05-11 01:58:36 PDT ---
Created an attachment (id=360)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=360)
moduleC: imported by moduleB

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962





--- Comment #3 from Lars T. Kyllingstad <bugzilla@kyllingen.net>  2009-05-11 01:59:11 PDT ---
Created an attachment (id=361)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=361)
moduleD: imported by moduleC

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
    Attachment #359|Imported by moduleA         |moduleB: Imported by
        description|                            |moduleA




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Sergey Gromov <snake.scaly@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |snake.scaly@gmail.com
            Version|2.029                       |1.030
         OS/Version|Linux                       |All




--- Comment #4 from Sergey Gromov <snake.scaly@gmail.com>  2009-08-13 18:52:22 PDT ---
Here is a simpler test case for what I think is the same issue:

-----8<----testa.d-----
import testb;

int foo()
{
  return bar(0);
}
-----8<----testa.d-----

-----8<----testb.d-----
T bar(T)(T x)
{
  return baz!(T, x)();
}

T baz(T, T x)()
{
  return x;
}
-----8<----testb.d-----

Compile order matters:

> dmd -c testb.d testa.d
Assertion failure: '!v->csym' on line 563 in file 'glue.c' abnormal program termination
> dmd -c testa.d testb.d
>

Tested this with DMD 1.030, 1.033, 1.041, 1.042, 1.046, 2.026, 2.027 and 2.031, with exactly the same results.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Sergey Gromov <snake.scaly@gmail.com> changed:

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




--- Comment #5 from Sergey Gromov <snake.scaly@gmail.com>  2009-08-13 19:00:24 PDT ---
Sorry, this ICE is definitely on *invalid* code since the baz template is being parametrized on the bar's run-time argument.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, wrong-code
                 CC|                            |clugdbug@yahoo.com.au
            Summary|Assertion in glue.c fails   |ICE(glue.c) or bad codegen
                   |                            |passing variable as
                   |                            |template value parameter
           Severity|normal                      |major




--- Comment #6 from Don <clugdbug@yahoo.com.au>  2009-08-14 00:43:43 PDT ---
Fundamentally this is an accepts-invalid bug, it shouldn't reach the code
generation stage where the ICE occurs. Here's a test case which shouldn't
compile.
There's a chance this could be a regression.

---
T bar(T)(T y) {
  return baz!(T, y)();
}

T baz(T, T z)() {
  return z*z;
}

void main() {
  assert(bar(4)!=0);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962





--- Comment #7 from Don <clugdbug@yahoo.com.au>  2009-08-14 06:04:11 PDT ---
It's definitely not a recent regression, D1.020 behaved the same way.

Probably the same as 2733, (but please DO NOT mark this as a duplicate, this is a much better bug report).

Even smaller test case:

void baz(int z)() {}

void main() {
  int x;
  baz!(x)();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 14, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2962





--- Comment #8 from Don <clugdbug@yahoo.com.au>  2009-08-14 07:30:04 PDT ---
Actually I'm not sure if this a bug or an easter egg. The current behaviour of template value parameters is: if it is a compile-time constant, instantiate the template as a value. If it is a variable, instantiate it as an alias parameter.

That's actually quite cool.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2 3 4 5