Bug 1236784 - gcc 5.1.1 reports apparently spurious 'array subscript is above array bounds' error
gcc 5.1.1 reports apparently spurious 'array subscript is above array bounds'...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
22
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-06-29 21:54 EDT by Chris Siebenmann
Modified: 2016-03-10 11:12 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-10 11:12:01 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Chris Siebenmann 2015-06-29 21:54:24 EDT
Description of problem:

When compiling the latest development version of darktable (from the
git repo at https://github.com/darktable-org/darktable), the Fedora
22 version of gcc 5.1.1 errors out with an apparently spurious error:

  /data/code/git/darktable/src/common/interpolation.c: In function ‘dt_interpolation_compute_sample’:
  /data/code/git/darktable/src/common/interpolation.c:789:21: error: array subscript is above array bounds [-Werror=array-bounds]
         h += kernelh[j] * ipixel[0];
                     ^
  cc1: all warnings being treated as errors
  src/CMakeFiles/lib_darktable.dir/build.make:829: recipe for target 'src/CMakeFiles/lib_darktable.dir/common/interpolation.c.o' failed

At the moment the specific line of source code producing this is:
https://github.com/darktable-org/darktable/blob/b2219b57bd2bbb56c28db390f3eec9eb2b4dad1e/src/common/interpolation.c#L789

As far as I can see, this warning is spurious and inaccurate. It did not
trigger in the Fedora 21 gcc 4.9.2, and clang produces no warnings here.

The darktable developers have pointed me at the following upstream
gcc issues as potentially relevant:

	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53198
	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45180

Version-Release number of selected component (if applicable):

gcc-5.1.1-4.fc22.x86_64

How reproducible:

Completely.

Steps to Reproduce:

	sudo dnf builddep darktable
	mkdir /tmp/scr
	cd /tmp/scr
	git clone https://github.com/darktable-org/darktable
	cd darktable
	git checkout b2219b57bd2bbb56c28db390f3eec9eb2b4dad1e
	./build.sh -j 1

(The git checkout is optional; it is the current git tip, which I
know reproduces this.)

Actual results:

The above error is produced.

Expected results:

Darktable is compiled successfully (in /tmp/scr/darktable/build).
Comment 1 Francisco Cribari 2015-07-07 19:15:27 EDT
This bug also affects me (Fedora 22).
Comment 2 Marek Polacek 2016-03-10 10:48:42 EST
Is this bug still present with latest F23 GCC?
Comment 3 Chris Siebenmann 2016-03-10 11:04:49 EST
I just (re)checked and this bug is now gone on Fedora 23.
Comment 4 Marek Polacek 2016-03-10 11:12:01 EST
Thanks!  Thus closing as fixed.

Note You need to log in before you can comment on or make changes to this bug.