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>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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 AM 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=1;
>      129
>      130      arg_fmt_lists* aflp;
>      131      arg_fmt_lists* aflp_top;
>      132
>      133     struct a_build_ctrl_t   abc = {.ap=vap,
> last_arg_t=ARGU_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 = {.ap=vap, .last_arg_t=ARGU_NONE};
>
>
>

-- 
__________________

:(){ :|:& };:

[-- Attachment #2 --]
<div dir="ltr"><div><a href="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="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 10, 2024 at 4:24 AM Jin Guojun[VFF] &lt;<a href="mailto:jguojun@gmail.com">jguojun@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="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:  typedef __va_list       va_list;<br>
included by /usr/include/stdarg.h via x86/stdarg.h<br>
<br>
  Does anyone have ideas on what could cause such compiling failure?<br>
<br>
-Jin<br>
<br>
     10 #include &lt;stdarg.h&gt;<br>
      11 #include &lt;stdio.h&gt;<br>
<br>
     118 struct  a_build_ctrl_t  {<br>
     119         va_list         ap;     /* what is different from vap <br>
at line 126?    */<br>
     120         argu_type       last_arg_t;<br>
     121 };<br>
     124<br>
     125 arg_fmt_lists*<br>
     126 build_arg_fmt_list(arg_fmt_list_string* fmt, va_list vap)<br>
     127 {<br>
     128     int     na=1;<br>
     129<br>
     130      arg_fmt_lists* aflp;<br>
     131      arg_fmt_lists* aflp_top;<br>
     132<br>
     133     struct a_build_ctrl_t   abc = {.ap=vap, <br>
last_arg_t=ARGU_NONE};<br>
<br>
  ...<br>
<br>
       }<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>
   133 | struct a_build_ctrl_t   abc = {.ap=vap, .last_arg_t=ARGU_NONE};<br>
<br>
<br>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">__________________<br><br>:(){ :|:&amp; };:</div>
help

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