← 输入框|github.com|刷新
Skip to content

Error message not clear while dealing with symbolic lists #2439

Closed

Description

@anutosh491
from lpython import S
from sympy import Symbol

def mmrv(x: S) -> list[S]:
    l1: list[S] = [x]
    return l1

def test_mrv1():
    x: S = Symbol("x")
    ans: list[S] = mmrv(x)
    assert len(ans) == 1

test_mrv1()

Activity

  1. anutosh491 commented on Dec 6, 2023

    @anutosh491
    CollaboratorAuthor
    diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp
    index b84a10dc3..d6658a268 100644
    --- a/src/libasr/codegen/asr_to_llvm.cpp
    +++ b/src/libasr/codegen/asr_to_llvm.cpp
    @@ -6415,7 +6415,7 @@ public:
             } else {
                 tmp = x_v;
                 // Load only once since its a value
    -            if( ptr_loads > 0 ) {
    +            if( ptr_loads > 0 && !ASR::is_a<ASR::CPtr_t>(*x->m_type) ) {
                     tmp = CreateLoad(tmp);
                 }
             }
    
  2. certik commented on Dec 6, 2023

    @certik
    Contributor

    This might be a better way to fix this: #2440

  3. anutosh491 commented on Jan 30, 2024

    @anutosh491
    CollaboratorAuthor

    Closing as this was completed through #2453
    Also a test symbolics14 was added for the same and the above example now works with both the c and the llvm backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions