This is the mail archive of the gcc-testresults@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

found an issue in testsuite/libgomp.c++/for-3.C


hello,

i have checked the sources of g++-4.4.1 with the static code analysis tool cppcheck. It found an issue in file gcc-4.4.1/libgomp/testsuite/libgomp.c++/for-3.C at line 49.

I brought the following warning:
vector range should use != and not < since the order of the pointers is not guaranteed.

Take a look at the code:

void
f2 (const std::vector<int>::const_iterator &x,
    const std::vector<int>::const_iterator &y)
{
  std::vector<int>::const_iterator i;
#pragma omp parallel for private(i)
  for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
    baz (i);
}

Indeed, the static code analysis tool is right. It would be better to compare the pointers with the !=-operator not with '<'.

Best regards

Ettl Martin



-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]