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
This commit is contained in:
Ryan Lortie 2014-03-04 09:20:38 -05:00 committed by su-fang
parent f9b82a6fa3
commit 7985d0ce93
1 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ static void
test_timer_basic (void)
{
GTimer *timer;
gdouble elapsed;
volatile gdouble elapsed;
gulong micros;
timer = g_timer_new ();
@ -65,7 +65,7 @@ static void
test_timer_stop (void)
{
GTimer *timer;
gdouble elapsed, elapsed2;
volatile gdouble elapsed, elapsed2;
timer = g_timer_new ();