www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10345] New: Segfault on simple main() with -release

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

           Summary: Segfault on simple main() with -release
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: justin economicmodeling.com


--- Comment #0 from Justin Whear <justin economicmodeling.com> 2013-06-12
11:50:17 PDT ---
Using dmd 2.063:

void main()
{
    assert(false, "Uhoh");
}

Compiling with -release and running segfaults (tested on linux).  Compiling
without -release and running produces the expected AssertError.

Expected behavior with -release is an effectively empty main().

Examining the core dump:
-----------------------------------------------
Core was generated by `./test_assert'.
Program terminated with signal 11, Segmentation fault.
#0  D main () at test_assert.d:3
3        assert(false, "Uhoh");
(gdb) bt
#0  D main () at test_assert.d:3
#1  0x0000000000417e00 in rt.dmain2._d_run_main() ()
#2  0x0000000000417932 in rt.dmain2._d_run_main() ()
#3  0x0000000000417e50 in rt.dmain2._d_run_main() ()
#4  0x0000000000417932 in rt.dmain2._d_run_main() ()
#5  0x00000000004178ee in _d_run_main ()
#6  0x000000000041773b in main ()
-----------------------------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10345


David Nadlinger <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |code klickverbot.at
         Resolution|                            |INVALID


--- Comment #1 from David Nadlinger <code klickverbot.at> 2013-06-12 11:53:44
PDT ---
assert(false) is turned into a halt/abort in release mode.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10345



--- Comment #2 from Justin Whear <justin economicmodeling.com> 2013-06-12
11:57:56 PDT ---
My bad.  This special case is documented here:
http://dlang.org/expression.html#AssertExpression

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2013