Bug 11906 – Compiler assertion when comparing function pointers

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-01-11T15:30:00Z
Last change time
2014-04-10T08:23:12Z
Keywords
ice, pull
Assigned to
nobody
Creator
cameron_shea

Comments

Comment #0 by cameron_shea — 2014-01-11T15:30:04Z
module main; import std.c.windows.windows; void main() { extern(Windows) HMODULE function(LPCSTR) f; assert(f != &GetModuleHandleA); } > dmd -g -debug -c main.d -ofobj\Debug\main.obj Assertion failure: '0' on line 1562 in file 'cast.c'
Comment #1 by cameron_shea — 2014-01-11T15:33:03Z
DMD32 D Compiler v2.064
Comment #2 by k.hara.pg — 2014-04-10T07:33:47Z
Comment #3 by github-bugzilla — 2014-04-10T08:23:11Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7444be452ddf43ce2e1227427ccf67b3de620b01 fix Issue 11906 - Compiler assertion when comparing function pointers If `f->isImportedSymbol()` is true, the translation from `AddrExp(VarExp(f))` to `SymOffExp(f)` in `AddrExp::optimize` will be skipped. Therefore, the assertion is just wrong. https://github.com/D-Programming-Language/dmd/commit/12595153fac365d86d94b6686601ad5bbca739b9 Merge pull request #3445 from 9rnsr/fix11906 Issue 11906 - Compiler assertion when comparing function pointers