Coder Social home page Coder Social logo

Comments (3)

sbc100 avatar sbc100 commented on May 30, 2024

If possible, I think think would be a lot more actionable if you could narrow this down. In doing so you could also reveal more about the divergence.

from emscripten.

mkarup avatar mkarup commented on May 30, 2024

Sorry for the late, late reply.
It seems to happen when trying to pretty print anything that is an in-memory data structure (using pointers) (which is basically what CertiCoq translates a Coq inductive data types like list to).

If I compile with emcc and add -fsanitize=undefined and -sSAFE_HEAP I get

load of misaligned address 0x00046ea4 for type 'unsigned long long', which requires 8 byte alignment
0x000471e4: note: pointer points here
  b4 71 04 00 d4 71 04 00  00 08 00 00 a4 71 04 00  e0 71 04 00 00 00 00 00  00 00 00 00 00 00 00 00
              ^ 
Aborted(alignment fault)

The load happens in this function:

unsigned long long get_boxed_ordinal(value $v)
{
  return (unsigned long long) *((unsigned long long *) $v + -1LL) & 255LL;
}

value is typedef'd as int64_t.

Compiling the C code with clang also with -fsanitize=undefined (and no optimizations) and running it doesn't give me an error.

If I add -O1 when compiling with emcc, along with -fsanitize=undefined and -sSAFE_HEAP I still get the error about the misaligned load from the sanitizer, but it doesn't abort and it pretty prints correctly.

from emscripten.

sbc100 avatar sbc100 commented on May 30, 2024

Unaligned accesses are allowed in Wasm, so you can use -sSAFE_HEAP=2 to ignore the alignment fault.

from emscripten.

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.