From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3074 invoked by alias); 26 Sep 2011 09:03:49 -0000 Received: (qmail 3046 invoked by uid 22791); 26 Sep 2011 09:03:47 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Sep 2011 09:03:28 +0000 Received: by gxk4 with SMTP id 4so4560199gxk.20 for ; Mon, 26 Sep 2011 02:03:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.57.3 with SMTP id e3mr28408709pbq.86.1317027806737; Mon, 26 Sep 2011 02:03:26 -0700 (PDT) Received: by 10.143.162.14 with HTTP; Mon, 26 Sep 2011 02:03:26 -0700 (PDT) In-Reply-To: <4e80264f.6ab8ec0a.78ce.ffffad1cSMTPIN_ADDED@mx.google.com> References: <4e80264f.6ab8ec0a.78ce.ffffad1cSMTPIN_ADDED@mx.google.com> Date: Mon, 26 Sep 2011 09:35:00 -0000 Message-ID: Subject: Re: A question about detecting array bounds for case Warray-bounds-3.c From: Jonathan Wakely To: Jiangning Liu Cc: gcc@gcc.gnu.org, jakub@gcc.gnu.org, mueller@gcc.gnu.org, rguenth@gcc.gnu.org, Matthew Gretton-Dann Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00311.txt.bz2 On 26 September 2011 08:13, Jiangning Liu wrote: > PING... > >> -----Original Message----- >> From: Jiangning Liu [mailto:jiangning.liu@arm.com] >> Sent: Thursday, September 22, 2011 10:19 AM >> To: gcc@gcc.gnu.org >> Cc: 'jakub@gcc.gnu.org'; 'mueller@gcc.gnu.org'; 'rguenth@gcc.gnu.org'; >> Matthew Gretton-Dann >> Subject: A question about detecting array bounds for case Warray- >> bounds-3.c >> >> Hi, >> >> For case gcc/testsuite/gcc.dg/Warray-bounds-3.c, obviously it is an >> invalid C program, because the last iterations of all the loops cause >> the access of arrays is beyond the max size of corresponding array >> declarations. The condition of checking upper bound should be "<" >> rather than "<=". Which loops are you referring to? struct iovec iov[43]; ... for (; cnt <= 40; ++cnt) { iov[2 + cnt].iov_base = (void *) (time->am_pm[cnt - 38] ?: ""); iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1; } What's wrong with that? The last element accessed is iov[42] which is ok.