r243085 - Fix the cc1as crash when it outputs assembly

Hans Wennborg hans at chromium.org
Fri Jul 24 10:53:13 PDT 2015


Is this something we should merge to 3.7?

On Thu, Jul 23, 2015 at 7:12 PM, Steven Wu <stevenwu at apple.com> wrote:
> Author: steven_wu
> Date: Thu Jul 23 21:12:43 2015
> New Revision: 243085
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243085&view=rev
> Log:
> Fix the cc1as crash when it outputs assembly
>
> In clang cc1as_main, when the output file type is “asm”, AsmStreamer
> owns a formatted_raw_ostream which has a reference to FDOS
> (raw_ostream), so AsmStreamer must be closed before FDOS is closed.
>
> Added:
>     cfe/trunk/test/Misc/cc1as-asm.s
> Modified:
>     cfe/trunk/tools/driver/cc1as_main.cpp
>
> Added: cfe/trunk/test/Misc/cc1as-asm.s
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/cc1as-asm.s?rev=243085&view=auto
> ==============================================================================
> --- cfe/trunk/test/Misc/cc1as-asm.s (added)
> +++ cfe/trunk/test/Misc/cc1as-asm.s Thu Jul 23 21:12:43 2015
> @@ -0,0 +1,3 @@
> +// Run cc1as asm output path just to make sure it works
> +// REQUIRES: x86-registered-target
> +// RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -filetype asm %s -o /dev/null
>
> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=243085&r1=243084&r2=243085&view=diff
> ==============================================================================
> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
> +++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Jul 23 21:12:43 2015
> @@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerIn
>      Failed = Parser->Run(Opts.NoInitialTextSection);
>    }
>
> +  // Close Streamer first.
> +  // It might have a reference to the output stream.
> +  Str.reset();
>    // Close the output stream early.
>    BOS.reset();
>    FDOS.reset();
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list