This is an archive of the discontinued LLVM Phabricator instance.

Warning disable for mod-by-zero and union 'uninitialized' use
ClosedPublic

Authored by mcgov on Aug 9 2019, 12:29 PM.

Details

Summary

MSVC is throwing some warnings when compiling these sections (during a compile of asan_rt and llvm-symbolizer).

The uninitialized use warning is just an artifact of using a union, so I think we can safely ignore it. The mod-by-zero warning I'm less sure about, but unless someone with more knowledge about the code feels like this needs a fix I'd like to just disable the warning so we can build with warn-as-error and get past these.

Diff Detail

Event Timeline

mcgov created this revision.Aug 9 2019, 12:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2019, 12:29 PM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript
rnk accepted this revision.Aug 9 2019, 12:54 PM

lgtm

compiler-rt/lib/builtins/fixxfdi.c
50

I would put the warning pop inside the !_ARCH_PPC block. It would only be an issue in an _MSC_VER + PPC build.

compiler-rt/lib/builtins/udivmoddi4.c
21–22

I think the % by 0 will happen only in the cases where the user actually does division by zero, and that's actually the desired behavior.

This revision is now accepted and ready to land.Aug 9 2019, 12:54 PM
mcgov updated this revision to Diff 214426.Aug 9 2019, 12:57 PM

update to add !defined(clang)

mcgov closed this revision.Aug 9 2019, 1:00 PM
mcgov updated this revision to Diff 214429.
mcgov marked an inline comment as done.
mcgov added inline comments.
compiler-rt/lib/builtins/udivmoddi4.c
21–22

Ok that makes sense. I appreciate the look, thank you!

mstorsjo added inline comments.
compiler-rt/lib/builtins/fixunsxfdi.c
48

This broke compilation for me with errors like this:

lib/builtins/fixunsxfdi.c:13:2: error: unterminated conditional directive
#if !_ARCH_PPC

Also, the commit message speaks about sanitizers, even though all the changes are for builtins.

I fixed the compile error in SVN r368480.

mcgov marked 2 inline comments as done.Aug 9 2019, 1:44 PM
mcgov added inline comments.
compiler-rt/lib/builtins/fixunsxfdi.c
48

Thank you for the fix!

thakis added a subscriber: thakis.Aug 12 2019, 12:57 PM

This broke -Werror bots due to -Wnewline-eof. I added missing newlines in r368613 to fix this. Please configure your editor to save files with (exactly) one newline for next time :)

See also the "New newline at end of file" notes in phab.