public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix builtin_mathfn_code ICE on internal fns (PR c++/84444)
  2018-02-19 19:49 [PATCH] Fix builtin_mathfn_code ICE on internal fns (PR c++/84444) Jakub Jelinek
@ 2018-02-19 19:33 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-02-19 19:33 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Biener, Jason Merrill; +Cc: gcc-patches

On 02/19/2018 12:11 PM, Jakub Jelinek wrote:
> Hi!
> 
> Many years ago Jason has added call to get_callee_fndecl, which does the
> right thing for internal functions as well as handles ADDR_EXPR and also
> casts and constant function pointers with a usable DECL_INITIAL, so while
> to fix this PR I could have added || CALL_EXPR_FN (t)) == NULL_TREE before
> the || TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR check, IMHO it is just
> better to remove it, get_callee_fndecl will DTRT.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 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.
> 
> 	* g++.dg/cpp1z/launder8.C: New test.
OK.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Fix builtin_mathfn_code ICE on internal fns (PR c++/84444)
@ 2018-02-19 19:49 Jakub Jelinek
  2018-02-19 19:33 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-02-19 19:49 UTC (permalink / raw)
  To: Richard Biener, Jeff Law, Jason Merrill; +Cc: gcc-patches

Hi!

Many years ago Jason has added call to get_callee_fndecl, which does the
right thing for internal functions as well as handles ADDR_EXPR and also
casts and constant function pointers with a usable DECL_INITIAL, so while
to fix this PR I could have added || CALL_EXPR_FN (t)) == NULL_TREE before
the || TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR check, IMHO it is just
better to remove it, get_callee_fndecl will DTRT.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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.

	* g++.dg/cpp1z/launder8.C: New test.

--- gcc/builtins.c.jj	2018-01-18 21:11:57.272207030 +0100
+++ gcc/builtins.c	2018-02-19 14:05:58.887842922 +0100
@@ -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);
--- gcc/testsuite/g++.dg/cpp1z/launder8.C.jj	2018-02-19 14:13:07.120887805 +0100
+++ gcc/testsuite/g++.dg/cpp1z/launder8.C	2018-02-19 14:12:43.369885316 +0100
@@ -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);
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-19 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 19:49 [PATCH] Fix builtin_mathfn_code ICE on internal fns (PR c++/84444) Jakub Jelinek
2018-02-19 19:33 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).