From 5f92d10993787fa2074ca87117f9b92d4c8a2b3c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 19 Feb 2018 20:36:41 +0100 Subject: [PATCH] re PR c++/84444 (ICE with __builtin_launder and cast) PR c++/84444 * builtins.c (builtin_mathfn_code): Don't check if CALL_EXPR_FN (t) is ADDR_EXPR. * g++.dg/cpp1z/launder8.C: New test. From-SVN: r257822 --- gcc/ChangeLog | 4 ++++ gcc/builtins.c | 3 +-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp1z/launder8.C | 11 +++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/launder8.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13ce8f2001c..6bef46372ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-02-19 Jakub Jelinek + PR c++/84444 + * builtins.c (builtin_mathfn_code): Don't check if CALL_EXPR_FN (t) + is ADDR_EXPR. + PR tree-optimization/84452 * tree-vect-patterns.c (vect_recog_pow_pattern): Don't call expand_simd_clones if targetm.simd_clone.compute_vecsize_and_simdlen diff --git a/gcc/builtins.c b/gcc/builtins.c index 683c6ec6e5b..85affa74510 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7836,8 +7836,7 @@ builtin_mathfn_code (const_tree t) const_tree argtype, parmtype; const_call_expr_arg_iterator iter; - if (TREE_CODE (t) != CALL_EXPR - || TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR) + if (TREE_CODE (t) != CALL_EXPR) return END_BUILTINS; fndecl = get_callee_fndecl (t); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4df63d9963..04f9461bd0e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-02-19 Jakub Jelinek + PR c++/84444 + * g++.dg/cpp1z/launder8.C: New test. + PR c++/84448 * g++.dg/gomp/pr84448.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp1z/launder8.C b/gcc/testsuite/g++.dg/cpp1z/launder8.C new file mode 100644 index 00000000000..f57e91b60cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/launder8.C @@ -0,0 +1,11 @@ +// PR c++/84444 +// { dg-do compile } +// { dg-options "-O2" } + +struct A {}; + +__UINTPTR_TYPE__ +foo (A *p) +{ + return (__UINTPTR_TYPE__) __builtin_launder (p); +} -- 2.30.2