From 606f178aeb0feced07a7384bd44fdc750d58728b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 23 Jun 2016 23:01:47 +0000 Subject: [PATCH] [MachOYAML] Use a temporary to avoid gcc strict-aliasing warning GCC complains about this with -Wstrict-aliasing. Using a temporary here should prevent the warning. llvm-svn: 273627 --- llvm/lib/ObjectYAML/MachOYAML.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index d13c84eb04f1..890bc0399565 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -182,8 +182,10 @@ void mapLoadCommandData( void MappingTraits::mapping( IO &IO, MachOYAML::LoadCommand &LoadCommand) { - IO.mapRequired( - "cmd", (MachO::LoadCommandType &)LoadCommand.Data.load_command_data.cmd); + MachO::LoadCommandType TempCmd = static_cast( + LoadCommand.Data.load_command_data.cmd); + IO.mapRequired("cmd", TempCmd); + LoadCommand.Data.load_command_data.cmd = TempCmd; IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize); #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \