Bug 23056 – importC: dmd asserts for missing return statement in CTFE function

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-24T23:17:11Z
Last change time
2022-05-05T21:04:20Z
Keywords
CTFE, ImportC, pull
Assigned to
No Owner
Creator
duser

Comments

Comment #0 by duser — 2022-04-24T23:17:11Z
affects C files only, maybe they have some error turned off int test(void){} _Static_assert(test(), ""); core.exception.AssertError@src/dmd/dinterpret.d(698): Assertion failure ---------------- ??:? _d_assertp [0x90fba1] src/dmd/dinterpret.d:698 dmd.expression.Expression dmd.dinterpret.interpretFunction(dmd.expression.UnionExp*, dmd.func.FuncDeclaration, dmd.dinterpret.InterState*, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.expression.Expression) [0x66160e] src/dmd/dinterpret.d:4922 _ZN11Interpreter5visitEP7CallExp [0x66da82] src/dmd/expression.d:5152 _ZN7CallExp6acceptEP7Visitor [0x6de081] src/dmd/dinterpret.d:6380 dmd.expression.Expression dmd.dinterpret.interpret(dmd.expression.UnionExp*, dmd.expression.Expression, dmd.dinterpret.InterState*, dmd.dinterpret.CTFEGoal) [0x6725bc] src/dmd/dinterpret.d:6390 dmd.expression.Expression dmd.dinterpret.interpret(dmd.expression.Expression, dmd.dinterpret.InterState*, dmd.dinterpret.CTFEGoal) [0x672615] src/dmd/dinterpret.d:100 dmd.expression.Expression dmd.dinterpret.ctfeInterpret(dmd.expression.Expression) [0x65f482] src/dmd/expression.d:1602 _ZN10Expression13ctfeInterpretEv [0x6d5998] src/dmd/staticcond.d:109 bool dmd.staticcond.evalStaticCondition(dmd.dscope.Scope*, dmd.expression.Expression, dmd.expression.Expression, out bool, dmd.root.array.Array!(dmd.expression.Expression).Array*).impl(dmd.expression.Expression) [0x79a694] src/dmd/staticcond.d:123 bool dmd.staticcond.evalStaticCondition(dmd.dscope.Scope*, dmd.expression.Expression, dmd.expression.Expression, out bool, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x79a443] src/dmd/semantic2.d:103 _ZN16Semantic2Visitor5visitEP12StaticAssert [0x77d139] src/dmd/staticassert.d:69 _ZN12StaticAssert6acceptEP7Visitor [0x79a3f6] src/dmd/semantic2.d:79 _Z9semantic2P7DsymbolP5Scope [0x77d069] src/dmd/semantic2.d:525 _ZN16Semantic2Visitor5visitEP17AttribDeclaration [0x77e21a] src/dmd/parsetimevisitor.d:71 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP15LinkDeclaration [0x779c9e] src/dmd/attrib.d:433 _ZN15LinkDeclaration6acceptEP7Visitor [0x61ed99] src/dmd/semantic2.d:79 _Z9semantic2P7DsymbolP5Scope [0x77d069] src/dmd/semantic2.d:339 _ZN16Semantic2Visitor5visitEP6Module [0x77db3e] src/dmd/dmodule.d:1452 _ZN6Module6acceptEP7Visitor [0x67d239] src/dmd/semantic2.d:79 _Z9semantic2P7DsymbolP5Scope [0x77d069] src/dmd/mars.d:460 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x607e78] src/dmd/mars.d:958 _Dmain [0x609abd] line numbers at commit 035a9efa1c404c90e5c0140f939cb02d02f1cc15
Comment #1 by bugzilla — 2022-04-29T16:57:43Z
Yes, I did turn off return statement checks due to another bug report that C compilers allowed them :-)
Comment #2 by dlang-bot — 2022-04-29T17:13:54Z
@WalterBright created dlang/dmd pull request #14043 "fix Issue 23056 - importC: dmd asserts for missing return statement i…" fixing this issue: - fix Issue 23056 - importC: dmd asserts for missing return statement in CTFE function https://github.com/dlang/dmd/pull/14043
Comment #3 by dlang-bot — 2022-04-29T18:27:58Z
dlang/dmd pull request #14043 "fix Issue 23056 - importC: dmd asserts for missing return statement i…" was merged into master: - 6b61081af064560482d9a2d2f1631f2a7e091dd5 by Walter Bright: fix Issue 23056 - importC: dmd asserts for missing return statement in CTFE function https://github.com/dlang/dmd/pull/14043
Comment #4 by dlang-bot — 2022-05-01T15:40:47Z
dlang/dmd pull request #14053 "fix Issue 23056 - importC: dmd asserts for missing return statement in CTFE function" was merged into stable: - 4c9f5454aabada0a1ddb9a6bc7367bd6021e0fa0 by Walter Bright: fix Issue 23056 - importC: dmd asserts for missing return statement in CTFE function https://github.com/dlang/dmd/pull/14053
Comment #5 by dlang-bot — 2022-05-05T21:04:20Z
dlang/dmd pull request #14064 "merge stable" was merged into master: - 9e266aac1967182a48f12b8fc50b26714de826a4 by Walter Bright: fix Issue 23056 - importC: dmd asserts for missing return statement in CTFE function https://github.com/dlang/dmd/pull/14064