This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix internal-fn handling in ipa-pure-const.c (PR rtl-optimization/70467)


Hi!

During testing of my PR70467 patch I've run into execute/va-arg-13.c
miscompilation, caused by ipa-pure-const.c in ipa mode saying a function
using VA_ARG internal function is pure - it might not be, e.g. on x86_64
where va_list is [1] array of struct and is passed to this "pure" function,
it modifies the va_list object in the caller.

As internal functions don't have corresponding cgraph edges, nothing handles
them after the initial walk over the function, so we need to always handle
internal calls there.

Bootstrapped/regtested on x86_64-linux and i686-linux, preapproved by Honza
on IRC, committed to trunk.

2016-05-02  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/70467
	* ipa-pure-const.c (check_call): Handle internal calls even in
	ipa mode like in local mode.

--- gcc/ipa-pure-const.c.jj	2016-04-22 18:21:36.000000000 +0200
+++ gcc/ipa-pure-const.c	2016-05-02 16:10:46.232077435 +0200
@@ -616,8 +616,10 @@ check_call (funct_state local, gcall *ca
   /* Either callee is unknown or we are doing local analysis.
      Look to see if there are any bits available for the callee (such as by
      declaration or because it is builtin) and process solely on the basis of
-     those bits. */
-  else if (!ipa)
+     those bits.  Handle internal calls always, those calls don't have
+     corresponding cgraph edges and thus aren't processed during
+     the propagation.  */
+  else if (!ipa || gimple_call_internal_p (call))
     {
       enum pure_const_state_e call_state;
       bool call_looping;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]