* [patch, fortran] Fix PR 78238, ICE with SELECT TYPE with -fdefault-integer-8
@ 2018-02-24 20:04 Thomas Koenig
2018-02-24 21:52 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2018-02-24 20:04 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hello world,
the attached patch fixes a 7/8 regression with SELECT TYPE where
the constant had the wrong type with -fdefault-integer-8.
Regression-tested. OK for trunk and gcc-7?
Regards
Thomas
2018-01-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78238
* gfortran.h (gfc_integer_4_kind): Define.
* resolve.c (resolve_select_type): Make sure that the
kind of c->high is gfc_integer_4_kind.
2018-01-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78238
* gfortran.dg/select_type_40.f90: New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 1320 bytes --]
Index: gfortran.h
===================================================================
--- gfortran.h (Revision 257788)
+++ gfortran.h (Arbeitskopie)
@@ -2921,6 +2921,7 @@ extern int gfc_numeric_storage_size;
extern int gfc_character_storage_size;
#define gfc_logical_4_kind 4
+#define gfc_integer_4_kind 4
/* symbol.c */
void gfc_clear_new_implicit (void);
Index: resolve.c
===================================================================
--- resolve.c (Revision 257788)
+++ resolve.c (Arbeitskopie)
@@ -8965,7 +8965,7 @@ resolve_select_type (gfc_code *code, gfc_namespace
{
vtab = gfc_find_derived_vtab (c->ts.u.derived);
gcc_assert (vtab);
- c->high = gfc_get_int_expr (gfc_default_integer_kind, NULL,
+ c->high = gfc_get_int_expr (gfc_integer_4_kind, NULL,
c->ts.u.derived->hash_value);
}
else
@@ -8974,6 +8974,13 @@ resolve_select_type (gfc_code *code, gfc_namespace
gcc_assert (vtab && CLASS_DATA (vtab)->initializer);
e = CLASS_DATA (vtab)->initializer;
c->high = gfc_copy_expr (e);
+ if (c->high->ts.kind != gfc_integer_4_kind)
+ {
+ gfc_typespec ts;
+ ts.kind = gfc_integer_4_kind;
+ ts.type = BT_INTEGER;
+ gfc_convert_type_warn (c->high, &ts, 2, 0);
+ }
}
e = gfc_lval_expr_from_sym (vtab);
[-- Attachment #3: select_type_40.f90 --]
[-- Type: text/x-fortran, Size: 229 bytes --]
! { dg-do compile }
! { dg-additional-options "-fdefault-integer-8" }
! PR 78238 - this used to cause an ICE.
! Original test cae by Gerhard Steinmetz
class(*), allocatable :: q
select type (x => q)
type is (real)
end select
end
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Fix PR 78238, ICE with SELECT TYPE with -fdefault-integer-8
2018-02-24 20:04 [patch, fortran] Fix PR 78238, ICE with SELECT TYPE with -fdefault-integer-8 Thomas Koenig
@ 2018-02-24 21:52 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2018-02-24 21:52 UTC (permalink / raw)
To: Thomas Koenig, fortran, gcc-patches
On 02/24/2018 12:04 PM, Thomas Koenig wrote:
> Hello world,
>
> the attached patch fixes a 7/8 regression with SELECT TYPE where
> the constant had the wrong type with -fdefault-integer-8.
>
> Regression-tested. OK for trunk and gcc-7?
>
> Regards
>
> Â Â Â Â Thomas
>
> 2018-01-24 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> Â Â Â Â Â Â Â PR fortran/78238
> Â Â Â Â Â Â Â * gfortran.h (gfc_integer_4_kind): Define.
> Â Â Â Â Â Â Â * resolve.c (resolve_select_type): Make sure that the
> Â Â Â Â Â Â Â kind of c->high is gfc_integer_4_kind.
>
> 2018-01-24 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> Â Â Â Â Â Â Â PR fortran/78238
> Â Â Â Â Â Â Â * gfortran.dg/select_type_40.f90: New test.
OK Thomas,
Regards,
Jerry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-24 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24 20:04 [patch, fortran] Fix PR 78238, ICE with SELECT TYPE with -fdefault-integer-8 Thomas Koenig
2018-02-24 21:52 ` Jerry DeLisle
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).