Skip to content

Commit

Permalink
Troubleshoot Shippable
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Oct 20, 2019
1 parent 58d15c9 commit a6be4c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dmd/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ struct Compiler
*/
extern (C++) static Expression paintAsType(UnionExp* pue, Expression e, Type type)
{
import core.stdc.stdio : printf;

union U
{
d_int32 int32value;
Expand All @@ -81,6 +83,7 @@ struct Compiler
break;
case Tfloat64:
u.float64value = cast(double) e.toReal();
printf(".: from double: %g\n", u.float64value);
break;
case Tfloat80:
assert(e.type.size() == 8); // 64-bit target `real`
Expand All @@ -99,6 +102,7 @@ struct Compiler

case Tint64:
case Tuns64:
printf(".: to (u)long: %p\n", u.int64value);
emplaceExp!(IntegerExp)(pue, e.loc, u.int64value, type);
break;

Expand Down
2 changes: 2 additions & 0 deletions dmd/constfold.d
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ UnionExp Neg(Type type, Expression e1)
Loc loc = e1.loc;
if (e1.type.isreal())
{
import core.stdc.stdio : printf;
printf(".: negating %Lg to %Lg\n", e1.toReal(), -e1.toReal());
emplaceExp!(RealExp)(&ue, loc, -e1.toReal(), type);
}
else if (e1.type.isimaginary())
Expand Down
3 changes: 2 additions & 1 deletion shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
- secure: RQ6gpJFPBDGVlnz+ZzSgeMpkcnvcA/7Lzyj/r06fMFR5iOz2cYaImCekNRw2PlhYQ+0FCQ119TLMKNOa7OUu6XxUp5LZtq7pSB6QLe3RB3YysFsosNPlY/wyyRsrW9ICEbDP/X8kPcfrDtOPGS/dGIwgeo0+R4Yl0OLDK9GrExEY45bWgvuLqoWDO89pi31kBk5LG5MAYhHZ0UTdboi5A2GRT0T8M0kr53jBRka8FGkbncXfHp9+/6IjTVJoUduRkdsk0A9RN1KRoao6rtrBNNvwIStc6zxJSOHszoaTp/K/ucGC4InZl/9GHPS/Y78SGKn7YJv3tGmcGzqAxrVaXQ==
matrix:
- LLVM_VERSION=9.0.0
HOST_LDC_VERSION=1.14.0
HOST_LDC_VERSION=1.18.0
EXTRA_CMAKE_FLAGS="-DBUILD_LTO_LIBS=ON -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64"

build:
Expand Down Expand Up @@ -59,6 +59,7 @@ build:
-DCOMPILE_ALL_D_FILES_AT_ONCE=OFF
- ninja -j32
- bin/ldc2 --version
- bin/ldc2 -c ../troubleshoot.d
- cd ..
# Build LDC & LDC D unittests
- |
Expand Down
17 changes: 17 additions & 0 deletions troubleshoot.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
int signbit(X)(X x)
{
double dval = cast(double) x; // Precision can increase or decrease but sign won't change (even NaN).
return 0 > *cast(long*) &dval;
}

void main()
{
pragma(msg, signbit(float.nan));
pragma(msg, signbit(-float.nan));

pragma(msg, signbit(double.nan));
pragma(msg, signbit(-double.nan));

pragma(msg, signbit(real.nan));
pragma(msg, signbit(-real.nan));
}

0 comments on commit a6be4c4

Please sign in to comment.