public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24728]  New: Constant array index past end does not generate compile-time error
@ 2005-11-08  2:39 Larry dot Finger at lwfinger dot net
  2005-11-08  2:41 ` [Bug c/24728] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: Larry dot Finger at lwfinger dot net @ 2005-11-08  2:39 UTC (permalink / raw)
  To: gcc-bugs

A constant reference to an array element past the end of the array does not
generate an error. Included are the output from gcc -v and a test program that
mimics the real-world case where the coding error corrupted the stack: 

Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,f95,java,ada --disable-checking
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk
--disable-libjava-multilib --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit --without-system-libunwind
--host=i586-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)


Test Program:
=============
int sub1(int);
int main(int argc, char **argv) {
        int i,j = 0;
        i = sub1(j);
        return i;
}
int sub1(int j ) {
        int b[13];
        b[13] = j;
        return 0;
}


-- 
           Summary: Constant array index past end does not generate compile-
                    time error
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Larry dot Finger at lwfinger dot net
  GCC host triplet: i586-suse-linux
GCC target triplet: i586-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24728


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/24728] Constant array index past end does not generate compile-time error
  2005-11-08  2:39 [Bug c/24728] New: Constant array index past end does not generate compile-time error Larry dot Finger at lwfinger dot net
@ 2005-11-08  2:41 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-08  2:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-08 02:41 -------
First this is only undefined code which means that we have to accept the code.
Second this is a dup of bug 8268.

*** This bug has been marked as a duplicate of 8268 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24728


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-08  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-08  2:39 [Bug c/24728] New: Constant array index past end does not generate compile-time error Larry dot Finger at lwfinger dot net
2005-11-08  2:41 ` [Bug c/24728] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).