Segfault when using const value as argument for macro function.
tobilinz opened this issue · 4 comments
tobilinz commented
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?
- Create a new bun project using
bun init -y
- Paste the following code into
index.ts
:
import { myMacro } from './other' with { type: 'macro' };
const test = 'Hello World ';
console.log(myMacro(test));
- Paste the following code into a new file called
other.ts
:
export function myMacro(value: string): string {
return value + "and Bun!";
}
- 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 commented
I accidentally closed it.
maxmilton commented
Possibly related: #3832 and #3830 (comment)