public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/108708] New: __analyzer_dump_named_constant fails with derived values
@ 2023-02-08  4:28 nightstrike at gmail dot com
  2024-03-04 13:00 ` [Bug analyzer/108708] [13/14 Regression] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nightstrike at gmail dot com @ 2023-02-08  4:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108708
           Summary: __analyzer_dump_named_constant fails with derived
                    values
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: nightstrike at gmail dot com
  Target Milestone: ---

The analyzer test fd-access-mode-target-headers.c fails on mingw-w64 due to the
following:

FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
55)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
56)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
57)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c (test for excess errors)
Excess errors:
gcc-git/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c:55:3:
warning: named constant 'O_ACCMODE' has unknown value
gcc-git/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c:56:3:
warning: named constant 'O_RDONLY' has unknown value
gcc-git/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c:57:3:
warning: named constant 'O_WRONLY' has unknown value


This fails, because on mingw-w64, we define these macros indirectly:

#define _O_RDONLY 0x0000
#define _O_WRONLY 0x0001
#define _O_RDWR 0x0002
#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
...
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_ACCMODE _O_ACCMODE


If I modify the test to do "#undef O_ACCMODE; #define O_ACCMODE 42", it works
as expected (and the other tests in the testsuite that test this also pass).

I didn't flag this as a testsuite issue, though, because it seems that the
issue is within the ability of __analyzer_dump_named_constant() to handle a
macro value that references another macro or is some other valid expression.  I
also don't think it's specific to Windows.

Perhaps related is that these tests also fail:
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
19)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
27)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
32)
FAIL: gcc.dg/analyzer/fd-access-mode-target-headers.c  (test for warnings, line
39)

I assume this is related to the analyzer not being able to deduce the
permissions passed to open().

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

end of thread, other threads:[~2024-05-21  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08  4:28 [Bug analyzer/108708] New: __analyzer_dump_named_constant fails with derived values nightstrike at gmail dot com
2024-03-04 13:00 ` [Bug analyzer/108708] [13/14 Regression] " rguenth at gcc dot gnu.org
2024-03-22 13:59 ` law at gcc dot gnu.org
2024-05-21  9:14 ` [Bug analyzer/108708] [13/14/15 " jakub 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).