diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-12-14 16:11:17 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-12-14 16:11:17 +0100 |
commit | 4956b1f14709e967ec5a374a4f9f5bcdadaea480 (patch) | |
tree | 5b92aa98aad961b67cdefffbc0c12ff912bfdcd0 /gcc/fortran/resolve.c | |
parent | ae4dbd44baaea8b195e792c1865d02e8bf6c36b8 (diff) | |
download | gcc-4956b1f14709e967ec5a374a4f9f5bcdadaea480.zip gcc-4956b1f14709e967ec5a374a4f9f5bcdadaea480.tar.gz gcc-4956b1f14709e967ec5a374a4f9f5bcdadaea480.tar.bz2 |
re PR fortran/34398 (BOZ literals: Range checks)
2007-12-14 Tobias Burnus <burnus@net-b.de>
PR fortran/34398
* expr.c (gfc_check_assign): Add range checks for assignments of
* BOZs.
* resolve.c (resolve_ordinary_assign): Ditto.
* arith.c (gfc_range_check): Fix return value for complex
* numbers.
2007-12-14 Tobias Burnus <burnus@net-b.de>
PR fortran/34398
* gfortran.dg/nan_4.f90: New.
From-SVN: r130932
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c5b95b4..bee74e5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5921,12 +5921,29 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns) /* Handle the case of a BOZ literal on the RHS. */ if (rhs->is_boz && lhs->ts.type != BT_INTEGER) { + int rc; if (gfc_option.warn_surprising) gfc_warning ("BOZ literal at %L is bitwise transferred " "non-integer symbol '%s'", &code->loc, lhs->symtree->n.sym->name); gfc_convert_boz (rhs, &lhs->ts); + if ((rc = gfc_range_check (rhs)) != ARITH_OK) + { + if (rc == ARITH_UNDERFLOW) + gfc_error ("Arithmetic underflow of bit-wise transferred BOZ at %L" + ". This check can be disabled with the option " + "-fno-range-check", &rhs->where); + else if (rc == ARITH_OVERFLOW) + gfc_error ("Arithmetic overflow of bit-wise transferred BOZ at %L" + ". This check can be disabled with the option " + "-fno-range-check", &rhs->where); + else if (rc == ARITH_NAN) + gfc_error ("Arithmetic NaN of bit-wise transferred BOZ at %L" + ". This check can be disabled with the option " + "-fno-range-check", &rhs->where); + return false; + } } |