From nobody Mon Mar 11 01:44:25 2024 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TtKMJ1BJkz5DMKB; Mon, 11 Mar 2024 01:44:28 +0000 (UTC) (envelope-from jguojun@gmail.com) Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TtKMH6RJ6z42hN; Mon, 11 Mar 2024 01:44:27 +0000 (UTC) (envelope-from jguojun@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-609eb87a9e3so25813057b3.0; Sun, 10 Mar 2024 18:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710121467; x=1710726267; darn=freebsd.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=tmdeVMyR7+HC6XhvRvrstXcDyGBJCioOHQ1m213SIzk=; b=L1uhpap6cWPPSEV3Wwl/nMsKqZiTSJajv9XlLGfSPpwOzAWVd0gEMB28YJzD1BXWqh gB37Dy602o38l31kt+SHv6iY1cT424NZiFL3DiyuP7mAcNIgw+9eQHmGuIizU+azDgOW 3QrV4wyCul3h52qaCXjBgT3nxGVBT5fOUuQWrOLhyRtyLtTy7+KYT8REQzhmTGQn4+kl vgO+iCPBw4byEKsr/p7vSQGPVXf42LRKIdrzyCahNnRhTZBlzpjP7jHdOiMuNpSXJRl5 lBWJWh+J3K2U6jumdqY9RvhJQDzSCaHoJEX1C0/GWsQEwqUJ6G+AgIKC6vt85TPyeZmy n3Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710121467; x=1710726267; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=tmdeVMyR7+HC6XhvRvrstXcDyGBJCioOHQ1m213SIzk=; b=tqob/SmGHLyCoi819KgE1ik2+JKsmuztVjte/vQ5ZDtvRzoVJ0rP7QHdxE6x2ek3lk RdM0ilvu/yj8e9zTYVYLJFSeP6cizZer6er62AJOog2UwdMuEUbkwgc9Kc4mqF+Fc5HY voozEkRWtjVXn4S2mdNHQBwkt7ypVs0i7zh/E1owhWGqCOImBYjXlpeNJHJD4TAZxoYh JGXu+RqehkXi8AS09HVLXpt+WunWDxevlf0Mb4R2UlCjmuJLcJs8dfzLw7G0ge3ztZ6c GbFIHkifW98BJYgEELkdwCp1QthQ5vzf56ol+37CVpLarHcAcmFuKcJC36w4dMX5dzlL e1iQ== X-Forwarded-Encrypted: i=1; AJvYcCXYkPeph1ELT47v3gfTUpK2VlTnthX8pq0b2grXxvixMYHlIo36hyRVjMLF+kXl5p3H6J8FEQJhBbeV92jd7VjLGQ+gXnPVK92Zhzo= X-Gm-Message-State: AOJu0YzX1PrDqiajq77JIBCwoHAAA7OCC1Wtt+Iz4r63Fna4n13IrAX1 yPdF8YTXScpvzRxKhL8MgAYa57M3dENdDb+9JxWwLVUTrbDrrgr/DkZ9DE0= X-Google-Smtp-Source: AGHT+IGhr7sUEkFWE9q+ma96xeOokHRnokhZ5IYKmJmUfWo3TlQIlpwERHWVRMyUIo2XsuDnmYL3oA== X-Received: by 2002:a0d:ea49:0:b0:609:fe63:2a63 with SMTP id t70-20020a0dea49000000b00609fe632a63mr4065289ywe.11.1710121467036; Sun, 10 Mar 2024 18:44:27 -0700 (PDT) Received: from [192.168.1.82] (76-218-103-166.lightspeed.sntcca.sbcglobal.net. [76.218.103.166]) by smtp.gmail.com with ESMTPSA id h145-20020a816c97000000b0060a027b92d9sm1070751ywc.101.2024.03.10.18.44.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Mar 2024 18:44:26 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------joK2SjmRaYGe8pjGzeKuhiKD" Message-ID: <1905d799-7251-4343-b53c-6b665ff88866@gmail.com> Date: Sun, 10 Mar 2024 18:44:25 -0700 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: weird compiler error in 13.3-R To: Paul Procacci Cc: freebsd-questions , freebsd-hackers@freebsd.org References: <4d6edaa6-237d-4207-9047-ddee78ee4b90@gmail.com> Content-Language: en-US From: "Jin Guojun[VFF]" In-Reply-To: X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4TtKMH6RJ6z42hN 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] 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 >       11 #include > >      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
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:
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--