diff --git a/src/interfaces/ecpg/test/compat_informix/test_informix.pgc b/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
index 8b7692b0fdd1066e2b6d823a82c67cb482305ac8..82a7d45b7688ff5fe07b9d5fe4c132023783b4af 100644
--- a/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/test_informix.pgc
@@ -11,7 +11,7 @@ static void dosqlprint(void) {
 
 int main(void)
 {
-	$int i = 14;
+	$int i = 14, loopcount;
 	$decimal j, m, n;
 	$string c[10];
 
@@ -52,7 +52,7 @@ int main(void)
 
 	deccvint(0, &j);
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		$fetch forward c into :i, :j, :c;
 		if (sqlca.sqlcode == 100) break;
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
index 99349475f873cc25c0459c217e77f36eaec84124..644153449815f2894724bfb8fd8a5192704fb526 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
@@ -33,7 +33,7 @@ int main(void)
 {
 	
 #line 14 "test_informix.pgc"
- int i = 14 ;
+ int i = 14 , loopcount ;
 
 #line 14 "test_informix.pgc"
 
@@ -156,7 +156,7 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
 
 	deccvint(0, &j);
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch forward c", ECPGt_EOIT, 
 	ECPGt_int,&(i),(long)1,(long)1,sizeof(int), 
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
index ecd234311776ec29c2ddb26a1dc1b1767b5e906a..31679cbe84528be282caa6f3bf986d92c81c57c3 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
@@ -36,13 +36,13 @@ int
 main(void)
 {
 	/* exec sql begin declare section */
-		
+		 
 		
 		
 		
 	
 #line 21 "nan_test.pgc"
- int id ;
+ int id , loopcount ;
  
 #line 22 "nan_test.pgc"
  double d ;
@@ -90,7 +90,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 if (sqlca.sqlcode < 0) sqlprint ( );}
 #line 36 "nan_test.pgc"
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur", ECPGt_EOIT, 
 	ECPGt_int,&(id),(long)1,(long)1,sizeof(int), 
@@ -145,7 +145,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 if (sqlca.sqlcode < 0) sqlprint ( );}
 #line 52 "nan_test.pgc"
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur", ECPGt_EOIT, 
 	ECPGt_int,&(id),(long)1,(long)1,sizeof(int), 
@@ -229,7 +229,7 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
 if (sqlca.sqlcode < 0) sqlprint ( );}
 #line 78 "nan_test.pgc"
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from cur1", ECPGt_EOIT, 
 	ECPGt_int,&(id),(long)1,(long)1,sizeof(int), 
diff --git a/src/interfaces/ecpg/test/expected/preproc-autoprep.c b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
index 10ede3ec62771a2dc0775e73926b3be44e7e68c1..8ed5a2ca2c148954c030773a072076161c31e9d8 100644
--- a/src/interfaces/ecpg/test/expected/preproc-autoprep.c
+++ b/src/interfaces/ecpg/test/expected/preproc-autoprep.c
@@ -197,7 +197,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 
 
   i = 0;
-  while (1)
+  while (i < 100)
   {
 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur1", ECPGt_EOIT, 
 	ECPGt_int,&(item1),(long)1,(long)1,sizeof(int), 
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
index 65bafcdb83642e847bfe164242987e02ef9aa237..09be5ce9c91a10dd702f3f1a63a67877f76f5d29 100644
--- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
@@ -267,7 +267,7 @@ main (void)
 {
 	MYTYPE		*myvar;
 	MYNULLTYPE	*mynullvar;
-
+	int loopcount;
 	char msg[128];
 
 	ECPGdebug(1, stderr);
@@ -333,7 +333,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 #line 96 "outofscope.pgc"
 
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		memset(myvar, 0, sizeof(MYTYPE));
 		get_record1();
diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c
index 7fd03ba7d3992687cf565dca1a7aed937598fe4b..5bac808200267054045e3f53c1557141f7206e34 100644
--- a/src/interfaces/ecpg/test/expected/preproc-variable.c
+++ b/src/interfaces/ecpg/test/expected/preproc-variable.c
@@ -120,7 +120,7 @@ main (void)
 
 #line 37 "variable.pgc"
 
-
+	int loopcount;
 	char msg[128];
 
         ECPGdebug(1, stderr);
@@ -204,7 +204,7 @@ if (sqlca.sqlcode < 0) exit (1);}
 	p=&personal;
 	i=&ind_personal;
 	memset(i, 0, sizeof(ind_personal));
-	while (1) {
+	for (loopcount = 0; loopcount < 100; loopcount++) {
 		strcpy(msg, "fetch");
 		{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur", ECPGt_EOIT, 
 	ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)-1,sizeof( struct birthinfo ), 
diff --git a/src/interfaces/ecpg/test/expected/sql-fetch.c b/src/interfaces/ecpg/test/expected/sql-fetch.c
index b547b25c7a8b1e8da7eb7cbd700d83a71a7cdec4..b1b13aeb7529ba14ae0422887e49d422961b6058 100644
--- a/src/interfaces/ecpg/test/expected/sql-fetch.c
+++ b/src/interfaces/ecpg/test/expected/sql-fetch.c
@@ -25,13 +25,13 @@
 int main() {
   /* exec sql begin declare section */
      
-      
+       
   
 #line 9 "fetch.pgc"
  char str [ 25 ] ;
  
 #line 10 "fetch.pgc"
- int i , count = 1 ;
+ int i , count = 1 , loopcount ;
 /* exec sql end declare section */
 #line 11 "fetch.pgc"
 
@@ -112,7 +112,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
   /* exec sql whenever not found  break ; */
 #line 30 "fetch.pgc"
 
-  while (1) {
+  for (loopcount = 0; loopcount < 100; loopcount++) {
 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT, 
 	ECPGt_int,&(i),(long)1,(long)1,sizeof(int), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
@@ -191,7 +191,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
   /* exec sql whenever not found  break ; */
 #line 48 "fetch.pgc"
 
-  while (1) {
+  for (loopcount = 0; loopcount < 100; loopcount++) {
 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in D", ECPGt_EOIT, 
 	ECPGt_int,&(i),(long)1,(long)1,sizeof(int), 
 	ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
diff --git a/src/interfaces/ecpg/test/expected/sql-quote.c b/src/interfaces/ecpg/test/expected/sql-quote.c
index 0a3b77c57565399d2490ffafd96f6225b7d86d52..7943384fd87292ad3dfb26553881e4af47d0650e 100644
--- a/src/interfaces/ecpg/test/expected/sql-quote.c
+++ b/src/interfaces/ecpg/test/expected/sql-quote.c
@@ -25,13 +25,13 @@
 int main() {
   /* exec sql begin declare section */
      
-     
+      
   
 #line 9 "quote.pgc"
  char var [ 25 ] ;
  
 #line 10 "quote.pgc"
- int i ;
+ int i , loopcount ;
 /* exec sql end declare section */
 #line 11 "quote.pgc"
 
@@ -176,7 +176,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
 #line 47 "quote.pgc"
 
 
-  while (true)
+  for (loopcount = 0; loopcount < 100; loopcount++)
   {
 	{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch C", ECPGt_EOIT, 
 	ECPGt_int,&(i),(long)1,(long)1,sizeof(int), 
diff --git a/src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc b/src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
index 3b5781632e87c6195c5f3aad3870b5f7bf15d2db..d4ce2113bfadf5eefbb240e3e3e99c9c2b5a12a3 100644
--- a/src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
+++ b/src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
@@ -18,7 +18,7 @@ int
 main(void)
 {
 	exec sql begin declare section;
-	int	id;
+	int	id, loopcount;
 	double	d;
 	numeric	*num;
 	char	val[16];
@@ -34,7 +34,7 @@ main(void)
 
 	exec sql declare cur cursor for select id, d, d from nantest1;
 	exec sql open cur;
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		exec sql fetch from cur into :id, :d, :val;
 		if (sqlca.sqlcode)
@@ -50,7 +50,7 @@ main(void)
 	exec sql close cur;
 
 	exec sql open cur;
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		exec sql fetch from cur into :id, :d, :val;
 		if (sqlca.sqlcode)
@@ -76,7 +76,7 @@ main(void)
 
 	exec sql declare cur1 cursor for select id, d, d from nantest2;
 	exec sql open cur1;
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		exec sql fetch from cur1 into :id, :num, :val;
 		if (sqlca.sqlcode)
diff --git a/src/interfaces/ecpg/test/preproc/autoprep.pgc b/src/interfaces/ecpg/test/preproc/autoprep.pgc
index 31c3ab7a56ec8f796405553409343082b862d812..d3d9305da5b92ba6360a853a381f81f7e7d23a9c 100644
--- a/src/interfaces/ecpg/test/preproc/autoprep.pgc
+++ b/src/interfaces/ecpg/test/preproc/autoprep.pgc
@@ -50,7 +50,7 @@ static void test(void) {
   EXEC SQL WHENEVER NOT FOUND DO BREAK;
 
   i = 0;
-  while (1)
+  while (i < 100)
   {
 	EXEC SQL FETCH cur1 INTO :item1:ind1;
 	printf("item[%d] = %d\n", i, ind1 ? -1 : item1);
diff --git a/src/interfaces/ecpg/test/preproc/outofscope.pgc b/src/interfaces/ecpg/test/preproc/outofscope.pgc
index 6322114729684b3701046cec7e3bb7e4b6bcb78b..642835400b2629efa809b71cd11db59ed8267538 100644
--- a/src/interfaces/ecpg/test/preproc/outofscope.pgc
+++ b/src/interfaces/ecpg/test/preproc/outofscope.pgc
@@ -66,7 +66,7 @@ main (void)
 {
 	MYTYPE		*myvar;
 	MYNULLTYPE	*mynullvar;
-
+	int loopcount;
 	char msg[128];
 
 	ECPGdebug(1, stderr);
@@ -95,7 +95,7 @@ main (void)
 
 	exec sql whenever not found do break;
 
-	while (1)
+	for (loopcount = 0; loopcount < 100; loopcount++)
 	{
 		memset(myvar, 0, sizeof(MYTYPE));
 		get_record1();
diff --git a/src/interfaces/ecpg/test/preproc/variable.pgc b/src/interfaces/ecpg/test/preproc/variable.pgc
index 05420afdb2c489296b6c589d65245d18197105cc..c75d8f49dbadebc380379c5754780b2c753acd88 100644
--- a/src/interfaces/ecpg/test/preproc/variable.pgc
+++ b/src/interfaces/ecpg/test/preproc/variable.pgc
@@ -35,7 +35,7 @@ exec sql end declare section;
 	exec sql char *married = NULL;
 	exec sql long ind_married;
 	exec sql ind children;
-
+	int loopcount;
 	char msg[128];
 
         ECPGdebug(1, stderr);
@@ -67,7 +67,7 @@ exec sql end declare section;
 	p=&personal;
 	i=&ind_personal;
 	memset(i, 0, sizeof(ind_personal));
-	while (1) {
+	for (loopcount = 0; loopcount < 100; loopcount++) {
 		strcpy(msg, "fetch");
 		exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
 		printf("%8.8s", personal.name.arr);
diff --git a/src/interfaces/ecpg/test/sql/fetch.pgc b/src/interfaces/ecpg/test/sql/fetch.pgc
index aade678efbef51603aa0f677089c4a2ac0e43f01..8a5d07994ab027cfb92a0116796b219983aab5e1 100644
--- a/src/interfaces/ecpg/test/sql/fetch.pgc
+++ b/src/interfaces/ecpg/test/sql/fetch.pgc
@@ -7,7 +7,7 @@ EXEC SQL INCLUDE ../regression;
 int main() {
   EXEC SQL BEGIN DECLARE SECTION;
     char str[25];
-    int i, count=1;
+    int i, count=1, loopcount;
   EXEC SQL END DECLARE SECTION;
 
   ECPGdebug(1, stderr);
@@ -28,7 +28,7 @@ int main() {
   EXEC SQL OPEN C;
 
   EXEC SQL WHENEVER NOT FOUND DO BREAK;
-  while (1) {
+  for (loopcount = 0; loopcount < 100; loopcount++) {
 	EXEC SQL FETCH 1 IN C INTO :i, :str;
 	printf("%d: %s\n", i, str);
   }
@@ -46,7 +46,7 @@ int main() {
   EXEC SQL OPEN D using 1;
 
   EXEC SQL WHENEVER NOT FOUND DO BREAK;
-  while (1) {
+  for (loopcount = 0; loopcount < 100; loopcount++) {
 	EXEC SQL FETCH 1 IN D INTO :i, :str;
 	printf("%d: %s\n", i, str);
   }
diff --git a/src/interfaces/ecpg/test/sql/quote.pgc b/src/interfaces/ecpg/test/sql/quote.pgc
index 9dd997323cc720f64b367af5661c940576e5b0e0..83efb034840005539dca025c30a0d13a3dfbe537 100644
--- a/src/interfaces/ecpg/test/sql/quote.pgc
+++ b/src/interfaces/ecpg/test/sql/quote.pgc
@@ -7,7 +7,7 @@ EXEC SQL INCLUDE ../regression;
 int main() {
   EXEC SQL BEGIN DECLARE SECTION;
     char var[25];
-    int i;
+    int i, loopcount;
   EXEC SQL END DECLARE SECTION;
 
   ECPGdebug(1, stderr);
@@ -46,7 +46,7 @@ int main() {
 
   EXEC SQL WHENEVER NOT FOUND DO BREAK;
 
-  while (true)
+  for (loopcount = 0; loopcount < 100; loopcount++)
   {
 	EXEC SQL FETCH C INTO :i, :var;
 	printf("value: %d %s\n", i, var);