Page MenuHomePhabricator

[OpenMP] Fixed a potential integer overflow
ClosedPublic

Authored by tianshilei1992 on Oct 21 2020, 6:23 AM.

Details

Summary

size_t has different width on 32- and 64-bit architecture, but the
computation to floor to power of two assumed it is 64-bit, which can cause an
integer overflow. In this patch, architecture detection is added so that the
operation for 64-bit size_t. Thank Luke for reporting the issue.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Oct 21 2020, 6:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2020, 6:23 AM
tianshilei1992 requested review of this revision.Oct 21 2020, 6:23 AM
tianshilei1992 edited the summary of this revision. (Show Details)Oct 21 2020, 6:25 AM
tianshilei1992 added a reviewer: lbenes.
jdoerfert accepted this revision.Oct 21 2020, 3:58 PM

LGTM.

Though, now that D89426 landed we could also call the LLVM ADT method for this ;)

This revision is now accepted and ready to land.Oct 21 2020, 3:58 PM
This revision was automatically updated to reflect the committed changes.

LGTM.

Though, now that D89426 landed we could also call the LLVM ADT method for this ;)

That'll be a good direction in the future.