This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Change -faddress-sanitizer to -fsanitize=address


I rewrite the patch according to Jakub's suggestion -- add the
following option in common.opt and keep flag_asan. The patch is
attached. Ok to checkin?

fsanitize=address
Common Report Var(flag_asan)
Enable AddressSanitizer, a memory error detector

2012-11-21  Wei Mi  <wmi@google.com>

        * common.opt: Change faddress-sanitizer to fsanitize=address.
        * toplev.c (process_options): Likewise.
        * gcc.c (LINK_COMMAND_SPEC): Likewise.
        * testsuite/lib/asan-dg.exp
        (check_effective_target_faddress_sanitizer): Likewise.
        (asan_init): Likewise.
        * doc/invoke.texi (-fsanitize=[address|thread]): Document.

Thanks,
Wei.

On Mon, Nov 19, 2012 at 9:09 PM, Konstantin Serebryany
<konstantin.s.serebryany@gmail.com> wrote:
> On Mon, Nov 19, 2012 at 11:21 PM, Wei Mi <wmi@google.com> wrote:
>> I cannot remove RejectNegative and use -fno-sanitize=address, or else
>> I will break an assertion (opts-common.c:614).  The assertion requires
>> -fxxx=var options set RejectNegative if var is of enumerater type.  I
>> see that all the other -fxxx=xxx options in common.opt set
>> RejectNegative.
>>
>> Is it ok for me to checkin the current patch and submit another patch
>> if there is a better way to do it?
>
> I would prefer to have the current patch earlier, rather then a more
> comprehensive patch later.
> Otherwise we may end up with too many uses of the old flag.
>
>>
>> Thanks,
>> Wei.
>>
>> On Mon, Nov 19, 2012 at 10:31 AM, Xinliang David Li <davidxl@google.com> wrote:
>>> Questions: are -fsanitize=thread -fsanitize=address mutually exclusive
>>> here? If yes, that will be wrong.
>>>
>>> How about -fsanitize=all option?
>>>
>>> As kcc mentioned, the -fno-.. form is not handled.
>>>
>>> David
>>>
>>>
>>> On Mon, Nov 19, 2012 at 10:14 AM, Wei Mi <wmi@google.com> wrote:
>>>> Hi,
>>>>
>>>> This patch is to change -faddress-sanitizer to -fsanitize=address. Ok for trunk?
>>>>
>>>> 2012-11-19  Wei Mi  <wmi@google.com>
>>>>
>>>>         * cfgexpand.c (partition_stack_vars): Change flag_asan to
>>>>         flag_sanitize.
>>>>         (expand_stack_vars): Likewise.
>>>>         (defer_stack_allocation): Likewise.
>>>>         (expand_used_vars): Likewise.
>>>>         * varasm.c (assemble_noswitch_variable): Likewise.
>>>>         (assemble_variable): Likewise.
>>>>         (place_block_symbol): Likewise.
>>>>         * asan.c (gate_asan): Likewise.
>>>>         (gate_asan_O0): Likewise.
>>>>         * toplev.c (compile_file): Likewise.
>>>>         (process_options): Likewise.
>>>>         * common.opt: Change faddress-sanitizer to fsanitize=address.
>>>>         * gcc.c (LINK_COMMAND_SPEC): Likewise.
>>>>         * testsuite/lib/asan-dg.exp
>>>>         (check_effective_target_faddress_sanitizer): Likewise.
>>>>         (asan_init): Likewise.
>>>>         * flag-types.h (sanitize_type): New enum type.
>>>>         * doc/invoke.texi (-fsanitize=[address|thread]): Document.
>>>>
>>>> Thanks,
>>>> Wei.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]