Giter VIP home page Giter VIP logo

Comments (8)

skgsergio avatar skgsergio commented on July 22, 2024

Yes, is not OS X specific. When you try to build it on Linux with clang fails also.
Clang warns about array boundaries and in this case there is a negative index in /py/vm.c:81 and /py/vm.c:451

Anyway it can be built if you edit the Makefile inside unix dir and delete "-Werror" from CFLAGS.

from micropython.

mikaeleiman avatar mikaeleiman commented on July 22, 2024

Yes, but since it's likely relying on undefined behaviour it'd be best to change it into something that doesn't trigger a warning - to avoid weird bugs later on.

from micropython.

skgsergio avatar skgsergio commented on July 22, 2024

I'll try to have a look to the code later and see whats the point on that negative index.

from micropython.

dpgeorge avatar dpgeorge commented on July 22, 2024

There is no bug: it's using stack allocated memory for the array, and pointing to the element before the start of the array. The pointer is pre-incremented, so won't write outside the array.

The proper fix is to find a way to write such code so it doesn't give a warning.

from micropython.

pfalcon avatar pfalcon commented on July 22, 2024

Yup, you can try to avoid array subscript syntax, i.e. &array[-1] => array - 1 . If clang would complain even about that, then it's a real smartass ;-).

from micropython.

dpgeorge avatar dpgeorge commented on July 22, 2024

I've pushed a change, as suggested by @pfalcon . Can @mikaeleiman please test it? Compile and run the tests/basics/run-tests script.

from micropython.

skgsergio avatar skgsergio commented on July 22, 2024

Working for me now (clang 3.3 on Debian Sid).

Terminal output: http://pastebin.com/AidWEhYM

from micropython.

tylerwilson avatar tylerwilson commented on July 22, 2024

I had sent a private message to dpgeorge about this issue, and am glad to see it has been patched already. And I will move all my comments to this issue section. Thanks.

from micropython.

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.