[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-05-04 Thread tony3 at GarlandConsulting dot us
--- Comment #25 from tony3 at GarlandConsulting dot us 2010-05-04 16:06 --- (In reply to comment #24) > G++ 4.6 will no longer optimize away the exit condition unless -fstrict-enums > is specified. > I'm very encouraged by this. Thanks for responding to this concern

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-28 Thread tony3 at GarlandConsulting dot us
--- Comment #23 from tony3 at GarlandConsulting dot us 2010-01-28 17:16 --- Jonathan, Thanks for explaining that operation outside the norm is unspecified such that the compiler can do anything and everything. >I think a warning for this would be helpful, but asking for the compi

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-27 Thread tony3 at GarlandConsulting dot us
--- Comment #21 from tony3 at GarlandConsulting dot us 2010-01-27 22:24 --- Thanks for that last example which does illustrate a condition where -O0 terminates and -O2 never does. So we've established there are other looping situations where the compiler does the same thing as i

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-27 Thread tony3 at GarlandConsulting dot us
--- Comment #18 from tony3 at GarlandConsulting dot us 2010-01-27 20:56 --- Thanks for the correction - I missed that aspect. However, a signed version of my simple example still upholds what I'm trying to comment on: it behaves the same way regardless of optimization level (at

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-27 Thread tony3 at GarlandConsulting dot us
--- Comment #16 from tony3 at GarlandConsulting dot us 2010-01-27 20:39 --- Your analogy is helpful, but a bit like comparing apples with oranges. The reason being that the compiler executes integer overflow loops identically for all optimization settings. The following program

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-27 Thread tony3 at GarlandConsulting dot us
--- Comment #14 from tony3 at GarlandConsulting dot us 2010-01-27 20:03 --- Yes, I'm now aware that gcc "meets the minimal requirements" of the C++ standard. That isn't my point. My point is whether what it does is acceptable behavior given that there are no warn

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-27 Thread tony3 at GarlandConsulting dot us
--- Comment #12 from tony3 at GarlandConsulting dot us 2010-01-27 19:01 --- Here's a modified version of the original code which is intended to show just how arbitrary the compiler optimization is from a programmer's perspective. Here are two loops: one exits as expected,

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-20 Thread tony3 at GarlandConsulting dot us
--- Comment #9 from tony3 at GarlandConsulting dot us 2010-01-20 15:42 --- I am reopening this bug if only because I'd like to get a response to my previous comments. I can appreciated that, in your view, the compiler is 'technically correct' in making the assumpti

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #8 from tony3 at GarlandConsulting dot us 2010-01-20 00:18 --- I see what you mean. I was looking at the "wrong side" of the "<=" and not thinking about the reality that it would have to exceed the last valid value. Pretty obvious once you point it o

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #6 from tony3 at GarlandConsulting dot us 2010-01-19 23:05 --- There is a related bug here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36170 But unlike that bug which uses an out-of-range enum value, this case does not. We are testing 'value <= max_valid_en

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #5 from tony3 at GarlandConsulting dot us 2010-01-19 22:58 --- Created an attachment (id=19664) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19664&action=view) Assembler input which works correctly compiled at -O1 In this sample, the exit condition is p

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #4 from tony3 at GarlandConsulting dot us 2010-01-19 22:56 --- Created an attachment (id=19663) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19663&action=view) ARM gcc 4.4.1 output at assembler input level. This shows the same problem in gcc for

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #3 from tony3 at GarlandConsulting dot us 2010-01-19 22:54 --- Here is the compiler information: g++ -v Using built-in specs. Target: i586-suse-linux Configured with: ../configure --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #2 from tony3 at GarlandConsulting dot us 2010-01-19 22:53 --- Created an attachment (id=19662) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19662&action=view) Compiler output ready to feed to assembler--the problem can be seen here. -- http://gcc.

[Bug c++/42810] Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
--- Comment #1 from tony3 at GarlandConsulting dot us 2010-01-19 22:53 --- Created an attachment (id=19661) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19661&action=view) Preprocessed version of the test.cpp file. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42810

[Bug c++/42810] New: Enumeration with sequential values has its for-loop exit condition optimized out.

2010-01-19 Thread tony3 at GarlandConsulting dot us
n optimized out. Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tony3 at GarlandConsulting dot us http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42810