Bug 92667 - spurious missing sentinel in function call with a local sentinel variable
Summary: spurious missing sentinel in function call with a local sentinel variable
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-25 21:49 UTC by Martin Sebor
Modified: 2024-02-17 20:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-01-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2019-11-25 21:49:49 UTC
While looking into bug 92666 I noticed the following false positive in C (it can be reproduced in C++ making the pointer non-const so it doesn't get folded).  By being implemented fully in the front-end the warning doesn't see that the nullptr variable is, in fact, a null pointer.

$ cat t.c && cat t.c && gcc -S -Wall t.c
void f (void)
{
  const char* const null = 0;

  __builtin_execl ("foo", "bar", null);
}
void f (void)
{
  const char* const null = 0;

  __builtin_execl ("foo", "bar", null);
}
t.c: In function ‘f’:
t.c:5:3: warning: missing sentinel in function call [-Wformat=]
    5 |   __builtin_execl ("foo", "bar", null);
      |   ^~~~~~~~~~~~~~~
Comment 1 Eric Gallager 2019-11-26 05:05:29 UTC
possibly related: bug 38481