[patch, fortran] PR33609 ICE on arithmetic overflow
Jerry DeLisle
jvdelisle@verizon.net
Sat Oct 6 23:40:00 GMT 2007
Hi,
The ICE is caused by a NULL pointer returned by arith.c (gfc_real2real) when
error condition is detected:
else if (rc != ARITH_OK)
{
arith_error (rc, &src->ts, &result->ts, &src->where);
gfc_free_expr (result);
return NULL;
}
Execution then goes back to the caller gfc_simplify_real which then does:
return range_check (result, "REAL");
The segfault occurs in range_check.
I will commit the following patch as obvious. Test case attached.
Regression tested on x86-64-Gnu-linux.
Jerry
Index: simplify.c
===================================================================
--- simplify.c (revision 129029)
+++ simplify.c (working copy)
@@ -70,6 +70,9 @@ gfc_expr gfc_bad_expr;
static gfc_expr *
range_check (gfc_expr *result, const char *name)
{
+ if (result == NULL)
+ return &gfc_bad_expr;
+
switch (gfc_range_check (result))
{
case ARITH_OK:
2007-10-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33609
* simplify.c (range_check): Return gfc_bad_expr if incoming expression
is NULL.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error_recovery_4.f90
Type: text/x-fortran
Size: 160 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071006/e1b17beb/attachment.bin>
More information about the Fortran
mailing list