This is an archive of the discontinued LLVM Phabricator instance.

Prevent gcc from issuing a warning upon coffnamecpy
ClosedPublic

Authored by serge-sans-paille on Feb 15 2020, 12:03 AM.

Details

Summary

This is a follow up to d1262a6e9, more explicit to cope with GCC smartness.

The intent is also more explicit now. Otherwise GCC 9.2 inlines coffnamecpy and trigger a (rightful) warning.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2020, 12:03 AM
thakis added inline comments.Feb 15 2020, 4:40 PM
llvm/lib/Object/WindowsResource.cpp
724

s/larger/smaller/?

726

Why do we need this if at all? The buffer is initialized to all-zeroes, right? (if not, we'd have to fill all remaining padding with zeroes, not just one byte.)

serge-sans-paille updated this revision to Diff 244896.EditedFeb 16 2020, 1:00 PM

I've manually checked the fact that out memory has been zeroed, and added an assert to make sure it remains so.

serge-sans-paille marked 2 inline comments as done.Feb 16 2020, 1:01 PM

I can confirm that this patch does silence the warning on gcc 9.2.

thakis accepted this revision.Feb 18 2020, 6:37 AM
This revision is now accepted and ready to land.Feb 18 2020, 6:37 AM
This revision was automatically updated to reflect the committed changes.