https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125265
Bug ID: 125265
Summary: FAIL: gcc.dg/analyzer/mkostemp-1.c test for warnings
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: azoff at gcc dot gnu.org
Target Milestone: ---
In r17-409-g8376a674e3564f, 2 out of the 4 redundant tests fail when testing
for arm-none-eabi:
105 │ void test_redundant_o_creat (void)
106 │ {
107 │ char tmpl[] = "/tmp/testXXXXXX";
108 │ mkostemp (tmpl, O_CREAT); /* { dg-warning "'mkostemp' flags argument
should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL' as these are already
implied" } */
109 │ }
110 │
111 │ void test_redundant_o_excl (void)
112 │ {
113 │ char tmpl[] = "/tmp/testXXXXXX";
114 │ mkostemp (tmpl, O_EXCL); /* { dg-warning "'mkostemp' flags argument
should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL' as these are already
implied" } */
115 │ }
Testing analyzer/mkostemp-1.c
doing compile
Executing on host: /build/r17-409-g8376a674e3564f/bin/arm-none-eabi-gcc
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c -mthumb
-march=armv6s-m -mtune=cortex-m0 -mfloat-abi=soft -mfpu=auto
-fdiagnostics-plain-output -fanalyzer -Wanalyzer-too-complex
-Wanalyzer-symbol-too-complex -Wno-analyzer-null-argument -S -o
mkostemp-1.s (timeout = 800)
...
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c: In function
'test_redundant_o_rdwr':
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:102:3: warning:
'mkostemp' flags argument should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL'
as these are already implied [-Wanalyzer-mkostemp-redundant-flags]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:102:3: note: (1)
'mkostemp' flags argument should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL'
as these are already implied
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:103:1: warning: leak
of file descriptor [CWE-775] [-Wanalyzer-fd-leak]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:102:3: note: (1)
opened here as read-write
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:102:3: note: (2) when
'mkostemp' succeeds
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:103:1: note: (3)
leaks here
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c: In function
'test_redundant_o_creat':
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:109:1: warning: leak
of file descriptor [CWE-775] [-Wanalyzer-fd-leak]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:108:3: note: (1)
opened here as read-write
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:108:3: note: (2) when
'mkostemp' succeeds
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:109:1: note: (3)
leaks here
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c: In function
'test_redundant_o_excl':
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:115:1: warning: leak
of file descriptor [CWE-775] [-Wanalyzer-fd-leak]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:114:3: note: (1)
opened here as read-write
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:114:3: note: (2) when
'mkostemp' succeeds
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:115:1: note: (3)
leaks here
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c: In function
'test_redundant_combined':
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:120:3: warning:
'mkostemp' flags argument should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL'
as these are already implied [-Wanalyzer-mkostemp-redundant-flags]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:120:3: note: (1)
'mkostemp' flags argument should not include 'O_RDWR', 'O_CREAT', or 'O_EXCL'
as these are already implied
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:121:1: warning: leak
of file descriptor [CWE-775] [-Wanalyzer-fd-leak]
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:120:3: note: (1)
opened here as read-write
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:120:3: note: (2) when
'mkostemp' succeeds
/build/gcc_src/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c:121:1: note: (3)
leaks here
...
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 18)
PASS: gcc.dg/analyzer/mkostemp-1.c fix suggestion at line 19 (test for
warnings, line 18)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 24)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 29)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 53)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 59)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 65)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 71)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 77)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 102)
FAIL: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 108)
FAIL: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 114)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for warnings, line 120)
PASS: gcc.dg/analyzer/mkostemp-1.c (test for excess errors)
The same test pass when testing for x86_64-pc-linux-gnu.