On 04.08.2018 01:31, Robert Elz wrote: > Kamil: assuming you agree that this is a reasonable analysis, I'd suggest > no more code changes based upon gcc warnings issued this way.
In general there shall not be a relation between -O level and sanitizers. Sanitizers do not need -O0 or -g for operation. UBSan does not need disabled optimization for reporting issues in exact location in the code. It also does not need debug information (DWARF or similar)... however a runtime might make use of the additional data to print more verbose messages or stacktraces. GCC is known for reporting uninitialized variables and I wouldn't blame sanitizers for it. We just initialize them to tune it down and this is the current practice. GCC also enables more warnings for UBSan that have to be addressed in order to compile the source, as the code would be UB anyway (like changing the signedness bit with a shift operation). I don't agree with strong opinions against cautious warnings/errors from a compiler. They are there for purpose and dhcpcd could be really broken with the same code, but with a different context. And regarding utility of the Undefined Behavior Sanitizer and coverage of new tests.. we have just caught a bug on pmax that an integer overflow crashed the kernel: UB caused to crash pmax.. divrem_overflow_signed_div: pexpect reported EOF - VMM exited unexpectedly
Description: OpenPGP digital signature