The following testcase ICEs in C, because assume attribute condition
has int type rather than bool and the gimplification into GIMPLE_ASSUME
assigns it into a bool variable.
Fixed by calling gimple_boolify.
2022-10-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/107368
* gimplify.cc (gimplify_call_expr): For complex IFN_ASSUME
conditions call gimple_boolify on the condition.
* gcc.dg/attr-assume-5.c: New test.
a separate function easily. */
tree guard = create_tmp_var (boolean_type_node);
*expr_p = build2 (MODIFY_EXPR, void_type_node, guard,
- CALL_EXPR_ARG (*expr_p, 0));
+ gimple_boolify (CALL_EXPR_ARG (*expr_p, 0)));
*expr_p = build3 (BIND_EXPR, void_type_node, NULL, *expr_p, NULL);
push_gimplify_context ();
gimple_seq body = NULL;
--- /dev/null
+/* PR tree-optimization/107368 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+double
+f4 (double x)
+{
+ [[gnu::assume (x && x > 0.0)]];
+ return x;
+}