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 using ternary with no assignment #1468

Closed
Dodzey opened this issue Sep 20, 2024 · 3 comments
Closed

Segfault using ternary with no assignment #1468

Dodzey opened this issue Sep 20, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Milestone

Comments

@Dodzey
Copy link
Contributor

Dodzey commented Sep 20, 2024

Repro:

fn void foo() {}
fn void bar() {}

fn void main()
{
    bool b = true;
    true ? foo() : bar(); // ok
    b ? foo() : bar(); // segfault
}
@lerno lerno self-assigned this Sep 20, 2024
@lerno lerno added the Bug Something isn't working label Sep 20, 2024
@lerno lerno added the Fixed Needs Verification Fixed, but needs verification that it works label Sep 20, 2024
@lerno
Copy link
Collaborator

lerno commented Sep 20, 2024

Should be fixed now.

@lerno lerno added this to the 0.6.3 milestone Sep 21, 2024
@SadeAli
Copy link
Contributor

SadeAli commented Sep 22, 2024

The fix for the reported issue has been tested using the code snippet provided in the original report.

Using version 0.6.2 (release):

➜  c3c_lts compile-run ternary_seg_fault.c3 
[1]    3838 segmentation fault (core dumped)  /path/to/c3c compile-run ternary_seg_fault.c3

Using version 0.6.2 (master branch):

➜  c3c compile-run ternary_seg_fault.c3 
Program linked to executable 'ternary_seg_fault'.
Launching ./ternary_seg_fault
Program completed with exit code 0.

Conclusion:

The fix seems to be effective, as no segmentation fault was encountered on the master branch. Please let us know if further testing is required.

@lerno
Copy link
Collaborator

lerno commented Sep 22, 2024

Thank you, I'll close it.

@lerno lerno closed this as completed Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Projects
None yet
Development

No branches or pull requests

3 participants