Coder Social home page Coder Social logo

Test compilation failures on GCC 11: error: array subscript -1 is outside array bounds of 'char[6]' [-Werror=array-bounds] about gsl-lite HOT 7 CLOSED

sanjayankur31 avatar sanjayankur31 commented on June 16, 2024
Test compilation failures on GCC 11: error: array subscript -1 is outside array bounds of 'char[6]' [-Werror=array-bounds]

from gsl-lite.

Comments (7)

mbeutel avatar mbeutel commented on June 16, 2024 1

Thanks for the report.

This appears to be a compiler bug which first surfaced in GCC 10.3. Here's a minimal repro:
https://gcc.godbolt.org/z/4xaY9vfzW

The problem only occurs when "-O2" or higher is enabled, hence it doesn't appear in our CI because we only test with the Debug build configuration (to keep the overall build times low). I'll change that so at least one version of each compiler will also build the RelWithDebInfo configuration.

I'll issue a bug report with GCC.

from gsl-lite.

mbeutel avatar mbeutel commented on June 16, 2024 1

Awesome, thanks.

I hope I can fix #304 and add the -Wno-error=array-bounds workaround to the test suite later this week. I'll then issue a bugfix release which also includes the fix to #302.

from gsl-lite.

sanjayankur31 avatar sanjayankur31 commented on June 16, 2024

I'm seeing similar errors on Fedora 33 which is on GCC 10, so this may not be a GCC related issue. Build log for GCC 10 build:
gsl-lite-0.38.0-buildlog-f33-gcc10.txt

from gsl-lite.

sanjayankur31 avatar sanjayankur31 commented on June 16, 2024

Thanks very much. If there's anything we can do to help with this, please do let us know.

from gsl-lite.

mbeutel avatar mbeutel commented on June 16, 2024

Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100137

For the time being, you can make your build work by adding -Wno-error=array-bounds to CXXFLAGS (or -Wno-array-bounds if you want to suppress the warning entirely).

from gsl-lite.

sanjayankur31 avatar sanjayankur31 commented on June 16, 2024

Thanks, I've added that to our build now.

Fedora currently builds for a number of architectures:

https://fedoraproject.org/wiki/Architectures

  • x86_64
  • i686
  • aarch64
  • ppc64le
  • armv7hl
  • s390x

I'm happy to report that it builds correctly and all tests pass on all architectures apart from s390x. I've filed a separate issue for that here: #304

Here are the test builds:

from gsl-lite.

mbeutel avatar mbeutel commented on June 16, 2024

RelWithDebInfo CI builds added in f5b5b93, so as expected the build now failed for GCC 10. Added error suppression in subsequent commit 2ad316d.

from gsl-lite.

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.