https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85740

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> These functions are not functional equivalent.
> 
> In the b.c, it records the max location but it is the last element which
> contains that value.  While in c.c, the first element which contains the
> value is recorded.

I do not understand.

The only difference between the files is

$ diff -u -b b.c c.c
--- b.c 2018-05-10 22:22:06.276904322 +0200
+++ c.c 2018-05-10 22:21:50.028801008 +0200
@@ -14,7 +14,7 @@
   nm = -1;
   for (i=0; i<n; i++)
     {
-      if (__builtin_expect (a[i] > m, 0))
+      if (a[i] > m)
        {
          m = a[i];
          nm = i;

Does this change the semantics of the comparison? If it does, it
would be a bug in __builtin_expect.

Reply via email to