Skip to content

patchutils 0.4.3 gcc 13.4 error with memcpy macro compound literal argument lacking parens #111

@BrianInglis

Description

@BrianInglis

Building patchutils 0.4.3 package on Cygwin 3.6.4 using gcc 13.4 memcpy is defined as a macro for ssp, called with a constant literal argument, in multiple places in interdiff.c, which cpp macro handling dislikes without additional parens (see attached patch):

$ grep -m1 -B1 -A11 error: patchutils-0.4.3-1.x86_64/log/patchutils-0.4.3-1-compile.log
/usr/src/patchutils/patchutils-0.4.3-1.x86_64/src/patchutils-0.4.3/src/interdiff.c: In function ‘output_patch1_only’:
/usr/src/patchutils/patchutils-0.4.3-1.x86_64/src/patchutils-0.4.3/src/interdiff.c:835:78: error: macro "memcpy" passed 4 arguments, but takes just 3
  835 |         memcpy (argv, (const char *[]) { DIFF, options }, 2 * sizeof (char *));
      |                                                                              ^
In file included from /usr/include/string.h:180,
                 from ./lib/string.h:41,
                 from /usr/src/patchutils/patchutils-0.4.3-1.x86_64/src/patchutils-0.4.3/src/interdiff.c:38:
/usr/include/ssp/string.h:97: note: macro "memcpy" defined here
   97 | #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
      |
/usr/src/patchutils/patchutils-0.4.3-1.x86_64/src/patchutils-0.4.3/src/interdiff.c:835:9: warning: statement with no effect [-Wunused-value]
  835 |         memcpy (argv, (const char *[]) { DIFF, options }, 2 * sizeof (char *));
      |         ^~~~~~
$ gcc --version
gcc (GCC) 13.4.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -rvmo
3.6.4-1.x86_64 2025-07-15 07:55 UTC x86_64 Cygwin

patchutils-0.4.3-src-interdiff.c-memcpy-macro-compound-literal-add-parens.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions