From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16949 invoked by alias); 5 May 2008 18:58:11 -0000 Received: (qmail 16535 invoked by uid 48); 5 May 2008 18:57:28 -0000 Date: Mon, 05 May 2008 18:58:00 -0000 Message-ID: <20080505185728.16534.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/36132] _gfortran_internal_pack on optional arguments In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tkoenig at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg00372.txt.bz2 ------- Comment #4 from tkoenig at gcc dot gnu dot org 2008-05-05 18:57 ------- The problem isn't specific to in_pack, it's the fact that we don't initialize the array descriptor correctly. s2 shows if (a != 0B) { { integer(kind=4) D.638; D.638 = a->dim[0].stride; stride.1 = D.638 != 0 ? D.638 : 1; ... } } so we set stride.1 only if a is present. So far, so good. Later, unconditionally, we have struct array2_real(kind=8) parm.6; ... D.633 = stride.1; parm.6.dim[0].lbound = 1; parm.6.dim[0].ubound = ubound.0; parm.6.dim[0].stride = NON_LVALUE_EXPR ; parm.6.data = (void *) &(*a.0)[0]; parm.6.offset = NON_LVALUE_EXPR ; D.635 = _gfortran_internal_pack (&parm.6); We need to call _gfortran_internal_pack on optional arguments only when the optional arguments are present. Setting subject. -- tkoenig at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tkoenig at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2008-05-05 18:57:28 date| | Summary|issue with |_gfortran_internal_pack on |_gfortran_internal_pack |optional arguments http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132