Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/dmd/backend/elfobj.d
Original file line number Diff line number Diff line change
Expand Up @@ -1959,9 +1959,12 @@ private int elf_addsegment2(IDXSEC shtidx, IDXSYM symidx, IDXSEC relidx)
}
assert(seg_count < seg_max);
if (!SegData[seg])
{ SegData[seg] = cast(seg_data *)mem_calloc((seg_data).sizeof);
{
SegData[seg] = cast(seg_data *)mem_calloc(seg_data.sizeof);
//printf("test2: SegData[%d] = %p\n", seg, SegData[seg]);
}
else
memset(SegData[seg], 0, seg_data.sizeof);

seg_data *pseg = SegData[seg];
pseg.SDseg = seg;
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/semantic3.d
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
if (auto s = funcdecl.fensure.isScopeStatement())
fensure_endlin = s.endloc.linnum;

if ((needEnsure && global.params.useOut) || fpostinv)
if ((needEnsure && global.params.useOut == CHECKENABLE.on) || fpostinv)
{
funcdecl.returnLabel = new LabelDsymbol(Id.returnLabel);
}
Expand Down Expand Up @@ -903,7 +903,7 @@ private extern(C++) final class Semantic3Visitor : Visitor

sc2 = sc2.pop();

if (!global.params.useIn)
if (global.params.useIn == CHECKENABLE.off)
freq = null;
}
if (fens)
Expand Down Expand Up @@ -937,7 +937,7 @@ private extern(C++) final class Semantic3Visitor : Visitor

sc2 = sc2.pop();

if (!global.params.useOut)
if (global.params.useOut == CHECKENABLE.off)
fens = null;
}
if (funcdecl.fbody && funcdecl.fbody.isErrorStatement())
Expand Down
12 changes: 12 additions & 0 deletions test/runnable/extra-files/lib18456b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module manual;

class ManualGC {
void enable()
{
}

void disable()
{
}

}
2 changes: 1 addition & 1 deletion test/runnable/test16096.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [ "$OS" != 'osx' ] || [ "$MODEL" != '64' ]; then
fi

$DMD -I${EXTRA_FILES} -of${OUTPUT_BASE}${LIBEXT} -lib ${EXTRA_FILES}/test16096a.d
$DMD -I${EXTRA_FILES} -of${OUTPUT_BASE}${EXT} ${EXTRA_FILES}/test16096.d ${OUTPUT_BASE}${LIBEXT} -L-framework -LFoundation
$DMD -I${EXTRA_FILES} -of${OUTPUT_BASE}${EXE} ${EXTRA_FILES}/test16096.d ${OUTPUT_BASE}${LIBEXT} -L-framework -LFoundation
${OUTPUT_BASE}${EXE}

rm ${OUTPUT_BASE}{${LIBEXT},${EXE}}
3 changes: 2 additions & 1 deletion test/runnable/test18456.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${LIBEXT} -lib ${EXTRA_FILES}/lib18456.d
# source file order is important
$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${LIBEXT} -lib ${EXTRA_FILES}/lib18456b.d ${EXTRA_FILES}/lib18456.d
$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${EXE} ${EXTRA_FILES}/test18456.d ${OUTPUT_BASE}${LIBEXT}
${OUTPUT_BASE}${EXE}

Expand Down
38 changes: 38 additions & 0 deletions test/runnable/test_dip1006.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// REQUIRED_ARGS: -check=in=off -check=out=off -check=invariant=off
// PERMUTE_ARGS:
class C
{
int foo(int a)
in { assert(a != 0); } // skipped
out(res) { assert(res != 0); } // skipped
body
{
return a;
}

invariant // skipped
{
assert(false);
}

void bar(int a)
{
assert(a != 0); // triggered
}
}

void main()
{
import core.exception : AssertError;

auto c = new C;
c.foo(0);

bool catched;
try
c.bar(0);
catch (AssertError e)
catched = true;
if (!catched)
assert(0);
}
35 changes: 35 additions & 0 deletions test/runnable/test_dip1006b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// REQUIRED_ARGS: -check=in=off -check=invariant=off
// PERMUTE_ARGS:
class C
{
int foo(int a)
in { assert(a != 0); } // skipped
out(res) { assert(res != 0, "out"); } // triggered
body
{
return a;
}

invariant // skipped
{
assert(false);
}
}

void main()
{
import core.exception : AssertError;

auto c = new C;
bool catched;
try
c.foo(0);
catch (AssertError e)
{
assert(e.msg == "out");
catched = e.msg == "out";
}

if (!catched)
assert(0);
}