[Bug c/30475] assert(int+100 > int) optimized away

2021-01-05 Thread daniel.marjamaki at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475

Daniel Marjamäki  changed:

   What|Removed |Added

 CC||daniel.marjamaki at gmail dot 
com

--- Comment #62 from Daniel Marjamäki  ---
> I think using run-time warnings will miss a lot of bugs, compared to compile 
> time warnings.

I fully agree. This current situation is just dangerous.

In my humble opinion, the optimisations should be disabled until proper
warnings are written.

It is no silver bullet but to give a little confidence in your code you can
currently use Cppcheck. Cppcheck writes a warning with id
invalidTestForOverflow for `int + 100 > int`.

[Bug c/30475] assert(int+100 > int) optimized away

2021-01-05 Thread daniel.marjamaki at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475

--- Comment #63 from Daniel Marjamäki  ---
Sorry. I should have mentioned I am a Cppcheck developer in my comment.

[Bug c/30475] assert(int+100 > int) optimized away

2021-01-06 Thread daniel.marjamaki at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475

--- Comment #66 from Daniel Marjamäki  ---
Thanks! I can appreciate that it's not very simple. Well using a flag is
totally acceptable. I don't trust the sanitizer completely but those that do
can use the optimisation.