This is the mail archive of the gcc@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]

Re: .bad_compare in bootstrap of head


Hi,
I found the problem. It was pretty obvious - we compute sum of times twice.
Once when computing statement sizes and second time by summing the summaries.
because sreal is not distributive, it leads to different results.

I have comitted the following patch.  Incrementally I will drop the
code duplication.

Bootstrapped/regtested x86_64-linux

Honza

--- trunk/gcc/ipa-inline-analysis.c	2017/05/07 19:41:09	247728
+++ trunk/gcc/ipa-inline-analysis.c	2017/05/07 22:21:05	247729
@@ -3119,12 +3120,13 @@
   info->size = info->self_size;
   info->stack_frame_offset = 0;
   info->estimated_stack_size = info->estimated_self_stack_size;
-  if (flag_checking)
-    {
-      inline_update_overall_summary (node);
-      gcc_assert (!(info->time - info->self_time).to_int ()
-		  && info->size == info->self_size);
-    }
+
+  /* Code above should compute exactly the same result as
+     inline_update_overall_summary but because computation happens in
+     different order the roundoff errors result in slight changes.  */
+  inline_update_overall_summary (node);
+  gcc_assert (!(info->time - info->self_time).to_int ()
+	      && info->size == info->self_size);
 }


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