This is an archive of the discontinued LLVM Phabricator instance.

[fuchsia] Add loop to _zx_cprng_draw.
ClosedPublic

Authored by flowerhack on Oct 10 2017, 1:38 PM.

Diff Detail

Event Timeline

flowerhack created this revision.Oct 10 2017, 1:38 PM
mcgrathr accepted this revision.Oct 10 2017, 1:46 PM

LGTM

compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
494

Pointer arithmetic on void* is a GNU extension, but fine if it's allowed in this code.

This revision is now accepted and ready to land.Oct 10 2017, 1:46 PM
cryptoad added inline comments.Oct 10 2017, 1:48 PM
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
490

length being a uptr, the condition comes down to while length != 0. I assume size is guaranteed to not be > length?

flowerhack marked an inline comment as done.Oct 11 2017, 11:44 AM
flowerhack added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
490

that's correct; size will never be > length

494

interesting! how would i know whether a particular extension is allowed in a part of compiler-rt? i couldn't find anything about it in the LLVM coding standards

mcgrathr added inline comments.Oct 11 2017, 11:48 AM
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
494

If it compiles then they haven't chosen -std=... options to enforce it, which means either they think it's fine or they don't really care.
As to the intent, the guys on the team will have to speak up.

flowerhack marked an inline comment as done.
flowerhack added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
494

sgtm

added a couple reviewers with commit bits

please feel free to hit the "ship it" button on my behalf or, if that should not happen, let me know what to fix!

phosek added inline comments.Oct 11 2017, 12:15 PM
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
494

Make sure you try to compile this code with Clang as your host compiler.

This revision was automatically updated to reflect the committed changes.
phosek added inline comments.Oct 11 2017, 4:39 PM
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
494

I tried build our toolchain with this patch (which uses Clang as a first stage compiler) and I'm getting an error on this line: error: arithmetic on a pointer to void