File: timer-test-use-volatile-for-locals.patch

package info (click to toggle)
glib2.0 2.84.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 66,112 kB
  • sloc: ansic: 538,924; python: 9,661; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (38 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Ryan Lortie <desrt@desrt.ca>
Date: Tue, 4 Mar 2014 09:20:38 -0500
Subject: timer test: use 'volatile' for locals

GCC seems to be failing to follow the letter of the C spec by allowing extra
precision in floating point values to persist across assignments which are
optimised away.

Force its hand by using 'volatile' on the locals in question.

Bug: https://gitlab.gnome.org/GNOME/glib/issues/820
Forwarded: yes
---
 glib/tests/timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index ae44dc8..5b1b43c 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -32,7 +32,7 @@ static void
 test_timer_basic (void)
 {
   GTimer *timer;
-  gdouble elapsed;
+  volatile gdouble elapsed;
   gulong micros;
 
   timer = g_timer_new ();
@@ -67,7 +67,7 @@ static void
 test_timer_stop (void)
 {
   GTimer *timer;
-  gdouble elapsed, elapsed2;
+  volatile gdouble elapsed, elapsed2;
 
   timer = g_timer_new ();