From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24108 invoked by alias); 28 Jan 2012 11:41:16 -0000 Received: (qmail 24100 invoked by uid 22791); 28 Jan 2012 11:41:15 -0000 X-SWARE-Spam-Status: No, hits=-2.9 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; Sat, 28 Jan 2012 11:41:03 +0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50981] [4.4/4.5/4.6 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument Date: Sat, 28 Jan 2012 14:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: mikael at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.4.7 X-Bugzilla-Changed-Fields: 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 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: 2012-01/txt/msg03299.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50981 --- Comment #31 from Dominique d'Humieres 2012-01-28 11:40:17 UTC --- > The test in comment #23 gives an ICE with/without the patch: > > pr50981_4.f90: In function 'MAIN__': > pr50981_4.f90:16:0: internal compiler error: in fold_convert_loc, at > fold-const.c:2016 > > i.e., the same ICE as for pr51977 (I did not tested the patchlet in comment > #27). This was pr52016 fixed by revision 183625. Looking further to this test, I have found the following reduced test which gives a segmentation fault at run time: type t integer :: a end type t type(t), allocatable :: var1, var2(:) call sub_cta(var2) contains subroutine sub_cta(y) class(t), intent(inout), optional :: y(:) ! FIXME: PR 46356 ? print *, present(y) if (present(y)) y%a = 7 if (present(y)) i = 7 end subroutine sub_cta end [macbook] f90/bug% gfc pr50981_4_red_1.f90 [macbook] f90/bug% a.out T Program received signal SIGSEGV: Segmentation fault - invalid memory reference. ... i.e., the unallocated 'var2' is viewed as present.