FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

LinkBack Thread Tools
Old 10-09-2010, 04:14 AM
Miles Bader
Default Bug#599572: gcc-snapshot: bogus "array subscript is above array bounds" in extremely simple code with no loops

Package: gcc-snapshot
Version: 20100918-1
Severity: normal

There are many bugs in gcc's bugzilla related to bogus array-bounds
warnings, but most of them seem to involve non-trivial loops and other
situations that may need non-trivial analysis by the compiler.

By contrast, the appended code seems to be almost trivial, and
contains no loops at all, but nonetheless elicits an "array subscript
is above array bounds" warning from the compiler:

g++-snapshot -O3 -S -Wall -Wextra tt.cc
tt.cc: In function 'Z test()':
tt.cc:15:21: warning: array subscript is above array bounds [-Warray-bounds]

[This is as minimal as I can get it -- moving, eliminating, or
changing any field in any of the structures seems to silence the



p.s. I wasn't sure whether it's better to report bugs with
gcc-snapshot to debian or to upstream bugzilla...

---- start of code "tt.c" ----
struct X
X () : x (0), y (0), z (0) { }
float x, y, z;

struct Y
Y () { ar[0] = 0; ar[1] = 0; ar[2] = 0; }
float ar[3];

struct Z
Z () : b (0), d (0) { }
Y a;
float b;
X c;
float d;

Z test () { return Z (); }
---- end of code ----

-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-snapshot depends on:
ii binutils The GNU assembler, linker and bina
ii ecj-gcj [libecj-java- 3.5.1-1 standalone version of the Eclipse
ii libc6 2.11.2-6 Embedded GNU C Library: Shared lib
ii libc6-dev 2.11.2-6 Embedded GNU C Library: Developmen
ii libc6-dev-i386 2.11.2-6 Embedded GNU C Library: 32-bit dev
ii libc6-i386 2.11.2-6 Embedded GNU C Library: 32-bit sha
ii libcloog-ppl0 0.15.9-2 the Chunky Loop Generator (runtime
ii libecj-java-gcj 3.5.1-1 Eclipse Java compiler (native libr
ii libelfg0 0.8.13-1 an ELF object file access library
ii libgmp3c2 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii libgmpxx4ldbl 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii libmpc2 0.8.2-1+b1 multiple precision complex floatin
ii libmpfr4 3.0.0-2 multiple precision floating-point
ii libppl-c2 0.10.2-8 Parma Polyhedra Library (C interfa
ii libppl7 0.10.2-8 Parma Polyhedra Library (runtime l
ii python 2.6.6-3 interactive high-level object-orie
ii zlib1g 1: compression library - runtime

gcc-snapshot recommends no packages.

Versions of packages gcc-snapshot suggests:
ii binutils-gold The (experimental) GNU gold linker

-- no debconf information

To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101009041448.16340.13139.reportbug@catnip.gol.co m">http://lists.debian.org/20101009041448.16340.13139.reportbug@catnip.gol.co m

Thread Tools

All times are GMT. The time now is 06:24 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org