Add a test case and committed in r243085.

Thanks

Steven

> On Jul 23, 2015, at 6:43 PM, Steven Wu <steve...@apple.com> wrote:
> 
>> 
>> On Jul 23, 2015, at 5:15 PM, Rafael Espíndola <rafael.espind...@gmail.com 
>> <mailto:rafael.espind...@gmail.com>> wrote:
>> 
>> 
>> On 23 July 2015 at 18:03, Steven Wu <steve...@apple.com 
>> <mailto:steve...@apple.com>> wrote:
>>> Hi Rafael
>>> 
>>> This looks like a fallout from your ostream rewrite. 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. Here is the patch.
>>> 
>>> Thanks
>>> Steven
>>> 
>>> From f930e3d8a8c7da74de6000bb3b80f90efc5615ff Mon Sep 17 00:00:00 2001
>>> From: Steven Wu <steve...@apple.com <mailto:steve...@apple.com>>
>>> Date: Thu, 23 Jul 2015 14:48:24 -0700
>>> Subject: [PATCH 1/2] Fix the cc1as crash when it outputs assembly
>>> 
>>> ---
>>> tools/driver/cc1as_main.cpp | 3 +++
>>> 1 file changed, 3 insertions(+)
>>> 
>>> diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp
>>> index aa92541..fd0fbb4 100644
>>> --- a/tools/driver/cc1as_main.cpp
>>> +++ b/tools/driver/cc1as_main.cpp
>>> @@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
>>>     Failed = Parser->Run(Opts.NoInitialTextSection);
>>>   }
>>> 
>>> +  // Close Streamer first.
>>> +  // It might have a reference to the output stream.
>>> +  Str.reset();
>> 
>> it always has a reference, no?
> Seems like it. I am just guessing. I am not trying to blame anyone but rather 
> to get someone’s attention for code review.
> 
>> Is there a test we can add? Even one that would only fail when
>> building with the sanitizers would be fine.
> It was actually crashing pretty consistently and you don’t need to have a 
> sanitizer to notice that. No one ever noticed probably because clang driver 
> will not generate this combination of the arguments. I will add a test case 
> just so it will exercise the code path.
> 
> Thanks
> 
> Steven
> 
>> 
>> With that, LGTM.
>> 
>> Cheers,
>> Rafael
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@cs.uiuc.edu <mailto:cfe-commits@cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits 
> <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits>
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to