https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86119

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> Likely revision r256284.

Certainly.

For the code in comment 0, -fdump-tree-original shows:

          l2 = (integer(kind=4)) s._len;

Apparently the _len component of the class container has kind=8.

The following patch manages to remove the conversion warning:


diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 2eae7f0f351..cbc2c72ae3f 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -709,7 +709,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 = gfc_charlen_int_kind;
+         c->ts.kind = gfc_default_integer_kind;
          c->attr.access = ACCESS_PRIVATE;
          c->attr.artificial = 1;
        }


However, instead of this, we should rather insert an explicit conversion to get
rid of the warning, I think.

Reply via email to