This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR fortran/84734 -- Fix ICE on invalid code


In fixing PR fortran/83633, it seems the patch I committed
introduced an ICE for nonsensical invalid Fortran.  The 
attached patch cures the ICE and now (re)issues an error
message.

The basic problem seems to boil down to the recursive 
calling of gfc_simplify_expr reduces "huge(1_8)+1_8" to
"constant + constant".  When the chain of gfc_simplify_expr
tries to reduces this expression an overflow occurs.  An
error message is queud but never emitted, and the result
is set to NULL and both constants are freed.  The NULL is
passed back up through the chain of gfc_simplify_expr.
At some point that NULL pointer is referenced.  The patch
works around the problem by passing the result with the
overflow value up the chain.  

Regression tested on x86_64-*-freebsd.  I intend to commit
this patch tomorrow, which on my clock is only 2.75 hours
away.

2018-03-09  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/84734
        * arith.c (check_result, eval_intrinsic):  If result overflows, pass
        the expression up the chain instead of a NULL pointer.

2018-03-09  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/84734
        * gfortran.dg/pr84734.f90: New test.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]