re PR c++/84444 (ICE with __builtin_launder and cast)
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Feb 2018 19:36:41 +0000 (20:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 19 Feb 2018 19:36:41 +0000 (20:36 +0100)
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
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/launder8.C [new file with mode: 0644]

index 13ce8f2001c7b5775461d70dbd46919755761db4..6bef46372ac61ec7e8522513e0ceedc9400c72e6 100644 (file)
@@ -1,5 +1,9 @@
 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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
index 683c6ec6e5b814ee2650f8a5bf538d4f394c7ae6..85affa74510faf96f156f2253bc2b3f169ca7a1f 100644 (file)
@@ -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);
index b4df63d996331c36d7b5d5ef1d56c59342a7cbc2..04f9461bd0ebb57fe4943206be907b9a54b2fec3 100644 (file)
@@ -1,5 +1,8 @@
 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..f57e91b
--- /dev/null
@@ -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);
+}