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 on attempt to compare deref of two functions ptr #18281

Open
dlangBugzillaToGithub opened this issue Nov 25, 2024 · 2 comments
Open

ICE on attempt to compare deref of two functions ptr #18281

dlangBugzillaToGithub opened this issue Nov 25, 2024 · 2 comments
Labels
Compiler:Backend glue code, optimizer, code generation Severity:critical Severity:ICE Internal Compiler Error

Comments

@dlangBugzillaToGithub
Copy link

basile-z reported this on 2024-11-25T19:35:44Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24881

Description

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.
@dlangBugzillaToGithub
Copy link
Author

b2.temp commented on 2024-11-25T19:46:36Z

Seems to happen only with `is`, comparisons, and relationals operators.

@dlangBugzillaToGithub
Copy link
Author

b2.temp commented on 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.

@thewilsonator thewilsonator added Compiler:Backend glue code, optimizer, code generation Severity:ICE Internal Compiler Error and removed OS:Linux Arch:x86_64 Issues specific to x86_64 P1 labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler:Backend glue code, optimizer, code generation Severity:critical Severity:ICE Internal Compiler Error
Projects
None yet
Development

No branches or pull requests

2 participants