[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2024-04-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #9 from GCC Commits  ---
The releases/gcc-11 branch has been updated by Iain D Sandoe
:

https://gcc.gnu.org/g:ee2f7a02371aba24f6db6231ae862cd2248bf45f

commit r11-11393-gee2f7a02371aba24f6db6231ae862cd2248bf45f
Author: Francois-Xavier Coudert 
Date:   Sat Aug 19 23:22:06 2023 +0200

Testsuite: fix analyzer tests on Darwin

On macOS, system headers redefine by default some macros (memcpy,
memmove, etc) to checked versions, which defeats the analyzer. We
want to turn this off.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

gcc/testsuite/ChangeLog:

PR analyzer/104042
* gcc.dg/analyzer/analyzer.exp: Pass -D_FORTIFY_SOURCE=0 on Darwin.

(cherry picked from commit ce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce)

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2024-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #8 from GCC Commits  ---
The releases/gcc-12 branch has been updated by Iain D Sandoe
:

https://gcc.gnu.org/g:c2cb625eb141cacd0bee6c6ce5888d673ac38ca4

commit r12-10361-gc2cb625eb141cacd0bee6c6ce5888d673ac38ca4
Author: Francois-Xavier Coudert 
Date:   Sat Aug 19 23:22:06 2023 +0200

Testsuite: fix analyzer tests on Darwin

On macOS, system headers redefine by default some macros (memcpy,
memmove, etc) to checked versions, which defeats the analyzer. We
want to turn this off.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

gcc/testsuite/ChangeLog:

PR analyzer/104042
* gcc.dg/analyzer/analyzer.exp: Pass -D_FORTIFY_SOURCE=0 on Darwin.

(cherry picked from commit ce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce)

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2024-04-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #7 from GCC Commits  ---
The releases/gcc-13 branch has been updated by Iain D Sandoe
:

https://gcc.gnu.org/g:a5bc8abef90874e81783e0fa34db133da71d1133

commit r13-8548-ga5bc8abef90874e81783e0fa34db133da71d1133
Author: Francois-Xavier Coudert 
Date:   Sat Aug 19 23:22:06 2023 +0200

Testsuite: fix analyzer tests on Darwin

On macOS, system headers redefine by default some macros (memcpy,
memmove, etc) to checked versions, which defeats the analyzer. We
want to turn this off.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

gcc/testsuite/ChangeLog:

PR analyzer/104042
* gcc.dg/analyzer/analyzer.exp: Pass -D_FORTIFY_SOURCE=0 on Darwin.
* gcc.dg/analyzer/fd-bind.c: Add missing  header.
* gcc.dg/analyzer/fd-datagram-socket.c: Likewise.
* gcc.dg/analyzer/fd-listen.c: Likewise.
* gcc.dg/analyzer/fd-socket-misuse.c: Likewise.
* gcc.dg/analyzer/fd-stream-socket-active-open.c: Likewise.
* gcc.dg/analyzer/fd-stream-socket-passive-open.c: Likewise.
* gcc.dg/analyzer/fd-stream-socket.c: Likewise.
* gcc.dg/analyzer/fd-symbolic-socket.c: Likewise.

(cherry picked from commit ce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce)

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2023-11-03 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

Francois-Xavier Coudert  changed:

   What|Removed |Added

  Build||x86_64-apple-darwin21
 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 Target||x86_64-apple-darwin21
   Host||x86_64-apple-darwin21

--- Comment #6 from Francois-Xavier Coudert  ---
Fixed on mainline.

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2023-08-19 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #5 from Francois-Xavier Coudert  ---
Patch posted for Darwin at
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627923.html

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2022-01-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #4 from Andrew Pinski  ---
So I suspect they will fail if you default the linux compiler to
_FORTIFY_SOURCE=2 then too. (I thought there was a configure option to do that
or maybe Debian/Ubuntu has patches for it I forget).

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2022-01-15 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #3 from Iain Sandoe  ---
erm, that is probably _FORTIFY_SOURCE from the command line.

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2022-01-15 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

--- Comment #2 from Iain Sandoe  ---
FX, You might be able to force Darwin to use the non-checked versions (perhaps
by adding -D_USE_FORTIFY_LEVEL=0)

[Bug analyzer/104042] Four memcpy/memset analyzer failures on darwin

2022-01-15 Thread fxcoudert at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

Francois-Xavier Coudert  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2022-01-15
 CC||dmalcolm at gcc dot gnu.org,
   ||iains at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Francois-Xavier Coudert  ---
The reason for the failure is that the darwin headers, in 
(included from ), defines memcpy like this:

#if __has_builtin(__builtin___memcpy_chk) || defined(__GNUC__)
#undef memcpy
/* void *memcpy(void *dst, const void *src, size_t n) */
#define memcpy(dest, ...) \
   __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0
(dest))
#endif

where __darwin_obsz0 is defined thusly:

#define __darwin_obsz0(object) __builtin_object_size (object, 0)



So either the testcase should be modified to use __builtin_memcpy, or the
analyzer should handle __builtin___memcpy_chk and emit the right warning.