www.digitalmars.com         C & C++   DMDScript  

D - Bug: Segfault when trying to get a pointer to a non-existent func

reply Russell Lewis <spamhole-2001-07-16 deming-os.org> writes:
The code below is obviously a syntax error.  The compiler (DLI 0.1.1) 
recognizes that the identifier doesn't exist, but then later crashes.

   int main() {
     void (*callback)(int) = &NoSuchFunc;
     return 0;
   }
Oct 03 2002
parent reply Burton Radons <loth users.sourceforge.net> writes:
Russell Lewis wrote:
 The code below is obviously a syntax error.  The compiler (DLI 0.1.1) 
 recognizes that the identifier doesn't exist, but then later crashes.
 
   int main() {
     void (*callback)(int) = &NoSuchFunc;
     return 0;
   }

That's my way of giving multiple error messages - I don't exit on the first one. Since DMD expects that the error function exits the program, it often does things like sets objects to NULL that it later calls. I need to go through the code some time, identify all the errors, and make sure it doesn't destroy itself. It's on the TODO.
Oct 03 2002
parent Russell Lewis <spamhole-2001-07-16 deming-os.org> writes:
Burton Radons wrote:
 Russell Lewis wrote:
 
 The code below is obviously a syntax error.  The compiler (DLI 0.1.1) 
 recognizes that the identifier doesn't exist, but then later crashes.

   int main() {
     void (*callback)(int) = &NoSuchFunc;
     return 0;
   }

That's my way of giving multiple error messages - I don't exit on the first one. Since DMD expects that the error function exits the program, it often does things like sets objects to NULL that it later calls. I need to go through the code some time, identify all the errors, and make sure it doesn't destroy itself. It's on the TODO

k. I'll make a mental note not to report any more "second errors" as bugs. Hope I don't lose it. Huh? What were we talking about again? :p
Oct 03 2002