From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD79B3858D39; Wed, 8 Feb 2023 04:28:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD79B3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675830508; bh=FUqoapkz5Wl1OMbb5dDSIawrq+0D63jUxJPrSTOK62I=; h=From:To:Subject:Date:From; b=OF0/Kn4JCXwTM2DjZjQMySfNYP8JrYtRZMil0PyWBZDbtbl05LcJYiq/5HKqPFM4e aJVMfawuA+JGR5+PeYhXt9Qm+qWQkC/VbhPOryjmObjLEwnfUs/8ImdQAi+OOu4vzN +MBWTbYTMRKWiumQUAJhkvjyEy2mwXa8XRB77eg0= From: "nightstrike at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/108708] New: __analyzer_dump_named_constant fails with derived values Date: Wed, 08 Feb 2023 04:28:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nightstrike at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108708 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 erro= rs) 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 wor= ks 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().=