www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 228] New: Crash on inferring function literal return type with undefined identifier

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

           Summary: Crash on inferring function literal return type with
                    undefined identifier
           Product: D
           Version: 0.161
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


Either of the following pieces of code causes a crash - no internal error
message, a downright "dmd.exe has encountered a problem".

(I'm tagging this as "ice-on-invalid-code" even though there's no ICE, just a
crash.)

--
void main() {
        x = function(){};
}
--
void main() {
        y = 2;
        auto x = function(){};
}
--

The above examples can, of course, be extended: using any undefined identifier
at some point in the code and then, below that, trying to have a function
literal's return type inferred seems to cause this crash.

The error regarding the identifier is correctly reported prior to the crash, so
the problem can be found and fixed easily, and hence this isn't that bad even
though the compiler does crash.


-- 
Jun 27 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-06-27:
 http://d.puremagic.com/issues/show_bug.cgi?id=228

 Either of the following pieces of code causes a crash - no internal error
 message, a downright "dmd.exe has encountered a problem".

 (I'm tagging this as "ice-on-invalid-code" even though there's no ICE, just a
 crash.)

 --
 void main() {
         x = function(){};
 }
 --
 void main() {
         y = 2;
         auto x = function(){};
 }
 --

 The above examples can, of course, be extended: using any undefined identifier
 at some point in the code and then, below that, trying to have a function
 literal's return type inferred seems to cause this crash.

 The error regarding the identifier is correctly reported prior to the crash, so
 the problem can be found and fixed easily, and hence this isn't that bad even
 though the compiler does crash.

Added to DStress as http://dstress.kuehne.cn/nocompile/d/delegate_18_A.d http://dstress.kuehne.cn/nocompile/d/delegate_18_B.d http://dstress.kuehne.cn/nocompile/f/function_08_A.d http://dstress.kuehne.cn/nocompile/f/function_08_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEo7wR3w+/yD4P9tIRAo0GAJ40r9BS+p+Kykqd4rcmRn31CBUSwQCeL3s2 cj7lBhrmkU6tgqbQA05YTx4= =oeMw -----END PGP SIGNATURE-----
Jun 29 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=228


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Crash on inferring function |Crash on inferring function
                   |literal return type with    |literal return type after
                   |undefined identifier        |prior errors
            Version|0.161                       |0.174




------- Comment #1 from deewiant gmail.com  2006-11-19 05:48 -------
This annoyance takes place with some other errors as well:
--
void main() {
        bool b = 2; // cannot implicitly convert expression (2) of type int to
bool
        auto x = function(){}; // ... and a DMD crash
}
--
deprecated int a;
void main() {
        a = 2; // variable asdf.a is deprecated
        auto x = function(){}; // ... and a DMD crash
}
--
void main() {
        const int a = [2]; // cannot use array to initialize
        auto x = function(){}; // ... and a DMD crash
}
--
const int a; // variable asdf.a missing initializer in static constructor for
const variable
static this() {
}
void main() {
        auto x = function(){}; // ... and a DMD crash
}
--
void f(int i) {}
void main() {
        f(); // expected 1 arguments, not 0
        auto x = function(){}; // ... and a DMD crash
}
--
I'm sure I could find more examples if I felt like it. Still, all errors don't
trigger it:
--
void main() {
        int x;
        auto x = function(){}; // asdf.main.x is already defined
}
--
void main() {
        import auto x = function(){}; // found 'import' instead of statement
}
--
This one was interesting, it triggers only if it's at function scope:
--
void main() {
        void x = function(){}; // variable asdf.main.x voids have no value, DMD
crash
}
--
void x = function(){}; // variable asdf.x voids have no value, DMD doesn't
crash
--


-- 
Nov 19 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=228


bugzilla digitalmars.com changed:

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




------- Comment #2 from bugzilla digitalmars.com  2006-11-25 03:26 -------
Fixed DMD 0.175


-- 
Nov 25 2006