[test-suite] r200154 - sgefa: Fix invalid memory access

Tobias Grosser tobias at grosser.es
Sun Jan 26 10:51:00 PST 2014


Author: grosser
Date: Sun Jan 26 12:51:00 2014
New Revision: 200154

URL: http://llvm.org/viewvc/llvm-project?rev=200154&view=rev
Log:
sgefa: Fix invalid memory access

In test case 4 all elements of the row are zero such that
the loop is exited due to the i < n condition. However, before
we can check this condition, we first access out of bound memory.
Switching the conditions fixes this problem.

Modified:
    test-suite/trunk/MultiSource/Applications/sgefa/blas.c

Modified: test-suite/trunk/MultiSource/Applications/sgefa/blas.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/sgefa/blas.c?rev=200154&r1=200153&r2=200154&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Applications/sgefa/blas.c (original)
+++ test-suite/trunk/MultiSource/Applications/sgefa/blas.c Sun Jan 26 12:51:00 2014
@@ -273,7 +273,7 @@ int	n, incx;
   i     = 0;
 
   /* Zero Sum. */
-  while( *sx == 0.0 && i<n ) {
+  while( i < n && *sx == 0.0 ) {
     i++;
     sx += incx;
   }





More information about the llvm-commits mailing list