[Bug fortran/31251] Non-integer character length leads to segfault

jvdelisle at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri May 4 05:42:00 GMT 2007



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-05-04 06:42 -------
I think the problem may be in arith.c (gfc_constant_result).  We are passing a
type real into this and so we do not mpz_init (result->value.integer);

Which we later try to set at simplify.c: 2143 
        mpz_set (result->value.integer, e->ts.cl->length->value.integer);
And it breaks sometimes.

As I said, I can not reproduce the bug, but this is my look into it for what
its worth.  You might try this and see what it does:

Index: arith.c
===================================================================
--- arith.c     (revision 124405)
+++ arith.c     (working copy)
@@ -420,6 +420,7 @@ gfc_constant_result (bt type, int kind, 

     case BT_REAL:
       gfc_set_model_kind (kind);
+      mpz_init (result->value.integer);
       mpfr_init (result->value.real);
       break;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31251



More information about the Gcc-bugs mailing list