Hi, sorry for the belated reply.
On 07.03.23 09:55, HAO CHEN GUI wrote:
2023-03-07 Haochen Gui <guih...@linux.ibm.com> gcc/ PR target/103628 * fortran/target-memory.cc (gfc_interpret_float): Return FAIL when native_interpret_expr gets a NULL tree. * fortran/arith.cc (gfc_hollerith2real): Return NULL when gfc_interpret_float fails. * fortran/error.cc (gfc_buffered_p): Define. * fortran/gfortran.h (gfc_buffered_p): Declare. * fortran/intrinsic.cc: Add diagnostic.h to include list. (do_simplify): Save errorcount and check it at finish. Report a "Cannot simplify expression" error on a bad result if error count doesn't change and no other errors buffered. gcc/testsuite/ PR target/103628 * gfortran.dg/pr103628.f90: New. Co-Authored-By: Tobias Burnus <tob...@codesourcery.com>
...
--- a/gcc/fortran/intrinsic.cc +++ b/gcc/fortran/intrinsic.cc
...
@@ -4708,7 +4710,12 @@ do_simplify (gfc_intrinsic_sym *specific, gfc_expr *e) finish: if (result == &gfc_bad_expr) - return false; + { + if (errorcount == old_errorcount + && (gfc_buffered_p () && !gfc_error_flag_test ())) + gfc_error ("Cannot simplify expression at %L", &e->where); + return false; + }
The condition looks wrong. Shouldn't it be something like + && (!gfc_buffered_p () || !gfc_error_flag_test ())) Namely: * If there is no buffering, we know that no error has been printed → call error. * With buffering, we additionally need to check for buffered errors. No buffered error → call error. Otherwise LGTM. Thus, if my comment makes sense to you + it regtests, modify it, and go ahead and commit it. Sorry for the delay - and thanks again for the patch! Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955