Bug 1236784 - gcc 5.1.1 reports apparently spurious 'array subscript is above array bounds' error
Summary: gcc 5.1.1 reports apparently spurious 'array subscript is above array bounds'...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 22
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-30 01:54 UTC by Chris Siebenmann
Modified: 2016-03-10 16:12 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-10 16:12:01 UTC
Type: Bug


Attachments (Terms of Use)

Description Chris Siebenmann 2015-06-30 01:54:24 UTC
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 23:15:27 UTC
This bug also affects me (Fedora 22).

Comment 2 Marek Polacek 2016-03-10 15:48:42 UTC
Is this bug still present with latest F23 GCC?

Comment 3 Chris Siebenmann 2016-03-10 16:04:49 UTC
I just (re)checked and this bug is now gone on Fedora 23.

Comment 4 Marek Polacek 2016-03-10 16:12:01 UTC
Thanks!  Thus closing as fixed.


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