[Bug 261359] x11/cde: build fails on armv7 FreeBSD 13

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 20 Jan 2022 17:18:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261359

            Bug ID: 261359
           Summary: x11/cde: build fails on armv7 FreeBSD 13
           Product: Ports & Packages
           Version: Latest
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: cy@FreeBSD.org
          Reporter: fuz@fuz.su
                CC: pkubaj@FreeBSD.org
          Assignee: cy@FreeBSD.org
             Flags: maintainer-feedback?(cy@FreeBSD.org)

A recent commit [1] broke the build of x11/cde on armv7.  This is due to a
wrong type for a newly introduced local variable.  The offending patch is:

--- programs/dtksh/ksh93/src/lib/libast/hash/hashalloc.c.orig   2021-12-13
19:03:46 UTC
+++ programs/dtksh/ksh93/src/lib/libast/hash/hashalloc.c
@@ -49,6 +49,7 @@ hashalloc(Hash_table_t* ref, ...)
        va_list*                vp = va;
        Hash_region_f           region = 0;
        void*                   handle;
+       va_listarg              tmpval;

        va_start(ap, ref);

@@ -151,7 +152,8 @@ hashalloc(Hash_table_t* ref, ...)
                                va_copy(*vp, ap);
                                vp++;
                        }
-                       va_copy(ap, va_listval(va_arg(ap, va_listarg)));
+                       tmpval = va_listval(va_arg(ap, va_listarg));
+                       va_copy(ap, tmpval);
                        break;
                case 0:
                        if (vp > va)

The build then fails with error messages:

/wrkdirs/usr/ports/x11/cde/work/cde-2.4.0/programs/dtksh/ksh93/src/lib/libast/hash/hashalloc.c:155:11:
error: assigning to 'va_list *' (aka '__builtin_va_list *') from incompatible
type 'va_list' (aka '__builtin_va_list'); take the address with &
                        tmpval = va_listval(va_arg(ap, va_listarg));
                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 &(                                )
/wrkdirs/usr/ports/x11/cde/work/cde-2.4.0/programs/dtksh/ksh93/src/lib/libast/hash/hashalloc.c:156:4:
error: non-const lvalue reference to type '__builtin_va_list' cannot bind to a
value of unrelated type 'va_list *' (aka '__builtin_va_list *')
                        va_copy(ap, tmpval);
                        ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/_stdarg.h:49:32: note: expanded from macro 'va_copy'
    #define     va_copy(dest, src)      __va_copy(dest, src)
                                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/sys/_stdarg.h:47:58: note: expanded from macro '__va_copy'
  #define       __va_copy(dest, src)    __builtin_va_copy((dest), (src))
                                                                  ^~~~~
2 errors generated.

Likely, this can be fixed by changing the type of tmpval.  I am however
completely unfamiliar with the code base and for a lack of comments have no
idea what the purpose of this patch is or why it is needed in the first place,
so I don't think I can fix this on my own without further information.

[1]:
https://cgit.freebsd.org/ports/commit/?id=c66a851d13783558a8fa17ffcf64759a0c1b5bab

-- 
You are receiving this mail because:
You are the assignee for the bug.