From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8214 invoked by alias); 26 Oct 2010 14:07:03 -0000 Received: (qmail 8206 invoked by uid 22791); 26 Oct 2010 14:07:02 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID 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; Tue, 26 Oct 2010 14:06:58 +0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/46182] Run time check for invalid use of unallocated allocatable variables X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: 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: Tue, 26 Oct 2010 14:07: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-10/txt/msg02185.txt.bz2 Message-ID: <20101026140700.Q_uALxz143MelFDk1Xmk1ro30lRuS9E_lTJSbkPD6zQ@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46182 --- Comment #1 from Dominique d'Humieres 2010-10-26 14:06:55 UTC --- Forwarded from http://gcc.gnu.org/ml/gcc-bugs/2010-10/msg02167.html > > It would be nice to have a run time check for such invalid use of > > unallocated allocatable variables (such as -fcheck=use_unalloc). > If you use an unallocated variable you get a segmentation fault. > Isn't this a sufficient runtime check ? Well! You can say the same thing for -fcheck=bounds if writing outside array bounds gives you a segmentation fault! Nevertheless nobody will argue that this check is useless: it can save you hours of debugging to locate the line(s) in which you do it. Segmentation faults tell you that there is something wrong, but not why and/or where (not counting gfortran bugs). It took me some time to understand it for a less than 20 line code in which I had the bad idea of using a copy and paste from a valid line to an invalid one (this can happen to anybody with kloc!-)