This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] PR32432 SEGV/endless loop after: "ERROR: ... already is initialized"
- From: "Janne Blomqvist" <blomqvist dot janne at gmail dot com>
- To: "Jerry DeLisle" <jvdelisle at verizon dot net>
- Cc: "Fortran List" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 3 Jul 2007 10:18:24 +0300
- Subject: Re: [patch, fortran] PR32432 SEGV/endless loop after: "ERROR: ... already is initialized"
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RSW1XABmsD9ooVseRdPR0uWnnbdVY8W6iVccf5wkJcPkhfMFzxL7COU6DsDVWbl6+Abn7som2LNweoJL5Au4q9ZcfPeK6MqpDAYjOqei6FqGcI+C8tEpAjd+qrfGTwusnCVGL7QWIEGM3gvnTSNhvssXC7AfSfPj41wsQMSCAHE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WU6UHHBSeTCIGhr3rmsXATHKXny1lgpz78MRTcNFTA0E1DK9/if1Gj/jZSMrGP8fFhPGmEQ92qIqy54Eokig89P2AmZlxz/cIxldh0GttA0xAWyw4Mg/ZUefQat+8/BCfqqj590T8Vayui11mqX407kl1L+M+sOzBzkk6B45a5o=
- References: <4689DD81.1090406@verizon.net>
:REVIEWMAIL:
On 7/3/07, Jerry DeLisle <jvdelisle@verizon.net> wrote:
OK for trunk?
Yes. A few minor issues below though.
*************** gfc_assign_data_value (gfc_expr *lvalue,
*** 293,300 ****
gfc_error ("'%s' at %L already is initialized at %L",
lvalue->symtree->n.sym->name, &lvalue->where,
&init->where);
! gfc_free_expr (init);
! init = NULL;
}
if (init == NULL)
--- 295,301 ----
gfc_error ("'%s' at %L already is initialized at %L",
lvalue->symtree->n.sym->name, &lvalue->where,
&init->where);
! return FAILURE;
}
Won't this create a memory leak as you are no longer freeing init?
*************** gfc_assign_data_value (gfc_expr *lvalue,
*** 423,428 ****
--- 424,431 ----
symbol->value = expr;
else
last_con->expr = expr;
+
+ return t;
}
Why not get rid of the t variable and just "return SUCCESS;", since
you never actually use the t variable for anything beyond initially
setting it to SUCCESS?
Similarly in resolve.c,
! t = gfc_assign_data_value (var->expr, values.vnode->expr, offset);
! if (t == FAILURE)
! break;
Why not just
if (gfc_assign_data_value (...) == FAILURE)
break;
Finally, please use unified diffs in the future; I suspect I'm not the
only one who has difficulties following context diffs.
Thanks for the patch.
--
Janne Blomqvist