From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20499 invoked by alias); 22 Nov 2010 08:09:33 -0000 Received: (qmail 20486 invoked by uid 22791); 22 Nov 2010 08:09:32 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Nov 2010 08:09:28 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46588] ICE with assumed character length function X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Keywords CC Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 22 Nov 2010 08:11:00 -0000 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: 2010-11/txt/msg02687.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46588 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code CC| |burnus at gcc dot gnu.org Summary|Segfault on automatic |ICE with assumed character |function |length function --- Comment #3 from Tobias Burnus 2010-11-22 08:09:07 UTC --- (In reply to comment #2) > Reduced testcase. > > function aufun(pm) > character(len = *) pm > character(len = *) aufun > character(len = len(aufun)) temp ! This is the problem. > aufun = 'hi' > end Looks like legal Fortran of the ugly kind: character(len = *) pm takes the length of the argument. character(len = *) aufun takes the length of the definition; that's called "assumed character length function", is obsolescence; cf. F2008 B.2.6. It runs against the spirit of (modern) Fortran. Usage: function f() character(len=*) :: f end function subroutine test character(len=7) :: f print *, len(f()) end subroutine test2 character(len=1) :: f print *, len(f()) end character(len = len(aufun)) temp Also that line looks to be OK if the other lines are valid.