Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Mar 2024 04:43:55 -0400
From:      Paul Procacci <pprocacci@gmail.com>
To:        "Jin Guojun[VFF]" <jguojun@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: weird compiler error in 13.3-R
Message-ID:  <CAFbbPui9GjEaL-RCXYCBXJr6V5or7_72v8wr3=AZrcNM-qT6FQ@mail.gmail.com>
In-Reply-To: <4d6edaa6-237d-4207-9047-ddee78ee4b90@gmail.com>
References:  <4d6edaa6-237d-4207-9047-ddee78ee4b90@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000007e292306134a6df5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

https://reviews.llvm.org/D129881

The author of the change can explain it better than anyone else here.

~Paul

On Sun, Mar 10, 2024 at 4:24=E2=80=AFAM Jin Guojun[VFF] <jguojun@gmail.com>=
 wrote:

> Updated 13.2 to 13.3 and get a weird compiling failure. The code
> compiled since FreeBSD release 4 till release 13.2.
>
> Both ap (line 119) and vap (line 126) are declared as va_list, somehow
> clang version 17.0.6 thinks va_list at line 119 is uint,
>
> where va_list in line 126 is 'struct __va_list_tag *'.
>
> Checked /usr/include and va_list is declared in
> /usr/include/sys/_stdarg.h:39:  typedef __va_list       va_list;
> included by /usr/include/stdarg.h via x86/stdarg.h
>
>   Does anyone have ideas on what could cause such compiling failure?
>
> -Jin
>
>      10 #include <stdarg.h>
>       11 #include <stdio.h>
>
>      118 struct  a_build_ctrl_t  {
>      119         va_list         ap;     /* what is different from vap
> at line 126?    */
>      120         argu_type       last_arg_t;
>      121 };
>      124
>      125 arg_fmt_lists*
>      126 build_arg_fmt_list(arg_fmt_list_string* fmt, va_list vap)
>      127 {
>      128     int     na=3D1;
>      129
>      130      arg_fmt_lists* aflp;
>      131      arg_fmt_lists* aflp_top;
>      132
>      133     struct a_build_ctrl_t   abc =3D {.ap=3Dvap,
> last_arg_t=3DARGU_NONE};
>
>   ...
>
>        }
>
> test.c:133:34: error: incompatible pointer to integer conversion
> initializing 'unsigned int' with an expression of type 'struct
> __va_list_tag *' [-Wint-conversion]
>    133 | struct a_build_ctrl_t   abc =3D {.ap=3Dvap, .last_arg_t=3DARGU_N=
ONE};
>
>
>

--=20
__________________

:(){ :|:& };:

--0000000000007e292306134a6df5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><a href=3D"https://reviews.llvm.org/D129881">https://=
reviews.llvm.org/D129881</a><br><br></div><div>The author of the change can=
 explain it better than anyone else here.<br><br></div>~Paul<br></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Mar=
 10, 2024 at 4:24=E2=80=AFAM Jin Guojun[VFF] &lt;<a href=3D"mailto:jguojun@=
gmail.com">jguojun@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex">Updated 13.2 to 13.3 and get a weird compiling =
failure. The code <br>
compiled since FreeBSD release 4 till release 13.2.<br>
<br>
Both ap (line 119) and vap (line 126) are declared as va_list, somehow <br>
clang version 17.0.6 thinks va_list at line 119 is uint,<br>
<br>
where va_list in line 126 is &#39;struct __va_list_tag *&#39;.<br>
<br>
Checked /usr/include and va_list is declared in <br>
/usr/include/sys/_stdarg.h:39:=C2=A0 typedef __va_list=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 va_list;<br>
included by /usr/include/stdarg.h via x86/stdarg.h<br>
<br>
=C2=A0=C2=A0Does anyone have ideas on what could cause such compiling failu=
re?<br>
<br>
-Jin<br>
<br>
=C2=A0=C2=A0=C2=A0=C2=A0 10 #include &lt;stdarg.h&gt;<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 11 #include &lt;stdio.h&gt;<br>
<br>
=C2=A0=C2=A0=C2=A0=C2=A0 118 struct=C2=A0 a_build_ctrl_t=C2=A0 {<br>
=C2=A0=C2=A0=C2=A0=C2=A0 119 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 va_=
list=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ap;=C2=A0=C2=A0=C2=A0=
=C2=A0 /* what is different from vap <br>
at line 126? =C2=A0=C2=A0 */<br>
=C2=A0=C2=A0=C2=A0=C2=A0 120 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 arg=
u_type=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 last_arg_t;<br>
=C2=A0=C2=A0=C2=A0=C2=A0 121 };<br>
=C2=A0=C2=A0=C2=A0=C2=A0 124<br>
=C2=A0=C2=A0=C2=A0=C2=A0 125 arg_fmt_lists*<br>
=C2=A0=C2=A0=C2=A0=C2=A0 126 build_arg_fmt_list(arg_fmt_list_string* fmt, v=
a_list vap)<br>
=C2=A0=C2=A0=C2=A0=C2=A0 127 {<br>
=C2=A0=C2=A0=C2=A0=C2=A0 128=C2=A0=C2=A0 =C2=A0 int=C2=A0=C2=A0=C2=A0=C2=A0=
 na=3D1;<br>
=C2=A0=C2=A0=C2=A0=C2=A0 129<br>
=C2=A0=C2=A0=C2=A0=C2=A0 130 =C2=A0=C2=A0 =C2=A0 arg_fmt_lists* aflp;<br>
=C2=A0=C2=A0=C2=A0=C2=A0 131=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 arg_fmt_lists* a=
flp_top;<br>
=C2=A0=C2=A0=C2=A0=C2=A0 132<br>
=C2=A0=C2=A0=C2=A0=C2=A0 133 =C2=A0=C2=A0=C2=A0 struct a_build_ctrl_t=C2=A0=
=C2=A0 abc =3D {.ap=3Dvap, <br>
last_arg_t=3DARGU_NONE};<br>
<br>
=C2=A0=C2=A0...<br>
<br>
=C2=A0=C2=A0 =C2=A0 =C2=A0 }<br>
<br>
test.c:133:34: error: incompatible pointer to integer conversion <br>
initializing &#39;unsigned int&#39; with an expression of type &#39;struct =
<br>
__va_list_tag *&#39; [-Wint-conversion]<br>
=C2=A0=C2=A0 133 | struct a_build_ctrl_t=C2=A0=C2=A0 abc =3D {.ap=3Dvap, .l=
ast_arg_t=3DARGU_NONE};<br>
<br>
<br>
</blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signature_pre=
fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">_____________=
_____<br><br>:(){ :|:&amp; };:</div>

--0000000000007e292306134a6df5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFbbPui9GjEaL-RCXYCBXJr6V5or7_72v8wr3=AZrcNM-qT6FQ>