www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 100] New: Assert statement error

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

           Summary: Assert statement error
           Product: D
           Version: 0.153
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dronten gmail.com


assert statements is not behaving as they used to do.
Here is a short test program.

gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu3)
Linux ubuntu 2.6.15-18-686 #1 SMP PREEMPT Thu Mar 9 15:29:22 UTC 2006 i686
GNU/Linux

#!/bin/rdmd
import std.stdio;

void main() {
    char[] a = "";
    try {
        if (a.length != 66) {
            writefln("ASSERT NOW");
            assert(false);
        }
        writefln("What the f...");
    }
    catch {
        writefln("catch");
    }
}

--- Test run 1
~/Documents/src/d/test: dmd ass.d
gcc ass.o -o ass -lphobos -lpthread -lm -Xlinker --gc-sections
~/Documents/src/d/test: ./ass
ASSERT NOW
Segmentation fault


--- Test run 2
~/Documents/src/d/test: dmd -g ass.d
gcc ass.o -o ass -g -lphobos -lpthread -lm -Xlinker --gc-sections
~/Documents/src/d/test: ./ass
ASSERT NOW
What the f...


--- Test run 3 (with rdmd)
~/Documents/src/d/test: ./ass.d
ASSERT NOW


---Test run 4 (dmd 1.50)
~/Documents/src/d/test: dmd -g ass.d
gcc ass.o -o ass -g -lphobos -lpthread -lm
~/Documents/src/d/test: ./ass
ASSERT NOW
catch


-- 
Apr 11 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
When I run it, it works fine. I suggest trying to link without the 
--gc-sections flag, maybe that is causing the problem.
Apr 11 2006
parent reply Tom S <h3r3tic -remove-.mat.uni.torun.pl> writes:
Exception handling doesn't work on Linux when linking with --gc-sections.


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/
Apr 11 2006
parent Walter Bright <newshound digitalmars.com> writes:
Tom S wrote:
 Exception handling doesn't work on Linux when linking with --gc-sections.

That's not good news. Sigh.
Apr 12 2006