aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2020-01-22 01:23:42 +0000
committerJoseph Myers <joseph@codesourcery.com>2020-01-22 01:23:42 +0000
commitac68e287fc2e939ae6b45ba7ff04e493982b7f62 (patch)
tree8f08fff66240c6eb9b094d4599df8dfc07dd2360 /gcc/testsuite/gcc.c-torture
parent4e9b9a6cb52b0c8b5f97dd279deff967f75c4fc9 (diff)
downloadgcc-ac68e287fc2e939ae6b45ba7ff04e493982b7f62.zip
gcc-ac68e287fc2e939ae6b45ba7ff04e493982b7f62.tar.gz
gcc-ac68e287fc2e939ae6b45ba7ff04e493982b7f62.tar.bz2
Fix ICE with cast of division by zero (PR c/93348).
Bug 93348 reports an ICE on certain cases of casts of expressions that may appear only in unevaluated parts of integer constant expressions, arising from the generation of nested C_MAYBE_CONST_EXPRs. This patch fixes it by adding a call to remove_c_maybe_const_expr in the integer-operands case, as is done in other similar cases. Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/93348 gcc/c: * c-typeck.c (build_c_cast): Call remove_c_maybe_const_expr on argument with integer operands. gcc/testsuite: * gcc.c-torture/compile/pr93348-1.c: New test.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr93348-1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr93348-1.c b/gcc/testsuite/gcc.c-torture/compile/pr93348-1.c
new file mode 100644
index 0000000..d2edec5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr93348-1.c
@@ -0,0 +1,5 @@
+int
+ya (void)
+{
+ return (long int) (1 / 0);
+}