View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013955CMake(No Category)public2013-02-27 03:392016-06-10 14:31
ReporterMathieu Malaterre 
Assigned ToBill Hoffman 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0013955: warning: assuming signed overflow does not occur when simplifying conditional to constant
DescriptionCmake generates code which confuses gcc optimizer:


/home/mathieu/Perso/gdcm-gcc/Testing/Source/Common/Cxx/gdcmCommonTests.cxx: In function ‘int main(int, char**)’:
/home/mathieu/Perso/gdcm-gcc/Testing/Source/Common/Cxx/gdcmCommonTests.cxx:218: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]

Code generated by cmake is:

...
  /* If partial match is requested. */
  if(testToRun == -1 && ac > 1)
    {
    partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0;
    }
...


Looks like gcc thinks ac can be negative...
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032391)
Mathieu Malaterre (developer)
2013-02-27 03:43

Compilation option is:

CXXFLAGS=-O2 -Wstrict-overflow
(0032392)
Brad King (manager)
2013-02-27 08:29

I can reproduce this with g++ < 4.6 using -O3 -Wstrict-overflow, but not with -O2 or with g++ >= 4.6.

The problem is here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Templates/TestDriver.cxx.in;hb=v2.8.10.2#l72 [^]

in code of the form:

 if(ac < 2)
   {
   ...
   --ac;
   ...
   }

From that gcc concludes it is possible for ac to be negative.
(0032393)
Mathieu Malaterre (developer)
2013-02-27 08:42

Setup on my side is debian/sid:

$ /usr/bin/c++ --version
c++ (Debian 4.7.2-18) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cd /home/mathieu/Perso/gdcm-schroot/Testing/Source/MessageExchangeDefinition/Cxx && /usr/bin/c++ -Wstrict-overflow -O2 -I/home/mathieu/Perso/gdcm-schroot/Source/Common -I/home/mathieu/Perso/gdcm/Source/Common -I/home/mathieu/Perso/gdcm/Testing/Source/Data -I/home/mathieu/Perso/gdcm-schroot/Testing/Source/Data -I/home/mathieu/Perso/gdcm/Source/DataStructureAndEncodingDefinition -I/home/mathieu/Perso/gdcm/Source/DataDictionary -I/home/mathieu/Perso/gdcm/Source/MediaStorageAndFileFormat -I/home/mathieu/Perso/gdcm/Source/MessageExchangeDefinition -o CMakeFiles/gdcmMEXDTests.dir/gdcmMEXDTests.cxx.o -c /home/mathieu/Perso/gdcm-schroot/Testing/Source/MessageExchangeDefinition/Cxx/gdcmMEXDTests.cxx
/home/mathieu/Perso/gdcm-schroot/Testing/Source/MessageExchangeDefinition/Cxx/gdcmMEXDTests.cxx: In function 'int main(int, char**)':
/home/mathieu/Perso/gdcm-schroot/Testing/Source/MessageExchangeDefinition/Cxx/gdcmMEXDTests.cxx:147:3: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
(0042238)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-02-27 03:39 Mathieu Malaterre New Issue
2013-02-27 03:43 Mathieu Malaterre Note Added: 0032391
2013-02-27 08:29 Brad King Note Added: 0032392
2013-02-27 08:29 Brad King Assigned To => Bill Hoffman
2013-02-27 08:29 Brad King Status new => assigned
2013-02-27 08:42 Mathieu Malaterre Note Added: 0032393
2016-06-10 14:28 Kitware Robot Note Added: 0042238
2016-06-10 14:28 Kitware Robot Status assigned => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team