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

Bug: Logical operation on str variables fail #2615

Closed
kmr-srbh opened this issue Mar 18, 2024 · 0 comments · Fixed by #2699
Closed

Bug: Logical operation on str variables fail #2615

kmr-srbh opened this issue Mar 18, 2024 · 0 comments · Fixed by #2699

Comments

@kmr-srbh
Copy link
Contributor

kmr-srbh commented Mar 18, 2024

#1506 claimed to handle logical operations on strings, but as it turns out, things break. #2598 adds support for string literals, but the case of a string variable still fails with a segfault. The chief reason, as pointed out by @Shaikh-Ubaid is that the expr_value of the operands, in case of a string variable, result into a nullptr.

s_var1: str = "Hello"
s_var2: str = "LPython"

print(s_var1 or s_var2)
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
Segmentation fault (core dumped)

The fix for this issue can help us to enable logical operations on string variables.

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

Successfully merging a pull request may close this issue.

1 participant