From 673390625d47454c13f53fdf229bb3565ee6b2fc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 6 Jun 2008 15:23:04 +0200 Subject: [PATCH] re PR target/36362 (ICE in simplify_subreg) PR target/36362 * gimplify.c (gimplify_expr) : If *expr_p type is not bool, boolify the whole *expr_p and convert to the desired type. * gcc.c-torture/execute/20080529-1.c: New test. From-SVN: r136434 --- gcc/ChangeLog | 6 ++++++ gcc/gimplify.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 5 +++++ .../gcc.c-torture/execute/20080529-1.c | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20080529-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce1eae63991..c7da7ddecdd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-06-06 Jakub Jelinek + + PR target/36362 + * gimplify.c (gimplify_expr) : If *expr_p type + is not bool, boolify the whole *expr_p and convert to the desired type. + 2008-06-06 Jakub Jelinek * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP value to diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 0c2e5e24405..47a2fe7b43d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5890,8 +5890,14 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, break; case TRUTH_NOT_EXPR: - TREE_OPERAND (*expr_p, 0) - = gimple_boolify (TREE_OPERAND (*expr_p, 0)); + if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE) + { + tree type = TREE_TYPE (*expr_p); + *expr_p = fold_convert (type, gimple_boolify (*expr_p)); + ret = GS_OK; + break; + } + ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, is_gimple_val, fb_rvalue); recalculate_side_effects (*expr_p); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73e4a5e6c2a..a1ce73c2761 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-06 Jakub Jelinek + + PR target/36362 + * gcc.c-torture/execute/20080529-1.c: New test. + 2008-06-06 Jakub Jelinek * gcc.dg/gomp/collapse-1.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/20080529-1.c b/gcc/testsuite/gcc.c-torture/execute/20080529-1.c new file mode 100644 index 00000000000..cd429808496 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20080529-1.c @@ -0,0 +1,17 @@ +/* PR target/36362 */ + +extern void abort (void); + +int +test (float c) +{ + return !!c * 7LL == 0; +} + +int +main (void) +{ + if (test (1.0f) != 0) + abort (); + return 0; +} -- 2.30.2