From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26214 invoked by alias); 24 May 2006 09:21:04 -0000 Received: (qmail 26164 invoked by uid 48); 24 May 2006 09:20:48 -0000 Date: Wed, 24 May 2006 09:21:00 -0000 Message-ID: <20060524092048.26163.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/27524] -fbounds-check interracts *strangely* with an array of size 1 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "fxcoudert at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg02326.txt.bz2 List-Id: ------- Comment #3 from fxcoudert at gcc dot gnu dot org 2006-05-24 09:20 ------- > function F() > integer :: F(1) > f = 1 > end function F Compiling this simple function without and with -fbounds-check and dumping the GIMPLE tree generated gives the following diff: --- 003t.original.noboundscheck 2006-05-24 11:09:37.000000000 +0200 +++ 003t.original.boundscheck 2006-05-24 11:09:32.000000000 +0200 @@ -14,8 +14,16 @@ f (__result) D.917 = __result->dim[0].stride; stride.0 = D.917 == 0 ? 1 : D.917; __result.0 = (int4[0:D.918] *) __result->data; + if ((logical4) __builtin_expect (__result->dim[0].ubound != __result->dim[0].lbound, 0)) + { + _gfortran_runtime_error ("Array bound mismatch", "test.f90", 1); + } + else + { + (void) 0; + } size.2 = NON_LVALUE_EXPR ; - offset.1 = -stride.0; + offset.1 = __result->dim[0].lbound - __result->dim[0].ubound; D.918 = size.2 - 1; D.919 = (bit_size_type) () size.2 * I think the cuplrit here is gfc_trans_dummy_array_bias(), around line 3728 (where the offset is built), although I'm not skilled enough in all this to understand how exactly to fix it. -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2006-05-19 16:59:16 |2006-05-24 09:20:48 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27524