[PATCH] R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

David Blaikie dblaikie at gmail.com
Mon Apr 27 09:34:53 PDT 2015


On Mon, Apr 27, 2015 at 2:59 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Fixes a crash with basically any OpenGL application using the radeonsi
> driver.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90176
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  lib/Target/R600/AMDGPUMCInstLower.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/Target/R600/AMDGPUMCInstLower.cpp b/lib/Target/R600/AMDGPUMCInstLower.cpp
> index b00bd8d..708bb6f 100644
> --- a/lib/Target/R600/AMDGPUMCInstLower.cpp
> +++ b/lib/Target/R600/AMDGPUMCInstLower.cpp
> @@ -132,8 +132,8 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
>        SmallVector<char, 16> CodeBytes;
>        raw_svector_ostream CodeStream(CodeBytes);
>
> -      MCObjectStreamer &ObjStreamer = (MCObjectStreamer &)OutStreamer;

Well that's lovely... - anyone have interest in banning c-style casts
or a Clang warning for essentially reinterpret casts with c-style
casts? (similar to -Wcast-qual - essentially trying to push for
c-style casts to only be used for static_cast equivalent operations)

> -      MCCodeEmitter &InstEmitter = ObjStreamer.getAssembler().getEmitter();
> +      MCObjectStreamer *ObjStreamer = (MCObjectStreamer *)OutStreamer.get();
> +      MCCodeEmitter &InstEmitter = ObjStreamer->getAssembler().getEmitter();
>        InstEmitter.EncodeInstruction(TmpInst, CodeStream, Fixups,
>                                      MF->getSubtarget<MCSubtargetInfo>());
>        CodeStream.flush();
> --
> 2.1.4
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list