Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#7983 closed Bugs (worksforme)

Boost:: polygon have issues when compiled using gcc 4.7.x with -O2 optimization level.

Reported by: jp.charras@… Owned by: Andrii Sydorchuk
Milestone: To Be Determined Component: polygon
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc: herrold@…

Description

Difference (and Sum) of 2 polygons ( a main polygon, and a small polygon inside the main polygon) creates a void or erroneous polygon when compiled with gcc 4.7 and -O2 optimization, and the same code works fine when using -01 optimization, or when using a GCC version older than 4.7 (with any optimization level) (Tested on Mingw and Linux) ( This issue is also found in 1.49 and other boost versions I have used).

Attachments (1)

test_polygon_diff.cpp (3.0 KB ) - added by jp.charras@… 10 years ago.
sample of erroeous polygon when using gcc 4.7 with -O2 optimization level

Download all attachments as: .zip

Change History (10)

by jp.charras@…, 10 years ago

Attachment: test_polygon_diff.cpp added

sample of erroeous polygon when using gcc 4.7 with -O2 optimization level

comment:1 by Andrii Sydorchuk, 10 years ago

Owner: changed from Lucanus Simonson to Andrii Sydorchuk

comment:2 by Andrii Sydorchuk, 10 years ago

Resolution: worksforme
Status: newclosed

Please, verify with Boost 1.53. I was trying to reproduce the issue, but got the following output (both with -O1 and -O2): polyset polygons count 1 polygon 0, corners count 12

10, 10 5, 10 5, 5 5, -5 -5, -5 -5, 5 5, 5 5, 10 -10, 10 -10, -10 10, -10 10, 10

comment:3 by jp.charras@…, 10 years ago

Sorry for the delay. My tests are made using boost 1.53. I am thinking this issue is also on Linux, but I have a gcc 4.7 version only on Windows/mingw and I am able to test it only with gcc 4.7.2 on mingw (I have only the 4.6 version on my Linux install).

Here is my command to build the test program (using boost 1.53) g++ -Wall -O2 -I /g/boost_1_53_0 test_polygon_diff.cpp

and from gcc -v the gcc version is "gcc version 4.7.2 (GCC)"

Thanks.

the output is: polyset polygons count 0

(and works fine with O1 option)

comment:4 by Andrii Sydorchuk, 9 years ago

Resolution: worksforme
Status: closedreopened

comment:5 by Andrii Sydorchuk, 9 years ago

Is it feasible for you to verify the issue with g++ 4.7.3?

comment:6 by jp.charras@…, 9 years ago

I do not have g++ 4.7.3, therefore I asked for help from other developers, who made some tests (tested compil options: -O1, -O2, -O3). Here are results I received: gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773] (SUSE Linux): error gcc version 4.7.2 (Debian 4.7.2-5) 32 bit: error gcc version 4.7.3 (unknown linux distrib) 32 bit: OK gcc version 4.7.3 (unknown linux distrib) 64 bit: OK gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1): OK

I hope this is useful for you. Thanks for you work.

comment:7 by anonymous, 9 years ago

Looks like the error might be specific to the 32bit platform. I will try to install gcc 4.7.2 on my 64-bit ubuntu.

comment:8 by Andrii Sydorchuk, 9 years ago

Resolution: worksforme
Status: reopenedclosed

I was not able to reproduce the issue, thus marking it as not repeated. Potentially this defect has to do with the Polygon rounding modes and line intersections. If that's the case the issue will be tracked under ticket #6063.

comment:9 by R P Herrold <herrold@…>, 9 years ago

Cc: herrold@… added
Note: See TracTickets for help on using tickets.