diff mbox series

[committed] PR fortran/95053 - ICE in gfc_divide(): Bad basic type

Message ID trinity-8be7b651-baf0-4d2f-9368-6248f2058fae-1589225449564@3c-app-gmx-bs77
State New
Headers show
Series [committed] PR fortran/95053 - ICE in gfc_divide(): Bad basic type | expand

Commit Message

Harald Anlauf May 11, 2020, 7:30 p.m. UTC
Committed as obvious.

Sorry for the breakage.


PR fortran/95053 - ICE in gfc_divide(): Bad basic type

	The fix for PR 93499 introduced a too strict check in gfc_divide
	that could trigger errors in the early parsing phase.  Relax the
	check and defer to a later stage.

gcc/fortran/

2020-05-11  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/95053
	* arith.c (gfc_divide): Do not error out if operand 2 is
	non-numeric.  Defer checks to later stage.

gcc/testsuite/

2020-05-11  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/95053
	* gfortran.dg/pr95053.f: New test.
diff mbox series

Patch

diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 1cd0867a941..dd72f44d377 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -1828,7 +1828,8 @@  gfc_divide (gfc_expr *op1, gfc_expr *op2)
            rc = ARITH_DIV0;
          break;
        default:
-         gfc_internal_error ("gfc_divide(): Bad basic type");
+         /* basic type is non-numeric, handle this elsewhere.  */
+         break;
        }
       if (rc == ARITH_DIV0)
        {
diff --git a/gcc/testsuite/gfortran.dg/pr95053.f b/gcc/testsuite/gfortran.dg/pr95053.f
new file mode 100644
index 00000000000..1d15c669467
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95053.f
@@ -0,0 +1,7 @@ 
+! { dg-do compile }
+! PR fortran/95053 - ICE in gfc_divide(): Bad basic type
+!
+ 123  FORMAT ('A'/'B')
+ 132  FORMAT (A/
+     +     ' B')
+      END