* [Patch, fortran] PR83148 [8 regression] ICE: crash_signal from toplev.c:325
@ 2018-02-23 12:39 Paul Richard Thomas
0 siblings, 0 replies; only message in thread
From: Paul Richard Thomas @ 2018-02-23 12:39 UTC (permalink / raw)
To: tkoenig at gcc dot gnu.org, fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
Committed as 'obvious' in revision 257930.
Cheers
Paul
2018-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83148
* trans-const.c : Clean up some whitespace issues.
* trans-expr.c (gfc_conv_initializer): If an iso_c_binding
derived type has a kind value of zero, set it to the default
integer kind.
2018-02-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83148
* gfortran.dg/class_68.f90: New test.
[-- Attachment #2: submit.diff --]
[-- Type: text/plain, Size: 3570 bytes --]
Index: gcc/fortran/trans-const.c
===================================================================
*** gcc/fortran/trans-const.c (revision 257826)
--- gcc/fortran/trans-const.c (working copy)
*************** gfc_build_localized_cstring_const (const
*** 133,139 ****
/* Return a string constant with the given length. Used for static
! initializers. The constant will be padded or truncated to match
length. */
tree
--- 133,139 ----
/* Return a string constant with the given length. Used for static
! initializers. The constant will be padded or truncated to match
length. */
tree
*************** gfc_conv_constant_to_tree (gfc_expr * ex
*** 303,309 ****
/* If it is has a prescribed memory representation, we build a string
constant and VIEW_CONVERT to its type. */
!
switch (expr->ts.type)
{
case BT_INTEGER:
--- 303,309 ----
/* If it is has a prescribed memory representation, we build a string
constant and VIEW_CONVERT to its type. */
!
switch (expr->ts.type)
{
case BT_INTEGER:
*************** gfc_conv_constant (gfc_se * se, gfc_expr
*** 389,400 ****
if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
&& expr->ts.u.derived->attr.is_iso_c)
{
! if (expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_PTR
! || expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_FUNPTR)
! {
! /* Create a new EXPR_CONSTANT expression for our local uses. */
! expr = gfc_get_int_expr (gfc_default_integer_kind, NULL, 0);
! }
}
if (expr->expr_type != EXPR_CONSTANT)
--- 389,400 ----
if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
&& expr->ts.u.derived->attr.is_iso_c)
{
! if (expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_PTR
! || expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_FUNPTR)
! {
! /* Create a new EXPR_CONSTANT expression for our local uses. */
! expr = gfc_get_int_expr (gfc_default_integer_kind, NULL, 0);
! }
}
if (expr->expr_type != EXPR_CONSTANT)
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c (revision 257826)
--- gcc/fortran/trans-expr.c (working copy)
*************** gfc_conv_initializer (gfc_expr * expr, g
*** 6868,6873 ****
--- 6868,6875 ----
/* The derived symbol has already been converted to a (void *). Use
its kind. */
+ if (derived->ts.kind == 0)
+ derived->ts.kind = gfc_default_integer_kind;
expr = gfc_get_int_expr (derived->ts.kind, NULL, 0);
expr->ts.f90_type = derived->ts.f90_type;
Index: gcc/testsuite/gfortran.dg/class_68.f90
===================================================================
*** gcc/testsuite/gfortran.dg/class_68.f90 (nonexistent)
--- gcc/testsuite/gfortran.dg/class_68.f90 (working copy)
***************
*** 0 ****
--- 1,25 ----
+ ! { dg-do compile }
+ !
+ ! Test the fix for PR83148.
+ !
+ ! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+ !
+ module fhypre
+ use iso_c_binding, only: c_ptr, c_null_ptr
+ use iso_c_binding, only: hypre_obj => c_ptr, hypre_null_obj => c_null_ptr
+ private
+ public :: hypre_obj, hypre_null_obj
+ end module
+
+ module hypre_hybrid_type
+ use fhypre
+ type hypre_hybrid
+ type(hypre_obj) :: solver = hypre_null_obj
+ end type hypre_hybrid
+ end module
+
+ use hypre_hybrid_type
+ class(hypre_hybrid), allocatable :: x
+ allocate (x)
+ end
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-23 12:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 12:39 [Patch, fortran] PR83148 [8 regression] ICE: crash_signal from toplev.c:325 Paul Richard Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).