From dd5e181890da34d717031748b797dd9e0bead5a3 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 23 Feb 2013 18:33:13 +0200 Subject: statistics.c: Fix a potential compiler bug triggered in gcc 3.4.5 This may look as a simple formatting change and won't make much sense to the C programmer. It is an actual bug fix in Subsurface for the target compiler, since it introduces bogus instructions. The "month" variable ends up being incremented up to 72 for a single "month++" call (if inside offset brackets). gcc -v Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw-vista special r3) OS: Windows 7 [6.1.7601] - x64 Better explained here: http://lists.hohndel.org/pipermail/subsurface/2013-February/003967.html Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- statistics.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'statistics.c') diff --git a/statistics.c b/statistics.c index 96bc5db36..9cbfcc72f 100644 --- a/statistics.c +++ b/statistics.c @@ -361,7 +361,8 @@ static void update_yearly_stats() for (j = 0; combined_months < stats_yearly[i].selection_size; ++j) { combined_months += stats_monthly[month].selection_size; - process_interval_stats(stats_monthly[month++], &year_iter, &month_iter); + process_interval_stats(stats_monthly[month], &year_iter, &month_iter); + month++; } } } -- cgit v1.2.3-70-g09d2