[Bug c++/66590] New: switch statement: incorrect warning reaches end of non-void function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66590 Bug ID: 66590 Summary: switch statement: incorrect warning reaches end of non-void function Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: brutus at free dot fr Target Milestone: --- Created attachment 35803 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35803action=edit code snippet generated erroneous end of non-void function warning If the attached code is compiled with -Wall, gcc versions 4.9.2, 5.1 and others incorrectly warn about reaching end of non-void function. this is typically reproduced with: /opt/install/gcc-4.9.2/bin/g++ -Wall -c switch.cpp warning disappears if: -optimisation is at least -O1 -OR declaration of ~A() line 1 is removed -OR declaration of variable a line 6 is removed -OR declaration of variable tmp line 9 is removed -OR break on line 9 is removed
[Bug c++/45464] New: Warning missing using -Wall when comparing unsigned int and sum of unsigned chars.
The following code will warn for line 6 but not for line 5, however, I _think_the type of a + a + a is the same as the type of a + a. int main() { unsigned char a=0; unsigned int b =0; bool test1 =( b a + a);//no warning, why bool test2 =( b a + a + a);//warning if (wtf1 wtf2) return 1; } -- Summary: Warning missing using -Wall when comparing unsigned int and sum of unsigned chars. Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: brutus at free dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45464
[Bug c++/45464] Warning missing using -Wall when comparing unsigned int and sum of unsigned chars.
--- Comment #1 from brutus at free dot fr 2010-08-31 13:53 --- There is a small mystake to the snippet, it should read instead: int main() { unsigned char a = 0; unsigned int b = 0; bool test1 =( b a + a); bool test2 =( b a + a + a); if (test1 test2) return 1; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45464