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

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------joK2SjmRaYGe8pjGzeKuhiKD
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

The problem is not type conversion issue described in compiling message 
. If the problem is a conversion issue, then it is easy to fix in coding.

The problem is compiler treated va_list as unsigned in in line 119, then 
treated va_list as a structure pointer. This looks like a compiler bug.

+hackers to see if someone knows what happened in the new compiler.

-Jin

On 3/10/24 00:43, Paul Procacci wrote:
> 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};
>
>
>
>
> -- 
> __________________
>
> :(){ :|:& };:


--------------joK2SjmRaYGe8pjGzeKuhiKD
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">The problem is not type conversion
      issue described in compiling message . If the problem is a
      conversion issue, then it is easy to fix in coding.<br>
      <div class="moz-cite-prefix"><br>
      </div>
    </div>
    <div class="moz-cite-prefix">The problem is compiler treated va_list
      as unsigned in in line 119, then treated va_list as a structure
      pointer. This looks like a compiler bug.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">+hackers to see if someone knows what
      happened in the new compiler.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">-Jin</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 3/10/24 00:43, Paul Procacci wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFbbPui9GjEaL-RCXYCBXJr6V5or7_72v8wr3=AZrcNM-qT6FQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div><a href="https://reviews.llvm.org/D129881"
            moz-do-not-send="true" class="moz-txt-link-freetext">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"
            moz-do-not-send="true" class="moz-txt-link-freetext">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 'struct __va_list_tag *'.<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 'unsigned int' with an expression of type 'struct
          <br>
          __va_list_tag *' [-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>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>

--------------joK2SjmRaYGe8pjGzeKuhiKD--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1905d799-7251-4343-b53c-6b665ff88866>