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

Segfault when using const value as argument for macro function. #6014

Closed
tobilinz opened this issue Sep 24, 2023 · 4 comments
Closed

Segfault when using const value as argument for macro function. #6014

tobilinz opened this issue Sep 24, 2023 · 4 comments
Labels
bug Something isn't working bundler Something to do with the bundler crash An issue that could cause a crash

Comments

@tobilinz
Copy link

What version of Bun is running?

1.0.3

What platform is your computer?

Linux 6.5.3-arch1-1 x86_64 unknown

What steps can reproduce the bug?

  1. Create a new bun project using bun init -y
  2. Paste the following code into index.ts:
import { myMacro } from './other' with { type: 'macro' };
const test = 'Hello World ';
console.log(myMacro(test));
  1. Paste the following code into a new file called other.ts:
export function myMacro(value: string): string {
  return value + "and Bun!";
}
  1. Run bun build ./index.ts

What is the expected behavior?

Console output:

// index.ts
console.log("Hello World and Bun!");

What do you see instead?

Console output:
[1] 27447 segmentation fault (core dumped) bun build ./index.ts

Additional information

This bug also occurs when importing a const from another file or importing the content of a .txt* file and using it as input for a macro function.

  • .wgsl files also cause this behavior. Other file types have not been tested.
@tobilinz tobilinz added the bug Something isn't working label Sep 24, 2023
@tobilinz tobilinz reopened this Sep 24, 2023
@tobilinz
Copy link
Author

I accidentally closed it.

@Electroid Electroid added crash An issue that could cause a crash bundler Something to do with the bundler labels Sep 25, 2023
@maxmilton
Copy link
Contributor

maxmilton commented Sep 30, 2023

Possibly related: #3832 and #3830 (comment)

@Electroid
Copy link
Contributor

Closed by #6756

@maxmilton
Copy link
Contributor

As mentioned in #3830 the segfault is now correctly handled, however there's still an issue with handling certain values in macros. Not sure this should be closed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler crash An issue that could cause a crash
Projects
None yet
Development

No branches or pull requests

3 participants