Bug 24881 – ICE on attempt to compare deref of two functions ptr

Status
NEW
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-11-25T19:35:44Z
Last change time
2024-12-13T19:38:46Z
Keywords
accepts-invalid, ice
Assigned to
No Owner
Creator
basile-z
Moved to GitHub: dmd#18281 →

Comments

Comment #0 by b2.temp — 2024-11-25T19:35:44Z
The following input ``` void function(int) a; void function(int) b; void main() { const c = *a == *b; // assert(*a); // rejected during sema } ``` crashes dmd in the backend: > TYD func > > Program received signal SIGILL, Illegal instruction. > 0x00005555559d1756 in dmd.backend.cod3.jmpopcode(dmd.backend.el.elem*) () I think however that the program is semantically invalid and should be rejected during exp-semantics, just like the commented assertion is.
Comment #1 by b2.temp — 2024-11-25T19:46:36Z
Seems to happen only with `is`, comparisons, and relationals operators.
Comment #2 by b2.temp — 2024-11-29T09:27:47Z
LDC2 crashes too since v1.35. Previously it generated bad code for `c` (see https://godbolt.org/z/cEM1MEevE), i.e `true` whatever the functions were pointing to.
Comment #3 by robert.schadek — 2024-12-13T19:38:46Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18281 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB