From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31857 invoked by alias); 24 Nov 2007 23:03:16 -0000 Received: (qmail 24360 invoked by uid 48); 24 Nov 2007 23:02:59 -0000 Date: Sat, 24 Nov 2007 23:03:00 -0000 Message-ID: <20071124230259.24359.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/34199] segfault for TRANSFER integer to TYPE(C_PTR) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" 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: 2007-11/txt/msg02344.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2007-11-24 23:02 ------- Some debugging notes. While the following crashes C_NULL_PTR1 = transfer(0_C_INTPTR_T, C_NULL_PTR1) it works after replacing the constant by a variable. In gfc_simplify_transfer (for the constant expression), /* And read the buffer back into the new expression. */ gfc_target_interpret_expr (buffer, buffer_size, result); is called. Here, "result" is of the type(c_ptr), i.e. ts.type == BT_DERIVED. As it is not a real derived type calling gfc_interpret_derived fails (segfault); converting it into INTEGER works in principle, but it fails in the "C_NULL_PTR1 =" assignment step as one cannot assign an integer to a derived type. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34199