Bug 22577 – ImportC: decay of function to typedef'd const function pointer causes ICE.

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-12-07T08:07:58Z
Last change time
2021-12-12T08:12:08Z
Keywords
ice, ice-on-valid-code, ImportC, pull
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2021-12-07T08:07:58Z
The following C program triggers an ICE: --- typedef int(IntFunc)(void); int one(void){ return 1; } // Ok: // int(*const func)(void) = one // Also Ok: // IntFunc* func = one; // Also Ok: // IntFunc* const func = &one; // This causes an ICE IntFunc* const func = one; --- ERROR: This is a compiler bug. Please report it via https://issues.dlang.org/enter_bug.cgi with, preferably, a reduced, reproducible example and the information below. DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction. --- DMD v2.098.0-76-g9dc7b9cea predefs DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 linux CRuntime_Glibc CppRuntime_ Gcc D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary generated/linux/release/64/dmd version v2.098.0-76-g9dc7b9cea config generated/linux/release/64/dmd.conf DFLAGS -Igenerated/linux/release/64/../../../../../druntime/import -Igenerated/linux/release/64/.. /../../../../phobos -L-Lgenerated/linux/release/64/../../../../../phobos/generated/linux/release/64 - L--export-dynamic -fPIC --- core.exception.AssertError@src/dmd/dcast.d(1030): Assertion failure ---------------- ??:? [0x563a6ef04c85] ??:? [0x563a6ef2d006] ??:? [0x563a6ef0d70f] ??:? [0x563a6ef03dd7] src/dmd/dcast.d:1030 [0x563a6ed83bba] src/dmd/expression.d:5261 [0x563a6ecd52d7] src/dmd/dcast.d:1475 [0x563a6ecce14b] src/dmd/expression.d:1031 [0x563a6eb3384c] src/dmd/initsem.d:426 [0x563a6ec6edbc] src/dmd/initsem.d:887 [0x563a6eba2728] src/dmd/dsymbolsem.d:1125 [0x563a6ed1675d] src/dmd/declaration.d:1637 [0x563a6ed7cb97] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/dsymbolsem.d:1428 [0x563a6ed186cf] src/dmd/dsymbolsem.d:1440 [0x563a6ed1876c] src/dmd/parsetimevisitor.d:71 [0x563a6eb34264] src/dmd/attrib.d:433 [0x563a6eda54f7] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/dsymbolsem.d:1956 [0x563a6ed1afca] src/dmd/dsymbol.d:104 [0x563a6eb2e94f] src/dmd/dsymbolsem.d:1953 [0x563a6ed1af38] src/dmd/dmodule.d:1542 [0x563a6ec5d0e7] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/mars.d:474 [0x563a6edb260e] src/dmd/mars.d:1027 [0x563a6edbbf94] ??:? [0x563a6ef0d3f7] ??:? [0x563a6ef0d2f4] ??:? [0x563a6ef0d14d] src/dmd/mars.d:983 [0x563a6edbbf38] ??:? __libc_start_main [0x7fedde2c50b2] ??:? [0x563a6eb1edfd]
Comment #1 by dlang-bot — 2021-12-11T09:01:55Z
@WalterBright created dlang/dmd pull request #13412 "fix Issue 22577 - ImportC: decay of function to typedef'd const funct…" fixing this issue: - fix Issue 22577 - ImportC: decay of function to typedef'd const function pointer causes ICE https://github.com/dlang/dmd/pull/13412
Comment #2 by dlang-bot — 2021-12-12T08:12:08Z
dlang/dmd pull request #13412 "fix Issue 22577 - ImportC: decay of function to typedef'd const funct…" was merged into stable: - a4c4408fdd1a536ba879fb4d726bd4a39130bd1c by Walter Bright: fix Issue 22577 - ImportC: decay of function to typedef'd const function pointer causes ICE https://github.com/dlang/dmd/pull/13412