public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: "David Binderman" <d.binderman@virgin.net>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c/8268: no compile time array index checking
Date: Sun, 26 Jan 2003 16:06:00 -0000	[thread overview]
Message-ID: <20030126160600.15918.qmail@sources.redhat.com> (raw)

The following reply was made to PR c/8268; it has been noted by GNATS.

From: "David Binderman" <d.binderman@virgin.net>
To: <bangerth@dealii.org>,
	<gcc-prs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>
Cc:  
Subject: Re: c/8268: no compile time array index checking
Date: Sun, 26 Jan 2003 16:08:53 -0000

 Hello there,
 
 I tried out the suggested patch, and it seems ok, until I run
 the gcc test suite, where I get problems on test
 
 gcc.c-torture/execute/20010924-1.c
 
 as shown
 
 (gdb) r /tmp/1.i
 Starting program:
 /home/dcb/gnu/gcc321/results.check/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cc1
 /tmp/1.i
  main
 Program received signal SIGSEGV, Segmentation fault.
 0x080f12d3 in get_inner_reference (exp=0x40271700, pbitsize=0xbffff1ec,
     pbitpos=0xbffff1f0, poffset=0xbffff1f4, pmode=0x0,
 punsignedp=0x40016c60,
     pvolatilep=0xbffff1fc) at ../../src/gcc-3.2.1/gcc/expr.c:5338
 5338                      || (TREE_CODE (TYPE_MAX_VALUE (domain)) ==
 INTEGER_CST(gdb) list
 5333
 5334              if (domain && TREE_CODE (index) == INTEGER_CST)
 5335                {
 5336                  if ((TREE_CODE (low_bound) == INTEGER_CST
 5337                       && tree_int_cst_lt(index, low_bound))
 5338                      || (TREE_CODE (TYPE_MAX_VALUE (domain)) ==
 INTEGER_CST5339                          && tree_int_cst_lt (TYPE_MAX_VALUE
 (domain), index)
 5340                          /* Accesses after the end of arrays of size 0
 (gcc5341                             extension) and 1 are likely
 intentional. */
 5342                          && !tree_int_cst_lt (TYPE_MAX_VALUE (domain),
 (gdb)
 
 
 Further, it seems a good idea if the warning message produced could be
 enhanced to give a clue about the index value and the size of the array.
 
 Something like
 
  warning: array index '10' in array 'fred' of size '5' is not valid.
 
 A possible second enhancement is to make sure that all six bugs in my
 original demonstration case are found. The current version of the patch
 only finds four of the six problems.
 
 The supplied patch does seem to find bugs in the gcc321 source code,
 however.
 
 Regards
 
 dcb
 
 
 ----- Original Message -----
 From: <bangerth@dealii.org>
 To: <d.binderman@virgin.net>; <gcc-bugs@gcc.gnu.org>; <gcc-prs@gcc.gnu.org>;
 <nobody@gcc.gnu.org>
 Sent: Wednesday, January 08, 2003 2:40 AM
 Subject: Re: c/8268: no compile time array index checking
 
 
 > Synopsis: no compile time array index checking
 >
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: bangerth
 > State-Changed-When: Tue Jan  7 18:40:02 2003
 > State-Changed-Why:
 >     Valid request. Falk even has a patch for that, but it
 >     does not seem to be in.
 >
 >     In fact, the category should not be accepts-illegal, since
 >     the code is perfectly legal. It just does something
 >     undefined.
 >
 >     W.
 >
 >
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=8268
 >
 


             reply	other threads:[~2003-01-26 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-26 16:06 David Binderman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-01-28  0:46 Wolfgang Bangerth
2003-01-08  2:40 bangerth
2002-10-18 10:26 Falk Hueffner
2002-10-17 14:26 d.binderman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030126160600.15918.qmail@sources.redhat.com \
    --to=d.binderman@virgin.net \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).