public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] handle sanitizer built-ins in -Wuninitialized (PR 101300)
Date: Tue, 6 Jul 2021 09:41:00 -0600	[thread overview]
Message-ID: <73a485ae-e25d-e787-5411-859f3ba6327a@gmail.com> (raw)
In-Reply-To: <20210703121316.5dd0a893@nbbrfq>

On 7/3/21 4:13 AM, Bernhard Reutner-Fischer wrote:
> On Fri, 2 Jul 2021 13:21:10 -0600
> Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
>> --- a/gcc/tree-ssa-uninit.c
>> +++ b/gcc/tree-ssa-uninit.c
>> @@ -228,9 +228,26 @@ check_defs (ao_ref *ref, tree vdef, void *data_)
>>     gimple *def_stmt = SSA_NAME_DEF_STMT (vdef);
>>   
>>     /* The ASAN_MARK intrinsic doesn't modify the variable.  */
>> -  if (is_gimple_call (def_stmt)
>> -      && gimple_call_internal_p (def_stmt, IFN_ASAN_MARK))
>> -    return false;
>> +  if (is_gimple_call (def_stmt))
>> +    {
>> +      if (gimple_call_internal_p (def_stmt)
>> +         && gimple_call_internal_fn (def_stmt) == IFN_ASAN_MARK)
>> +       return false;
>> +
>> +      if (tree fndecl = gimple_call_fndecl (def_stmt))
>> +       {
>> +         /* Some sanitizer calls pass integer arguments to built-ins
>> +            that expect pointets. Avoid using gimple_call_builtin_p()
> 
> pointers
> 
> What happened to the suspicion that the fnspec attribs are
> allegedly not correct (
> https://gcc.gnu.org/legacy-ml/gcc-patches/2018-02/msg00541.html )?
> 
> Wouldn't that deal with this issue transparently if additionally the
> args were passed in correctly?
> Didn't follow *san closely though.

I didn't follow the 2018 thread either but the attribute changes
to ASAN_MARK discussed in the patch above ended up reverted in
r257625.  In general, the fnspec (and other similar) attributes
need to capture even the side-effects of the sanitizer functions
that aren't observable by a program.  Warnings only care about
the strictly observable subset of those, so there isn't always
a 1-to-1 correspondence.

Martin


> 
> thanks,
> 
>> +            which fails for such calls.  */
>> +         if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
>> +           {
>> +             built_in_function fncode = DECL_FUNCTION_CODE (fndecl);
>> +             if (fncode > BEGIN_SANITIZER_BUILTINS
>> +                 && fncode < END_SANITIZER_BUILTINS)
>> +               return false;
>> +           }
>> +       }
>> +    }
>>   


  reply	other threads:[~2021-07-06 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 19:21 Martin Sebor
2021-07-03 10:13 ` Bernhard Reutner-Fischer
2021-07-06 15:41   ` Martin Sebor [this message]
2021-07-12 18:06 ` PING " Martin Sebor
2021-07-20  0:01   ` PING 2 " Martin Sebor
2021-07-20 10:48     ` Jeff Law
2021-07-20 19:12       ` Martin Sebor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73a485ae-e25d-e787-5411-859f3ba6327a@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rep.dot.nop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).