Skip to content

Bug: Logical operation on str variables fail #2615

Closed
@kmr-srbh

Description

@kmr-srbh

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions