Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE / segmentation fault (-11) regression #3114

Closed
fyfrey opened this issue Jul 23, 2019 · 2 comments
Closed

ICE / segmentation fault (-11) regression #3114

fyfrey opened this issue Jul 23, 2019 · 2 comments

Comments

@fyfrey
Copy link

fyfrey commented Jul 23, 2019

Hi,

the following code snippet works fine in LDC 1.15 and DMD 2.087, but fails to compile with 1.16. Successfully reduced with dustmite from a larger code base:

import std.getopt;
import std.stdio;
import std.format;
void foo() {
    GetoptResult result;
    return defaultGetoptFormatter(stderr.lockingTextWriter, format!"%s"("hi"), result.options);
}
void main(){foo();}

trace:

/dlang/ldc-1.16.0/bin/ldc2(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x2a)[0x2d7be5a]
/dlang/ldc-1.16.0/bin/ldc2(_ZN4llvm3sys17RunSignalHandlersEv+0x4c)[0x2d79ddc]
/dlang/ldc-1.16.0/bin/ldc2[0x2d79f47]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f0dd4123890]
/dlang/ldc-1.16.0/bin/ldc2(_Z9DtoAssignR3LocP6DValueS2_ib+0xb4)[0xdd3dc4]
/dlang/ldc-1.16.0/bin/ldc2[0xe07a2e]
/dlang/ldc-1.16.0/bin/ldc2[0xe08899]
/dlang/ldc-1.16.0/bin/ldc2[0xe08899]
/dlang/ldc-1.16.0/bin/ldc2(_Z14Statement_toIRP9StatementP7IRState+0x2a)[0xe05dba]
/dlang/ldc-1.16.0/bin/ldc2(_Z17DtoDefineFunctionP15FuncDeclarationb+0xd04)[0xdca8d4]
/dlang/ldc-1.16.0/bin/ldc2(_Z19Declaration_codegenP7Dsymbol+0x31)[0xdbc231]
/dlang/ldc-1.16.0/bin/ldc2(_Z13codegenModuleP7IRStateP6Module+0xe5)[0xde0de5]
/dlang/ldc-1.16.0/bin/ldc2(_ZN3ldc13CodeGenerator4emitEP6Module+0xdc)[0xe9d75c]
/dlang/ldc-1.16.0/bin/ldc2(_Z14codegenModulesR5ArrayIP6ModuleE+0x14c)[0xe6e01c]
/dlang/ldc-1.16.0/bin/ldc2(_Z13mars_mainBodyR5ParamR5ArrayIPKcES5_+0x1507)[0xc4bd27]
/dlang/ldc-1.16.0/bin/ldc2(_Z7cppmainiPPc+0x17e6)[0xe6ca16]
/dlang/ldc-1.16.0/bin/ldc2(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv+0x50)[0x2fbf240]
/dlang/ldc-1.16.0/bin/ldc2(_d_run_main+0x218)[0x2fbf058]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f0dd33cab97]
/dlang/ldc-1.16.0/bin/ldc2(_start+0x29)[0xb5ba09]
Error: Error executing /dlang/ldc-1.16.0/bin/ldc2: Segmentation fault (core dumped)

the above example code compiles without error when removing the return in foo or if format!"%s"("hi") is replaced with a string literal.

Many thanks for looking into this!

@kinke
Copy link
Member

kinke commented Jul 23, 2019

This is almost certainly a duplicate of #3094 and should thus already be fixed in master. Can be verified with a CI package from https://github.com/ldc-developers/ldc/releases/tag/CI.

@fyfrey
Copy link
Author

fyfrey commented Jul 23, 2019

It is fixed in a recent CI build.

@fyfrey fyfrey closed this as completed Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants