From 72bbb19cc7b313c03a77c5edb3a1c689469f5d5c Mon Sep 17 00:00:00 2001
From: Edoardo Prezioso <edo88@email.it>
Date: Sun, 25 May 2014 10:11:09 +0200
Subject: [PATCH] - Shut up GCC aggressive optimizer warnings.

From what I can see, GCC would miscompile the involved loops, because the index variable is 'signed int' and the multiplication with an unsigned would cause signed overflow (undefined behavior). Change the index variable type to 'unsigned int' to expect unsigned overflow (conformant to standard).
---
 src/g_heretic/a_hereticmisc.cpp  | 2 +-
 src/g_heretic/a_hereticweaps.cpp | 2 +-
 src/g_heretic/a_ironlich.cpp     | 2 +-
 src/g_hexen/a_iceguy.cpp         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp
index 83200068b8..2796354823 100644
--- a/src/g_heretic/a_hereticmisc.cpp
+++ b/src/g_heretic/a_hereticmisc.cpp
@@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
 
 DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
 {
-	int i;
+	unsigned int i;
 	AActor *tiny;
 	angle_t angle;
 
diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp
index 23ecf1ae59..17c9621d59 100644
--- a/src/g_heretic/a_hereticweaps.cpp
+++ b/src/g_heretic/a_hereticweaps.cpp
@@ -797,7 +797,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
 
 DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
 {
-	int i;
+	unsigned int i;
 	angle_t angle;
 	AActor *ripper;
 
diff --git a/src/g_heretic/a_ironlich.cpp b/src/g_heretic/a_ironlich.cpp
index 5801e6cac7..d8c1fd285c 100644
--- a/src/g_heretic/a_ironlich.cpp
+++ b/src/g_heretic/a_ironlich.cpp
@@ -171,7 +171,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
 
 DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
 {
-	int i;
+	unsigned int i;
 	angle_t angle;
 	AActor *shard;
 
diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp
index 2d908f9749..9d8360d4d5 100644
--- a/src/g_hexen/a_iceguy.cpp
+++ b/src/g_hexen/a_iceguy.cpp
@@ -125,7 +125,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
 DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
 {
 	AActor *mo;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < 8; i++)
 	{