check for ISL generated code that leads to division by zero
authorAditya Kumar <aditya.k7@samsung.com>
Mon, 30 Nov 2015 20:39:16 +0000 (20:39 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Mon, 30 Nov 2015 20:39:16 +0000 (20:39 +0000)
commit610a61a7bea584b05fc1a749c63b3e4af284ebae
treef513f6a889d0a05a622ff54b851858c1b94032b9
parent49385686db08da967279598d5079050794884e58
check for ISL generated code that leads to division by zero

we used to generate modulo and division by zero because ISL uses big numbers
which translate to zero in modulo arithmetic.  The patch also improves error handling
and bails out early in case of wrong code gen.

PR tree-optimization/68565
* graphite-isl-ast-to-gimple.c (binary_op_to_tree): Early return on
codegen_error.  Fail when rhs of division operations is integer_zerop.
(ternary_op_to_tree): Early return on codegen_error.
(unary_op_to_tree): Same.
(nary_op_to_tree): Same.
(gcc_expression_from_isl_expr_op): Same.
(gcc_expression_from_isl_expression): Same.
(graphite_create_new_loop): On codegen_error continue generating
wrong code.
(graphite_create_new_loop_guard): Same.
(build_iv_mapping): Same.
(graphite_create_new_guard): Same.

* gfortran.dg/graphite/pr68565.f90: New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r231086
gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/graphite/pr68565.f90 [new file with mode: 0644]