public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/104860] New: RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...))
@ 2022-03-09 20:18 dmalcolm at gcc dot gnu.org
  2022-03-09 21:25 ` [Bug analyzer/104860] " dmalcolm at gcc dot gnu.org
  2022-03-25 16:27 ` dmalcolm at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-03-09 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104860
           Summary: RFE: -Wanalyzer-possible-null-argument and
                    -Wanalyzer-null-argument should respect
                    __attribute__((access, ...))
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

Similar to PR analyzer/104793, but relating to NULL/possibly NULL pointers (and
affects reads as well as writes):

typedef __SIZE_TYPE__ size_t;

int getrandom (void *__buffer, size_t __length,
               unsigned int __flags)
  __attribute__ ((access (__write_only__, 1, 2)));

#define GRND_RANDOM 0x02

void test (int flag)
{
  char *buf = __builtin_malloc (1024);

  if (getrandom(buf, 16, GRND_RANDOM))
    __builtin_printf("%s\n", buf);

  __builtin_free (buf);
}


The call to malloc could fail, but we don't yet complain about the
possibly-NULL param to getrandom, that's marked with __attribute__ ((access,
...))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug analyzer/104860] RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...))
  2022-03-09 20:18 [Bug analyzer/104860] New: RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...)) dmalcolm at gcc dot gnu.org
@ 2022-03-09 21:25 ` dmalcolm at gcc dot gnu.org
  2022-03-25 16:27 ` dmalcolm at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-03-09 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Questions posted to GCC list about this: "__attribute__ ((access, ...)) vs
__attribute__ ((nonnull))"
  https://gcc.gnu.org/pipermail/gcc/2022-March/238389.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug analyzer/104860] RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...))
  2022-03-09 20:18 [Bug analyzer/104860] New: RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...)) dmalcolm at gcc dot gnu.org
  2022-03-09 21:25 ` [Bug analyzer/104860] " dmalcolm at gcc dot gnu.org
@ 2022-03-25 16:27 ` dmalcolm at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-03-25 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
The consensus in that discussion is that "access" and "nonnull" are separate
concepts, and thus the user needs to provide both if they mean both.

Closing this out as INVALID.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-25 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 20:18 [Bug analyzer/104860] New: RFE: -Wanalyzer-possible-null-argument and -Wanalyzer-null-argument should respect __attribute__((access, ...)) dmalcolm at gcc dot gnu.org
2022-03-09 21:25 ` [Bug analyzer/104860] " dmalcolm at gcc dot gnu.org
2022-03-25 16:27 ` dmalcolm at gcc dot gnu.org

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).