Giter VIP home page Giter VIP logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 27, 2024
I'll take a look at this in my latest devel version and see what I can do.

With gcc/clang I *always* compile with -fno-strict-aliasing, like the Linux 
kernel:
https://lkml.org/lkml/2003/2/26/158
http://www.mail-archive.com/[email protected]/msg01647.html

If you look at miniz's CMakeLists.txt, it uses -fno-strict-aliasing.

Original comment by [email protected] on 2 Dec 2013 at 3:06

from miniz.

uroni avatar uroni commented on July 27, 2024

This should be fixed now

from miniz.

janisozaur avatar janisozaur commented on July 27, 2024

There are still errors when compiling with -fstrict-aliasing on 35c2d67:

miniz.c: In function ‘tdefl_find_match’:
miniz.c:1348:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s);
     ^~~~~~~~~
miniz.c:1365:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             TDEFL_PROBE;
             ^~~~~~~~~~~
miniz.c:1366:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             TDEFL_PROBE;
             ^~~~~~~~~~~
miniz.c:1367:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             TDEFL_PROBE;
             ^~~~~~~~~~~
miniz.c:1391:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
             c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]);
             ^~~
miniz.c: In function ‘mz_zip_validate_file’:
miniz.c:4935:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         has_id = (MZ_READ_LE32(descriptor_buf) == MZ_ZIP_DATA_DESCRIPTOR_ID);
         ^~~~~~

from miniz.

janisozaur avatar janisozaur commented on July 27, 2024

This can be alleviated by disabling the broken MINIZ_USE_UNALIGNED_LOADS_AND_STORES option in the config until a proper fix is in place.

from miniz.

huyuguang avatar huyuguang commented on July 27, 2024

The issue still does not solve.
So what should I do? Disable the warning in code or I must compile with -fno-strict-aliasing?

from miniz.

uroni avatar uroni commented on July 27, 2024

Ok, sorry. Either set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to zero (less performance on x86/x64), set -fno-strict-aliasing or ignore the warning. The warning should be a false positive.

from miniz.

huyuguang avatar huyuguang commented on July 27, 2024

Thanks for reply.
So it safe to disable the warning.

from miniz.

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.