From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19987 invoked by alias); 20 Dec 2010 16:48:21 -0000 Received: (qmail 19975 invoked by uid 22791); 20 Dec 2010 16:48:20 -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; Mon, 20 Dec 2010 16:48:16 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47024] [OOP] STORAGE_SIZE (for polymorphic types): Segfault at run time 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: burnus at gcc dot gnu.org 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: 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, 20 Dec 2010 16:48: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-12/txt/msg02379.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47024 --- Comment #3 from Tobias Burnus 2010-12-20 16:47:56 UTC --- (In reply to comment #2) > I don't really understand this. Why should one allow it for unallocated > allocatables, but not for undefined pointers? Well, the situation for an unassociated pointer and for an unallocated allocatable is the same: You know that it does not have a dynamic type -- and you can check for this state via ".data == NULL" or " == NULL". In case of an undefined pointer, you cannot. Thus, not allowing undefined pointers anywhere makes sense. The initially proposed wording was did not allow for notallocated allocatables/notassociated pointers (http://www.j3-fortran.org/doc/year/06/06-166.txt) but during the meeting 176 meeting the wording of 06-166 was changed (in two revisions, r1 and r2) to what we have today; cf. http://www.j3-fortran.org/doc/meeting/176/06-166r2.txt. Unfortunately, the new version does not clearly tell what the result value should be in that case. Possible choices would be: (a) storage size of the declared type or (b) "zero" or the size of the class container. If (b) is the correct answer, I do not see the reason for the additional restrictions for types with "deferred type parameters" and for "unlimited polymorphic" - one could simply return the same as for an unallocated polymorphic. Thus, I assume that (a) is meant, but I do not see how one can read this from the standard (as opposed to guessing it). Let's see what the J3 members think how it should be interpreted; I think ultimately an interpretation request is required.