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

Function pointers don't work on Harvard architechture #4432

Closed
dukc opened this issue Jul 8, 2023 · 1 comment
Closed

Function pointers don't work on Harvard architechture #4432

dukc opened this issue Jul 8, 2023 · 1 comment

Comments

@dukc
Copy link
Contributor

dukc commented Jul 8, 2023

Compile this with flags -betterC -mtriple=avr -mcpu=atmega328p --gcc=avr-gcc --Xcc=-mmcu=atmega328p

void function() fPtr;

extern(C) void main()
{   fPtr = {fPtr = null;};
}

Results in (stack trace omitted):

Invalid bitcast
void ()* bitcast (void () addrspace(1)* @_D5delay4mainUZ9__lambda1FNbNiNfZv to void ()*)
in function main
LLVM ERROR: Broken function found, compilation aborted!

Tested version 1.30.0.

kinke added a commit to kinke/ldc that referenced this issue Aug 5, 2023
Resolves issue ldc-developers#4432 by setting the address space of such IR pointers.
@kinke
Copy link
Member

kinke commented Aug 16, 2023

Fixed by #4465.

@kinke kinke closed this as completed Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants