From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32373 invoked by alias); 8 Dec 2007 21:02:25 -0000 Received: (qmail 32346 invoked by uid 48); 8 Dec 2007 21:02:13 -0000 Date: Sat, 08 Dec 2007 21:02:00 -0000 Subject: [Bug fortran/34396] New: Length of substrings defined by expressions not correctly computed in constructors X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dominiq at lps dot ens dot fr" 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: 2007-12/txt/msg00642.txt.bz2 The following code program array_char implicit none integer :: i character (len=5) :: x, y character (len=5) :: z(2) x = "a " y = "cd" z = "" z = (/y(1:len(trim(y))), x(1:len(trim(x)))/) print *, "|", z(1), "| |", z(2), "|" print '(99i4)', ichar ( [ (z(1)(i:i), i=1,5) ] ) print '(99i4)', ichar ( [ (z(2)(i:i), i=1,5) ] ) end program array_char gives [ibook-dhum] f90/bug% a.out |cdI| |a` | 99 100 128 73 16 97 96 12 17 0 As reported in PR33254, comment #14, the length of the strings seems not computed inget_array_ctor_var_strlen() by: if (ref->u.ss.start->expr_type != EXPR_CONSTANT || ref->u.ss.end->expr_type != EXPR_CONSTANT) break; -- Summary: Length of substrings defined by expressions not correctly computed in constructors Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dominiq at lps dot ens dot fr GCC build triplet: i686-apple-darwin9 GCC host triplet: i686-apple-darwin9 GCC target triplet: i686-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34396