www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - roll-up of old bugs: compiler GPF on vararg code

reply Sean Kelly <sean f4.ca> writes:
C:\code\d\bugs>type 101_7.d
// this code causes a compiler GPF

import std.c.stdio;


void ptype( ... )
{
     printf( "%.*s (%.*s)\n", _arguments[0].classinfo.name, 
_arguments[0].classin
fo.base.name );
}


class C {}


void main()
{
     char[] ca;
     wchar[] wa;
     dchar[] da;

     char* cp;
     wchar* wp;
     dchar* dp;

     ptype( ca );
     ptype( wa );
     ptype( da );

     ptype( cp );
     ptype( wp );
     ptype( dp );

     ptype( &ca );
     ptype( &wa );
     ptype( &da );

     int i;
     float f;

     ptype( i );
     ptype( f );

     C c = new C();

     ptype( c );

     long l;

     ptype( l );

     void fn() {}

     ptype( &fn );
}
C:\code\d\bugs>dmd 101_7
Jan 24 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sean Kelly schrieb am 2006-01-24:
 C:\code\d\bugs>type 101_7.d
 // this code causes a compiler GPF

 import std.c.stdio;


 void ptype( ... )
 {
      printf( "%.*s (%.*s)\n", _arguments[0].classinfo.name, 
 _arguments[0].classin
 fo.base.name );
 }


 class C {}


 void main()
 {
      char[] ca;
      wchar[] wa;
      dchar[] da;

      char* cp;
      wchar* wp;
      dchar* dp;

      ptype( ca );
      ptype( wa );
      ptype( da );

      ptype( cp );
      ptype( wp );
      ptype( dp );

      ptype( &ca );
      ptype( &wa );
      ptype( &da );

      int i;
      float f;

      ptype( i );
      ptype( f );

      C c = new C();

      ptype( c );

      long l;

      ptype( l );

      void fn() {}

      ptype( &fn );
 }
 C:\code\d\bugs>dmd 101_7
Can't reproduce this on Linux. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFD1y7K3w+/yD4P9tIRArmtAKCCPqc89Mwye23tL48iDIcwYUc7tgCcDdAH JAEsS/kfW0Y/qlcsLfeFqJ4= =f0mM -----END PGP SIGNATURE-----
Jan 25 2006
parent reply Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
Thomas Kuehne wrote:
 Sean Kelly schrieb am 2006-01-24:
 C:\code\d\bugs>type 101_7.d
 // this code causes a compiler GPF

 import std.c.stdio;


 void ptype( ... )
 {
      printf( "%.*s (%.*s)\n", _arguments[0].classinfo.name, 
 _arguments[0].classin
 fo.base.name );
 }


 class C {}


 void main()
 {
      char[] ca;
      wchar[] wa;
      dchar[] da;

      char* cp;
      wchar* wp;
      dchar* dp;

      ptype( ca );
      ptype( wa );
      ptype( da );

      ptype( cp );
      ptype( wp );
      ptype( dp );

      ptype( &ca );
      ptype( &wa );
      ptype( &da );

      int i;
      float f;

      ptype( i );
      ptype( f );

      C c = new C();

      ptype( c );

      long l;

      ptype( l );

      void fn() {}

      ptype( &fn );
 }
 C:\code\d\bugs>dmd 101_7
Can't reproduce this on Linux. Thomas
Nor I, on Windows. Compiled and ran fine in both DMD 0.142 and 0.144.
Jan 25 2006
parent reply Sean Kelly <sean f4.ca> writes:
Deewiant wrote:
 Thomas Kuehne wrote:
 Sean Kelly schrieb am 2006-01-24:
 C:\code\d\bugs>type 101_7.d
 // this code causes a compiler GPF

 import std.c.stdio;


 void ptype( ... )
 {
      printf( "%.*s (%.*s)\n", _arguments[0].classinfo.name, 
 _arguments[0].classin
 fo.base.name );
 }


 class C {}


 void main()
 {
      char[] ca;
      wchar[] wa;
      dchar[] da;

      char* cp;
      wchar* wp;
      dchar* dp;

      ptype( ca );
      ptype( wa );
      ptype( da );

      ptype( cp );
      ptype( wp );
      ptype( dp );

      ptype( &ca );
      ptype( &wa );
      ptype( &da );

      int i;
      float f;

      ptype( i );
      ptype( f );

      C c = new C();

      ptype( c );

      long l;

      ptype( l );

      void fn() {}

      ptype( &fn );
 }
 C:\code\d\bugs>dmd 101_7
Can't reproduce this on Linux.
Nor I, on Windows. Compiled and ran fine in both DMD 0.142 and 0.144.
Weird. It even crashes DMD if I remove the stdio import and printf call, which should eliminate Ares as the cause. This is with 0.144 for me. To me sure it wasn't a UTF issue, I retyped a trimmed down example into a different file. It seems like it's happening if I pass a pointer or class reference to a vararg function: void ptype( ... ) {} void main() { void fn() {} ptype( &fn ); } I'll reinstall DMD and go from there. Sean
Jan 25 2006
parent Sean Kelly <sean f4.ca> writes:
I was wrong, Ares is the cause.  It appears that DMD has begun to 
require TypeInfo classes to be declared in object.d.  I'll fix it on my end.


Sean
Jan 25 2006