|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.bugs - [Issue 3077] New: crash exiting main() without result code
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Summary: crash exiting main() without result code Product: D Version: unspecified Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrei metalanguage.com int main(string[] args) { try {} catch(Exception) { return 1; } } Running this program will cause a segmentation fault. Adding a return 0; at the end fixes it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- Jun 18 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2009-06-23 11:05:23 PDT --- I get the message: core.exception.AssertError test.d(4): missing return expression Is that different from the one you get? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- Jun 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 --- Comment #2 from Andrei Alexandrescu <andrei metalanguage.com> 2009-06-23 11:08:15 PDT --- (In reply to comment #1)I get the message: core.exception.AssertError test.d(4): missing return expression Is that different from the one you get? Jun 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2009-06-23 13:15:25 PDT --- If main() was typed to return a void, as a special case then the compiler will insert a: return 0; statement at the end. But if a function is typed to return an int, then that's a contract saying the programmer must put in some sort of return statement. If there is none, the compiler inserts a: assert(0, "missing return expression"); at the end. If you compile with -w, the compiler will warn you about this. (The compiler doesn't always do this because it is perfectly legal for a function that is typed to return an int to never return, such as if it calls abort().) When compiling in release mode, assert(0) is replaced with a HLT instruction, which generates a hardware exception at runtime. This is what you're seeing. It's expected behavior. Not a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- Jun 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | --- Comment #4 from Andrei Alexandrescu <andrei metalanguage.com> 2009-06-23 15:57:19 PDT --- (In reply to comment #3) Jun 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Koroskin Denis <2korden gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |2korden gmail.com Severity|normal |enhancement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- Jun 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3077 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #5 from Walter Bright <bugzilla digitalmars.com> 2009-09-03 13:39:14 PDT --- Fixed dmd 2.032 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- Sep 03 2009
|