From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62287 invoked by alias); 21 Mar 2015 15:24:12 -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 Received: (qmail 62240 invoked by uid 48); 21 Mar 2015 15:24:03 -0000 From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65504] [4.9/5 Regression] select case with strings and -fgcse -O Date: Sat, 21 Mar 2015 15:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig 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: 4.9.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg02215.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65504 --- Comment #8 from Thomas Koenig --- Reduced test case: program testbug implicit none integer, parameter :: STRLEN = 256 type :: ncVarnames_t ! variables names for the different ice models character (len=STRLEN) :: surf character (len=STRLEN) :: bed end type ncVarnames_t type (ncVarnames_t) :: testvar type (ncVarnames_t) :: testvar2 testvar = get_ncVarnames ("test") testvar2 = get_ncVarnames ("test") print *, trim(testvar%bed) contains type (ncVarnames_t) function get_ncVarnames (model) result (v) character(len=*), intent(in) :: model ! type (ncVarnames_t) :: v select case (model) case ("test") ! test model v%bed = 'bed' case ("pism") ! pism data v%bed = 'topg' case default print *, "unknown model, please use one of [test pism sico]" stop end select end function get_ncVarnames end program testbug You need two cases in the select case statement, you need two calls to get_ncVarnames, and you need the two components in the type.