GithubHelp home page GithubHelp logo

Comments (3)

brianhuffman avatar brianhuffman commented on July 23, 2024

I tried running this example again, and it produces a different error. It no longer always returns the first element of the array. However, the symbolic function pointer cannot be called with an argument.

The updated saw-script:

bc <- llvm_load_module "issue10.bc";
crucible_llvm_verify bc "mytestfunction" [] false
  do {
    i <- crucible_fresh_var "i" (llvm_int 32);
    j <- crucible_fresh_var "j" (llvm_int 32);
    crucible_precond {{ i < 2 }};
    crucible_execute_func [crucible_term i, crucible_term j];
    crucible_return (crucible_term {{ j + 1 }});
  }
  z3;

It produces the following error:

Symbolic execution failed.
LoadHandle: not a valid function pointer
in mytestfunction at issue10.c:8:12
Stack frame
  Allocations:
    StackAlloc 9 0x10:[64] "issue10.c:7:19"
    StackAlloc 8 0x4:[64] "issue10.c:6:31"
    StackAlloc 7 0x4:[64] "issue10.c:6:24"
  Writes:
    memcopy (9, 0x0:[64]) (6, 0x0:[64]) 0x10:[64]
    *(8, 0x0:[64]) := c@3:bv
    *(7, 0x0:[64]) := c@2:bv
Base memory
  Allocations:
    GlobalAlloc 6 0x10:[64] mytestfunction.funs
    GlobalAlloc 5 0x0:[64] succ
    GlobalAlloc 4 0x0:[64] pred
    GlobalAlloc 3 0x0:[64] mytestfunction
    GlobalAlloc 2 0x0:[64] llvm.memcpy.p0i8.p0i8.i64
    GlobalAlloc 1 0x0:[64] llvm.dbg.declare
  Writes:
    *(6, 0x0:[64]) := [(5, 0x0:[64])
                      ,(4, 0x0:[64])]

from crucible.

robdockins avatar robdockins commented on July 23, 2024

I took a quick look into this. The issue is that function handles are associated to block allocation numbers in a side lookup table. Currently, function handle lookup only succeeds if the pointer value is a concrete pointer. The message is perhaps misleading, but the root cause here is that the pointer ins't concrete, so we aren't sure which function handle to return.

A proper fix for this issue will require being able to merge distinct function handles, and perform the necessary branching at call sites when they are called, etc. I the meantime, I'll alter the error message to be more specific about the cause of the problem (the pointer is symbolic).

from crucible.

travitch avatar travitch commented on July 23, 2024

Working on this in #615

from crucible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.