public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] Preparatory patch to change charlen's kind type
@ 2016-10-20  8:37 Andre Vehreschild
  2016-10-20  9:57 ` Janne Blomqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Andre Vehreschild @ 2016-10-20  8:37 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

Hi all,

during hacking in gfortran I found, that for unlimited polymorphic types the
size type of a char array stored is hard coded to be 4. This small patch
resolves this by using the better suited constant: gfc_charlen_int_kind. This
will make the move to larger strings easier.

Bootstrapped and regtested on x86_64-linux/F23. Ok for trunk?

Regards,
	Andre

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 6d324a6..e110f2c 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -707,7 +707,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute
*attr, if (!gfc_add_component (fclass, "_len", &c))
            return false;
          c->ts.type = BT_INTEGER;
-         c->ts.kind = 4;
+         c->ts.kind = gfc_charlen_int_kind;
          c->attr.access = ACCESS_PRIVATE;
          c->attr.artificial = 1;
        }

-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Fortran] Preparatory patch to change charlen's kind type
  2016-10-20  8:37 [Patch, Fortran] Preparatory patch to change charlen's kind type Andre Vehreschild
@ 2016-10-20  9:57 ` Janne Blomqvist
  2016-10-20 10:51   ` Andre Vehreschild
  0 siblings, 1 reply; 3+ messages in thread
From: Janne Blomqvist @ 2016-10-20  9:57 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: GCC-Patches-ML, GCC-Fortran-ML

On Thu, Oct 20, 2016 at 11:37 AM, Andre Vehreschild <vehre@gmx.de> wrote:
> Hi all,
>
> during hacking in gfortran I found, that for unlimited polymorphic types the
> size type of a char array stored is hard coded to be 4. This small patch
> resolves this by using the better suited constant: gfc_charlen_int_kind. This
> will make the move to larger strings easier.
>
> Bootstrapped and regtested on x86_64-linux/F23. Ok for trunk?
>
> Regards,
>         Andre
>
> diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
> index 6d324a6..e110f2c 100644
> --- a/gcc/fortran/class.c
> +++ b/gcc/fortran/class.c
> @@ -707,7 +707,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute
> *attr, if (!gfc_add_component (fclass, "_len", &c))
>             return false;
>           c->ts.type = BT_INTEGER;
> -         c->ts.kind = 4;
> +         c->ts.kind = gfc_charlen_int_kind;
>           c->attr.access = ACCESS_PRIVATE;
>           c->attr.artificial = 1;
>         }
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de

Ok, thanks for catching this!


-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Fortran] Preparatory patch to change charlen's kind type
  2016-10-20  9:57 ` Janne Blomqvist
@ 2016-10-20 10:51   ` Andre Vehreschild
  0 siblings, 0 replies; 3+ messages in thread
From: Andre Vehreschild @ 2016-10-20 10:51 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: GCC-Patches-ML, GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

Hi Janne,

thanks for the fast review.

> Ok, thanks for catching this!

Well, I am quite sure, that I wrote this crab initially.

Committed as r241367.

Regards,
	Andre

On Thu, 20 Oct 2016 12:57:38 +0300
Janne Blomqvist <blomqvist.janne@gmail.com> wrote:

> On Thu, Oct 20, 2016 at 11:37 AM, Andre Vehreschild <vehre@gmx.de> wrote:
> > Hi all,
> >
> > during hacking in gfortran I found, that for unlimited polymorphic types the
> > size type of a char array stored is hard coded to be 4. This small patch
> > resolves this by using the better suited constant: gfc_charlen_int_kind.
> > This will make the move to larger strings easier.
> >
> > Bootstrapped and regtested on x86_64-linux/F23. Ok for trunk?
> >
> > Regards,
> >         Andre
> >
> > diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
> > index 6d324a6..e110f2c 100644
> > --- a/gcc/fortran/class.c
> > +++ b/gcc/fortran/class.c
> > @@ -707,7 +707,7 @@ gfc_build_class_symbol (gfc_typespec *ts,
> > symbol_attribute *attr, if (!gfc_add_component (fclass, "_len", &c))
> >             return false;
> >           c->ts.type = BT_INTEGER;
> > -         c->ts.kind = 4;
> > +         c->ts.kind = gfc_charlen_int_kind;
> >           c->attr.access = ACCESS_PRIVATE;
> >           c->attr.artificial = 1;
> >         }
> >
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de  
> 
> Ok, thanks for catching this!
> 
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 870 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 241365)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2016-10-20  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* class.c (gfc_build_class_symbol): Set the kind of _len to
+	gfc_charlen_int_kind to catch changes of the charlen kind.
+
 2016-10-17  Steven G. Kargl  <kargl@gcc.gnu.org>
 
 	PR fortran/77978
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c	(Revision 241365)
+++ gcc/fortran/class.c	(Arbeitskopie)
@@ -707,7 +707,7 @@
 	  if (!gfc_add_component (fclass, "_len", &c))
 	    return false;
 	  c->ts.type = BT_INTEGER;
-	  c->ts.kind = 4;
+	  c->ts.kind = gfc_charlen_int_kind;
 	  c->attr.access = ACCESS_PRIVATE;
 	  c->attr.artificial = 1;
 	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-20 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20  8:37 [Patch, Fortran] Preparatory patch to change charlen's kind type Andre Vehreschild
2016-10-20  9:57 ` Janne Blomqvist
2016-10-20 10:51   ` Andre Vehreschild

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).