Git Product home page Git Product logo

Comments (12)

gszr avatar gszr commented on July 3, 2024

If I compile with -fstrict-aliasing -Wstrict-aliasing=2, I get some useful warnings - see https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722.

Also, I've tested with this changeset, that refactors some of the "aliasing", and verified it fixes the issue: https://github.com/gszr/lua-protobuf/pull/1/files
(I am not familiar with the library's code, so this was just a proof of concept to verify some assumptions)

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

It seems that caused by the lack of Lua stack space, you could try the latest HEAD version of git to see whether it fixed.

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

If I compile with -fstrict-aliasing -Wstrict-aliasing=2, I get some useful warnings - see https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722.

Also, I've tested with this changeset, that refactors some of the "aliasing", and verified it fixes the issue: https://github.com/gszr/lua-protobuf/pull/1/files (I am not familiar with the library's code, so this was just a proof of concept to verify some assumptions)

Oh, I see this fix, so it's caused by the optimization of gcc? a pr is welcome :-)

from lua-protobuf.

gszr avatar gszr commented on July 3, 2024

@starwing - can you take a look at the PR?
FWIW, we might want to disable the -fstrict-aliasing, since that same pattern I remvoed in the PR appears in other places. Doing -O2 without disabling strict-aliasing seems unsafe, and the segfault can happen in other places.

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

@gszr it seems the gcc feature, not bug. To compete with clang for performance ... I will accept this pr

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

I have made a new commit, please try it out and see whether the warnings still exist.

from lua-protobuf.

gszr avatar gszr commented on July 3, 2024

@starwing - I will give this a shot soon and report back.

from lua-protobuf.

gszr avatar gszr commented on July 3, 2024

@starwing I can confirm that fixes the specific aliasing issue I reported. No segfaults with the same testing.
Also, it'd be a good exercise to go through other aliasing issues as reported by https://gist.github.com/gszr/84b12df6c5401b4e64fe5e5739405722 and fix them. These result in undefined behavior if the -fstrict-aliasing is on.

from lua-protobuf.

gszr avatar gszr commented on July 3, 2024

Also, could you draft a new patch release of the library?

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

I have made a new commit which fix the strict aliasing issue, could you check it out and test whether it works?

from lua-protobuf.

starwing avatar starwing commented on July 3, 2024

@gszr new version drafted.

from lua-protobuf.

gszr avatar gszr commented on July 3, 2024

@starwing The issue is gone (https://gist.github.com/gszr/05b43652556e0a1f8dd570806a8e914e) - thanks for the fix and new version (could you also update the GH releases page? :)

from lua-protobuf.

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.