public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/96798] Analyzer failures on Darwin
Date: Sat, 29 Aug 2020 07:02:31 +0000	[thread overview]
Message-ID: <bug-96798-4-YU31BHB9kE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96798-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96798

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #6)
> Thanks!  The "memset" call has become a call to "__builtin___memset_chk"
> (perhaps due to _FORTIFY_SOURCE, or something similar in Darwin's libc?),

(transitive include of strings.h, for macOS >= 10.5)
usr/include/_types.h:#    define _FORTIFY_SOURCE 2      /* on by default */

usr/include/strings.h:

#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
/* Security checking functions.  */
#include <secure/_strings.h>
#endif


secure/_strings.h:

#if _USE_FORTIFY_LEVEL > 0

....

#if __has_builtin(__builtin___memset_chk) || defined(__GNUC__)
#undef bzero
/* void bzero(void *s, size_t n) */
#define bzero(dest, ...) \
                __builtin___memset_chk (dest, 0, __VA_ARGS__, __darwin_obsz0
(dest))
#endif

(AFAIR, fort

> and the analyzer doesn't (yet) know about that builtin.
> 
> I can reproduce the issue by hacking this into the test:
> 
> #define memset(DST, SRC, LEN) \
>   __builtin___memset_chk ((DST), (SRC), (LEN), \
> 			  __builtin_object_size((DST), 0))
> 
> There are at least two issues here:
> (a) looks like region_model::on_call_pre is erroneously treating a builtin I
> haven't coded yet as a no-op; it should instead conservatively assume that
> any escaped/reachable regions are affected
> (b) the analyzer should handle that builtin (and probably others)

  parent reply	other threads:[~2020-08-29  7:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 12:48 [Bug analyzer/96798] New: " dominiq at lps dot ens.fr
2020-08-27 22:49 ` [Bug analyzer/96798] " dmalcolm at gcc dot gnu.org
2020-08-27 23:30 ` dominiq at lps dot ens.fr
2020-08-28 10:10 ` dmalcolm at gcc dot gnu.org
2020-08-28 11:20 ` dominiq at lps dot ens.fr
2020-08-28 22:39 ` dominiq at lps dot ens.fr
2020-08-29  0:58 ` dmalcolm at gcc dot gnu.org
2020-08-29  7:02 ` iains at gcc dot gnu.org [this message]
2020-08-29  7:21 ` iains at gcc dot gnu.org
2020-08-29  7:22 ` iains at gcc dot gnu.org
2020-08-31 22:31 ` cvs-commit at gcc dot gnu.org
2020-08-31 22:32 ` cvs-commit at gcc dot gnu.org
2020-08-31 22:47 ` dmalcolm at gcc dot gnu.org
2020-09-11  1:09 ` cvs-commit at gcc dot gnu.org
2020-09-11  1:13 ` dmalcolm at gcc dot gnu.org

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=bug-96798-4-YU31BHB9kE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).