https://bugs.kde.org/show_bug.cgi?id=79362

--- Comment #72 from Julian Seward <jsew...@acm.org> ---
(In reply to Philippe Waroquiers from comment #71)
> Created attachment 107073 [details]
> (hack) : patch that adds measurement code to scan the EC for a .so unload

+            for (j = 0; j < ec->n_ips; j++) {
+               if (UNLIKELY(ec->ips[j] >= from && ec->ips[j] <= to)) {
+                  break;
+               }
+            }

This is a side-effect-free loop whose only computed value (j) is unused,
and provably terminates.  I think it's likely that gcc noticed all 3 facts
and deleted the loop.

Do you get different results if you change it like this?

+            for (j = 0; j < ec->n_ips; j++) {
+               if (UNLIKELY(ec->ips[j] >= from && ec->ips[j] <= to)) {
                   __asm__ __volatile__("":::"cc","memory");
+                  break;
+               }
+            }

The (empty) inline assembly claims to make arbitrary changes to memory and
might scare gcc into keeping the loop alive.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to