http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904
Bug #: 52904
Summary: -Wstrict-overflow false alarm with bounded loop
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 27113
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27113
simplified version of Emacs code, illustrating the bug
I ran into this problem when trying to build GNU Emacs with -Wstrict-overflow.
Compiling the attached program 'v.i' with the following command:
gcc -c -Wstrict-overflow -O2 v.i
generates the diagnostic:
v.i: In function 'wait_reading_process_output':
v.i:14:6: error: assuming signed overflow does not occur when simplifying
conditional to constant [-Werror=strict-overflow]
The diagnostic is obviously incorrect, since the variable 'nfds' cannot
possibly exceed 1024.
I will also attach the output of "gcc -v -c -Wstrict-overflow -O2 v.i".