From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 8FE603858D38 for ; Thu, 25 Jan 2024 13:40:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FE603858D38 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8FE603858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706190022; cv=none; b=CzPEx47h57Na76yALqvJ+TGW6f64VLfz9f0vq8OvSgh3EtXBqsSgp3k5aibLSq5J0G/KpG0zZyLwdCN9hdWcNtChpYhXLeZikH5dZ7xWBmQpqanoY1DK1bIlL4dwQvoMBVXvYxBcUgzTNPmjjQb2jBPwRc8ZtejcNeC6ScwYLYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706190022; c=relaxed/simple; bh=y2mljyh/bFf8qJrnCscoJ1cJTQBvv6ImOOLdqq5Pw+k=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=o/VbIpLNcL77j5XZ7q6UdtsvUKis6kTZW0Ohy429WVH9nQSByG+Yc5AxUuAuftXjh6/TvR2WFTyRKuRc3qX3gb7GEGfV2SVBV8WIIa/6tJ44DJKVf7R+v9u9LNlaQko8eaKqXSGH9lZmOY0yEOPDMTb5sGhAMc/8OfsZv6Bavk8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ddcfda697cso452515b3a.2 for ; Thu, 25 Jan 2024 05:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1706190014; x=1706794814; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qicMVXN5O1NX4DG/kdixSQDJBam9vXF6UyDN6YuTiwY=; b=iNeIBHUEoDagHPaQRTnBWG3O10v9jzsWFVCX0ZSPmUr/JPLnsOFW5Ap5lZ4t5aluRA JhueZTdEs//IT1c6jYHGGConJcCtdy4CskW+emUAB0yS1a8+kXTHvjiCKkULIIn6KNpy nox7HxF5NZqSCxDcaCJuQSrWmcbGcJrcaYyI6b4CCgi51L0ajcXdB8lQ+kgj+0LxPg4S Jfm65689nlPAWHMiwA68fr/SZiE2xyKFCCtWAv6fiBuLCkW4NXUkWWp91zKaiMnTqRl5 Kyfdjov+/fikaKmfX5pM3Wakm1S0dG0/hGaprIuhO7oMKLftHydzjWCHBPfQEQ2NV6BP Vi6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706190014; x=1706794814; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qicMVXN5O1NX4DG/kdixSQDJBam9vXF6UyDN6YuTiwY=; b=CD117oXEf6cvdgMnyWM3iR16Vw9K7ffTXo6bu+ySfzVDKHd2t0b0AFfSwpukXbMOkR p2Dop1OlNy2atfL7PwjS69snOej2ElQdR2/XAaESuJTAUOevRnSAgDUXwpV1QhpeY9qR fF9fyGmbIGbXTuAviLLujVZ09ILpjCyB5JDhbGHCo51h6h8j5NFL/9G1qEHRE8OF/dFm WH4i+NSWTz/lMq/pYjtoeVEX0f/Yy72RBrcaTWqa5/NkP6RtkQgta2FhFaLMaUHt8POw 5royjwnhCbyFCwXFLyIdFYcQphkXtwc6gklKyWVtbsKXiKU6FEQrm0vYsLCK/lkARPHf azEg== X-Gm-Message-State: AOJu0YxRxt5xtF0y1ghgXCyML2a64xEf1GKF8sFyGdiyjVjF0Lgik01Z ft9vCTB09MIcibrQygcai/nB/Z5RbPhMD8Cz9KklWmXvMR6yw6j5zTW2jmEsXXhyjUkquZ8IIw6 bREhYo2vuPeIpR6eyU7yOcaAo541M7Q6EtOtB9w== X-Google-Smtp-Source: AGHT+IE2Nve/qHpZ5P/AZu2o4jTjN5CxL+2Lsv6OgiPNVXziqFJ0iD7PlxMxG0AmlkAFvAAJ92Z/h82fhGBSG3g43c4= X-Received: by 2002:a05:6a20:938f:b0:19a:fa4c:33e3 with SMTP id x15-20020a056a20938f00b0019afa4c33e3mr1274098pzh.19.1706190014382; Thu, 25 Jan 2024 05:40:14 -0800 (PST) MIME-Version: 1.0 References: <20240125123349.981882-1-juzhe.zhong@rivai.ai> In-Reply-To: <20240125123349.981882-1-juzhe.zhong@rivai.ai> From: Kito Cheng Date: Thu, 25 Jan 2024 21:40:02 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Fix incorrect LCM delete bug [VSETVL PASS] To: Juzhe-Zhong Cc: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_FILL_THIS_FORM_SHORT,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Use this reduced testcase, but please verify this in your end again. For the code change part, I would like to let other to review :P struct a { int b; int c : 1; int : 1; } d(); typedef struct { int e; struct { int f; }; } g; int i; char k, l, n; void *m; char *o; void h(); char *j(); void p(int buf, __builtin_va_list ab, int q) { do { void *r[] =3D {&&s, &&t, &&u, &&v, &&w}; int c; goto *m; s: c =3D 1; while (1) { t: u: ae: void *af =3D __builtin_va_arg(ab, void *); h(p); o =3D j(i); if (o =3D=3D 0) goto ae; l =3D 'S'; break; v: g ah; __builtin_memset(&ah, '\0', sizeof(g)); h(n, __builtin_va_arg(ab, int), &ah); break; w: if (__builtin_expect(q, 0)) c =3D 0; struct a ai =3D {'S', c}; d(buf, ai, af); } } while (k); } On Thu, Jan 25, 2024 at 8:34=E2=80=AFPM Juzhe-Zhong = wrote: > > This patch fixes the recent noticed bug in RV32 glibc. > > We incorrectly deleted a vsetvl: > > ... > and a4,a4,a3 > vmv.v.i v1,0 ---> Missed vsetvl cause illegal ins= truction report. > vse8.v v1,0(a5) > > The root cause the laterin in LCM is incorrect. > > BB 358: > avloc: n_bits =3D 2, set =3D {} > kill: n_bits =3D 2, set =3D {} > antloc: n_bits =3D 2, set =3D {} > transp: n_bits =3D 2, set =3D {} > avin: n_bits =3D 2, set =3D {} > avout: n_bits =3D 2, set =3D {} > del: n_bits =3D 2, set =3D {} > > cause LCM let BB 360 delete the vsetvl: > > BB 360: > avloc: n_bits =3D 2, set =3D {} > kill: n_bits =3D 2, set =3D {} > antloc: n_bits =3D 2, set =3D {} > transp: n_bits =3D 2, set =3D {0 1 } > avin: n_bits =3D 2, set =3D {} > avout: n_bits =3D 2, set =3D {} > del: n_bits =3D 2, set =3D {1} > > Also, remove unknown vsetvl info into local computation since it is unnec= essary. > > Tested on both RV32/RV64 no regression. > > PR target/113469 > > gcc/ChangeLog: > > * config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_lcm_local_pro= perties): Fix bug. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/rvv/autovec/pr113469.c: New test. > > --- > gcc/config/riscv/riscv-vsetvl.cc | 21 +- > .../gcc.target/riscv/rvv/autovec/pr113469.c | 1841 +++++++++++++++++ > 2 files changed, 1853 insertions(+), 9 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c > > diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vs= etvl.cc > index da258b964fc..f300f00e62a 100644 > --- a/gcc/config/riscv/riscv-vsetvl.cc > +++ b/gcc/config/riscv/riscv-vsetvl.cc > @@ -2543,8 +2543,10 @@ pre_vsetvl::compute_lcm_local_properties () > vsetvl_info &header_info =3D block_info.get_entry_info (); > vsetvl_info &footer_info =3D block_info.get_exit_info (); > gcc_assert (footer_info.valid_p () || footer_info.unknown_p ()); > - add_expr (m_exprs, header_info); > - add_expr (m_exprs, footer_info); > + if (header_info.valid_p ()) > + add_expr (m_exprs, header_info); > + if (footer_info.valid_p ()) > + add_expr (m_exprs, footer_info); > } > > int num_exprs =3D m_exprs.length (); > @@ -2699,13 +2701,6 @@ pre_vsetvl::compute_lcm_local_properties () > } > } > > - for (const bb_info *bb : crtl->ssa->bbs ()) > - { > - unsigned bb_index =3D bb->index (); > - bitmap_ior (m_kill[bb_index], m_transp[bb_index], m_avloc[bb_index= ]); > - bitmap_not (m_kill[bb_index], m_kill[bb_index]); > - } > - > for (const bb_info *bb : crtl->ssa->bbs ()) > { > unsigned bb_index =3D bb->index (); > @@ -2713,8 +2708,16 @@ pre_vsetvl::compute_lcm_local_properties () > { > bitmap_clear (m_antloc[bb_index]); > bitmap_clear (m_transp[bb_index]); > + bitmap_clear (m_avloc[bb_index]); > } > } > + > + for (const bb_info *bb : crtl->ssa->bbs ()) > + { > + unsigned bb_index =3D bb->index (); > + bitmap_ior (m_kill[bb_index], m_transp[bb_index], m_avloc[bb_index= ]); > + bitmap_not (m_kill[bb_index], m_kill[bb_index]); > + } > } > > void > diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c b/gcc/= testsuite/gcc.target/riscv/rvv/autovec/pr113469.c > new file mode 100644 > index 00000000000..2502040772b > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c > @@ -0,0 +1,1841 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=3Drv32gcv -mabi=3Dilp32d -O3" } */ > + > +#include > +#include > +#include > +#include > +#include > + > +static int read_int (const unsigned char * *pstr) {}; > +static const char null[] =3D "(null)"; > +extern size_t __strnlen (const char *__string, size_t __maxlen) __attrib= ute__ ((__pure__)); > + > +struct printf_info > +{ > + int prec; > + int width; > + wchar_t spec; > + unsigned int is_long_double:1; > + unsigned int is_short:1; > + unsigned int is_long:1; > + unsigned int alt:1; > + unsigned int space:1; > + unsigned int left:1; > + unsigned int showsign:1; > + unsigned int group:1; > + unsigned int extra:1; > + unsigned int is_char:1; > + unsigned int wide:1; > + unsigned int i18n:1; > + unsigned int is_binary128:1; > + > + unsigned int __pad:3; > + unsigned short int user; > + wchar_t pad; > +}; > + > +enum { > + ABDAY_1 =3D (((2) << 16) | (0)), > + ABDAY_2, > + ABDAY_3, > + ABDAY_4, > + ABDAY_5, > + ABDAY_6, > + ABDAY_7, > + DAY_1, > + DAY_2, > + DAY_3, > + DAY_4, > + DAY_5, > + DAY_6, > + DAY_7, > + ABMON_1, > + ABMON_2, > + ABMON_3, > + ABMON_4, > + ABMON_5, > + ABMON_6, > + ABMON_7, > + ABMON_8, > + ABMON_9, > + ABMON_10, > + ABMON_11, > + ABMON_12, > + MON_1, > + MON_2, > + MON_3, > + MON_4, > + MON_5, > + MON_6, > + MON_7, > + MON_8, > + MON_9, > + MON_10, > + MON_11, > + MON_12, > + AM_STR, > + PM_STR, > + D_T_FMT, > + D_FMT, > + T_FMT, > + T_FMT_AMPM, > + ERA, > + __ERA_YEAR, > + ERA_D_FMT, > + > + ALT_DIGITS, > + > + ERA_D_T_FMT, > + > + ERA_T_FMT, > + _NL_TIME_ERA_NUM_ENTRIES, > + _NL_TIME_ERA_ENTRIES, > + > + _NL_WABDAY_1, > + _NL_WABDAY_2, > + _NL_WABDAY_3, > + _NL_WABDAY_4, > + _NL_WABDAY_5, > + _NL_WABDAY_6, > + _NL_WABDAY_7, > + _NL_WDAY_1, > + _NL_WDAY_2, > + _NL_WDAY_3, > + _NL_WDAY_4, > + _NL_WDAY_5, > + _NL_WDAY_6, > + _NL_WDAY_7, > + > + > + > + _NL_WABMON_1, > + _NL_WABMON_2, > + _NL_WABMON_3, > + _NL_WABMON_4, > + _NL_WABMON_5, > + _NL_WABMON_6, > + _NL_WABMON_7, > + _NL_WABMON_8, > + _NL_WABMON_9, > + _NL_WABMON_10, > + _NL_WABMON_11, > + _NL_WABMON_12, > + > + > + > + _NL_WMON_1, > + _NL_WMON_2, > + _NL_WMON_3, > + _NL_WMON_4, > + _NL_WMON_5, > + _NL_WMON_6, > + _NL_WMON_7, > + _NL_WMON_8, > + _NL_WMON_9, > + _NL_WMON_10, > + _NL_WMON_11, > + _NL_WMON_12, > + > + _NL_WAM_STR, > + _NL_WPM_STR, > + > + _NL_WD_T_FMT, > + _NL_WD_FMT, > + _NL_WT_FMT, > + _NL_WT_FMT_AMPM, > + > + _NL_WERA_YEAR, > + _NL_WERA_D_FMT, > + _NL_WALT_DIGITS, > + _NL_WERA_D_T_FMT, > + _NL_WERA_T_FMT, > + > + _NL_TIME_WEEK_NDAYS, > + _NL_TIME_WEEK_1STDAY, > + _NL_TIME_WEEK_1STWEEK, > + _NL_TIME_FIRST_WEEKDAY, > + _NL_TIME_FIRST_WORKDAY, > + _NL_TIME_CAL_DIRECTION, > + _NL_TIME_TIMEZONE, > + > + _DATE_FMT, > + > + _NL_W_DATE_FMT, > + > + _NL_TIME_CODESET, > + > + __ALTMON_1, > + __ALTMON_2, > + __ALTMON_3, > + __ALTMON_4, > + __ALTMON_5, > + __ALTMON_6, > + __ALTMON_7, > + __ALTMON_8, > + __ALTMON_9, > + __ALTMON_10, > + __ALTMON_11, > + __ALTMON_12, > + _NL_WALTMON_1, > + _NL_WALTMON_2, > + _NL_WALTMON_3, > + _NL_WALTMON_4, > + _NL_WALTMON_5, > + _NL_WALTMON_6, > + _NL_WALTMON_7, > + _NL_WALTMON_8, > + _NL_WALTMON_9, > + _NL_WALTMON_10, > + _NL_WALTMON_11, > + _NL_WALTMON_12, > + > + _NL_ABALTMON_1, > + _NL_ABALTMON_2, > + _NL_ABALTMON_3, > + _NL_ABALTMON_4, > + _NL_ABALTMON_5, > + _NL_ABALTMON_6, > + _NL_ABALTMON_7, > + _NL_ABALTMON_8, > + _NL_ABALTMON_9, > + _NL_ABALTMON_10, > + _NL_ABALTMON_11, > + _NL_ABALTMON_12, > + > + _NL_WABALTMON_1, > + _NL_WABALTMON_2, > + _NL_WABALTMON_3, > + _NL_WABALTMON_4, > + _NL_WABALTMON_5, > + _NL_WABALTMON_6, > + _NL_WABALTMON_7, > + _NL_WABALTMON_8, > + _NL_WABALTMON_9, > + _NL_WABALTMON_10, > + _NL_WABALTMON_11, > + _NL_WABALTMON_12, > + > + _NL_NUM_LC_TIME, > + > + _NL_COLLATE_NRULES =3D (((3) << 16) | (0)), > + _NL_COLLATE_RULESETS, > + _NL_COLLATE_TABLEMB, > + _NL_COLLATE_WEIGHTMB, > + _NL_COLLATE_EXTRAMB, > + _NL_COLLATE_INDIRECTMB, > + _NL_COLLATE_GAP1, > + _NL_COLLATE_GAP2, > + _NL_COLLATE_GAP3, > + _NL_COLLATE_TABLEWC, > + _NL_COLLATE_WEIGHTWC, > + _NL_COLLATE_EXTRAWC, > + _NL_COLLATE_INDIRECTWC, > + _NL_COLLATE_SYMB_HASH_SIZEMB, > + _NL_COLLATE_SYMB_TABLEMB, > + _NL_COLLATE_SYMB_EXTRAMB, > + _NL_COLLATE_COLLSEQMB, > + _NL_COLLATE_COLLSEQWC, > + _NL_COLLATE_CODESET, > + _NL_NUM_LC_COLLATE, > + _NL_CTYPE_CLASS =3D (((0) << 16) | (0)), > + _NL_CTYPE_TOUPPER, > + _NL_CTYPE_GAP1, > + _NL_CTYPE_TOLOWER, > + _NL_CTYPE_GAP2, > + _NL_CTYPE_CLASS32, > + _NL_CTYPE_GAP3, > + _NL_CTYPE_GAP4, > + _NL_CTYPE_GAP5, > + _NL_CTYPE_GAP6, > + _NL_CTYPE_CLASS_NAMES, > + _NL_CTYPE_MAP_NAMES, > + _NL_CTYPE_WIDTH, > + _NL_CTYPE_MB_CUR_MAX, > + _NL_CTYPE_CODESET_NAME, > + CODESET =3D _NL_CTYPE_CODESET_NAME, > + > + _NL_CTYPE_TOUPPER32, > + _NL_CTYPE_TOLOWER32, > + _NL_CTYPE_CLASS_OFFSET, > + _NL_CTYPE_MAP_OFFSET, > + _NL_CTYPE_INDIGITS_MB_LEN, > + _NL_CTYPE_INDIGITS0_MB, > + _NL_CTYPE_INDIGITS1_MB, > + _NL_CTYPE_INDIGITS2_MB, > + _NL_CTYPE_INDIGITS3_MB, > + _NL_CTYPE_INDIGITS4_MB, > + _NL_CTYPE_INDIGITS5_MB, > + _NL_CTYPE_INDIGITS6_MB, > + _NL_CTYPE_INDIGITS7_MB, > + _NL_CTYPE_INDIGITS8_MB, > + _NL_CTYPE_INDIGITS9_MB, > + _NL_CTYPE_INDIGITS_WC_LEN, > + _NL_CTYPE_INDIGITS0_WC, > + _NL_CTYPE_INDIGITS1_WC, > + _NL_CTYPE_INDIGITS2_WC, > + _NL_CTYPE_INDIGITS3_WC, > + _NL_CTYPE_INDIGITS4_WC, > + _NL_CTYPE_INDIGITS5_WC, > + _NL_CTYPE_INDIGITS6_WC, > + _NL_CTYPE_INDIGITS7_WC, > + _NL_CTYPE_INDIGITS8_WC, > + _NL_CTYPE_INDIGITS9_WC, > + _NL_CTYPE_OUTDIGIT0_MB, > + _NL_CTYPE_OUTDIGIT1_MB, > + _NL_CTYPE_OUTDIGIT2_MB, > + _NL_CTYPE_OUTDIGIT3_MB, > + _NL_CTYPE_OUTDIGIT4_MB, > + _NL_CTYPE_OUTDIGIT5_MB, > + _NL_CTYPE_OUTDIGIT6_MB, > + _NL_CTYPE_OUTDIGIT7_MB, > + _NL_CTYPE_OUTDIGIT8_MB, > + _NL_CTYPE_OUTDIGIT9_MB, > + _NL_CTYPE_OUTDIGIT0_WC, > + _NL_CTYPE_OUTDIGIT1_WC, > + _NL_CTYPE_OUTDIGIT2_WC, > + _NL_CTYPE_OUTDIGIT3_WC, > + _NL_CTYPE_OUTDIGIT4_WC, > + _NL_CTYPE_OUTDIGIT5_WC, > + _NL_CTYPE_OUTDIGIT6_WC, > + _NL_CTYPE_OUTDIGIT7_WC, > + _NL_CTYPE_OUTDIGIT8_WC, > + _NL_CTYPE_OUTDIGIT9_WC, > + _NL_CTYPE_TRANSLIT_TAB_SIZE, > + _NL_CTYPE_TRANSLIT_FROM_IDX, > + _NL_CTYPE_TRANSLIT_FROM_TBL, > + _NL_CTYPE_TRANSLIT_TO_IDX, > + _NL_CTYPE_TRANSLIT_TO_TBL, > + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN, > + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING, > + _NL_CTYPE_TRANSLIT_IGNORE_LEN, > + _NL_CTYPE_TRANSLIT_IGNORE, > + _NL_CTYPE_MAP_TO_NONASCII, > + _NL_CTYPE_NONASCII_CASE, > + _NL_CTYPE_EXTRA_MAP_1, > + _NL_CTYPE_EXTRA_MAP_2, > + _NL_CTYPE_EXTRA_MAP_3, > + _NL_CTYPE_EXTRA_MAP_4, > + _NL_CTYPE_EXTRA_MAP_5, > + _NL_CTYPE_EXTRA_MAP_6, > + _NL_CTYPE_EXTRA_MAP_7, > + _NL_CTYPE_EXTRA_MAP_8, > + _NL_CTYPE_EXTRA_MAP_9, > + _NL_CTYPE_EXTRA_MAP_10, > + _NL_CTYPE_EXTRA_MAP_11, > + _NL_CTYPE_EXTRA_MAP_12, > + _NL_CTYPE_EXTRA_MAP_13, > + _NL_CTYPE_EXTRA_MAP_14, > + _NL_NUM_LC_CTYPE, > + > + __INT_CURR_SYMBOL =3D (((4) << 16) | (0)), > + __CURRENCY_SYMBOL, > + __MON_DECIMAL_POINT, > + __MON_THOUSANDS_SEP, > + __MON_GROUPING, > + __POSITIVE_SIGN, > + __NEGATIVE_SIGN, > + __INT_FRAC_DIGITS, > + __FRAC_DIGITS, > + __P_CS_PRECEDES, > + __P_SEP_BY_SPACE, > + __N_CS_PRECEDES, > + __N_SEP_BY_SPACE, > + __P_SIGN_POSN, > + __N_SIGN_POSN, > + _NL_MONETARY_CRNCYSTR, > + > + __INT_P_CS_PRECEDES, > + __INT_P_SEP_BY_SPACE, > + __INT_N_CS_PRECEDES, > + __INT_N_SEP_BY_SPACE, > + __INT_P_SIGN_POSN, > + __INT_N_SIGN_POSN, > + _NL_MONETARY_DUO_INT_CURR_SYMBOL, > + _NL_MONETARY_DUO_CURRENCY_SYMBOL, > + _NL_MONETARY_DUO_INT_FRAC_DIGITS, > + _NL_MONETARY_DUO_FRAC_DIGITS, > + _NL_MONETARY_DUO_P_CS_PRECEDES, > + _NL_MONETARY_DUO_P_SEP_BY_SPACE, > + _NL_MONETARY_DUO_N_CS_PRECEDES, > + _NL_MONETARY_DUO_N_SEP_BY_SPACE, > + _NL_MONETARY_DUO_INT_P_CS_PRECEDES, > + _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE, > + _NL_MONETARY_DUO_INT_N_CS_PRECEDES, > + _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE, > + _NL_MONETARY_DUO_P_SIGN_POSN, > + _NL_MONETARY_DUO_N_SIGN_POSN, > + _NL_MONETARY_DUO_INT_P_SIGN_POSN, > + _NL_MONETARY_DUO_INT_N_SIGN_POSN, > + _NL_MONETARY_UNO_VALID_FROM, > + _NL_MONETARY_UNO_VALID_TO, > + _NL_MONETARY_DUO_VALID_FROM, > + _NL_MONETARY_DUO_VALID_TO, > + _NL_MONETARY_CONVERSION_RATE, > + _NL_MONETARY_DECIMAL_POINT_WC, > + _NL_MONETARY_THOUSANDS_SEP_WC, > + _NL_MONETARY_CODESET, > + _NL_NUM_LC_MONETARY, > + __DECIMAL_POINT =3D (((1) << 16) | (0)), > + RADIXCHAR =3D __DECIMAL_POINT, > + > + __THOUSANDS_SEP, > + THOUSEP =3D __THOUSANDS_SEP, > + > + __GROUPING, > + _NL_NUMERIC_DECIMAL_POINT_WC, > + _NL_NUMERIC_THOUSANDS_SEP_WC, > + _NL_NUMERIC_CODESET, > + _NL_NUM_LC_NUMERIC, > + > + __YESEXPR =3D (((5) << 16) | (0)), > + > + __NOEXPR, > + > + __YESSTR, > + __NOSTR, > + _NL_MESSAGES_CODESET, > + _NL_NUM_LC_MESSAGES, > + > + _NL_PAPER_HEIGHT =3D (((7) << 16) | (0)), > + _NL_PAPER_WIDTH, > + _NL_PAPER_CODESET, > + _NL_NUM_LC_PAPER, > + > + _NL_NAME_NAME_FMT =3D (((8) << 16) | (0)), > + _NL_NAME_NAME_GEN, > + _NL_NAME_NAME_MR, > + _NL_NAME_NAME_MRS, > + _NL_NAME_NAME_MISS, > + _NL_NAME_NAME_MS, > + _NL_NAME_CODESET, > + _NL_NUM_LC_NAME, > + > + _NL_ADDRESS_POSTAL_FMT =3D (((9) << 16) | (0)), > + _NL_ADDRESS_COUNTRY_NAME, > + _NL_ADDRESS_COUNTRY_POST, > + _NL_ADDRESS_COUNTRY_AB2, > + _NL_ADDRESS_COUNTRY_AB3, > + _NL_ADDRESS_COUNTRY_CAR, > + _NL_ADDRESS_COUNTRY_NUM, > + _NL_ADDRESS_COUNTRY_ISBN, > + _NL_ADDRESS_LANG_NAME, > + _NL_ADDRESS_LANG_AB, > + _NL_ADDRESS_LANG_TERM, > + _NL_ADDRESS_LANG_LIB, > + _NL_ADDRESS_CODESET, > + _NL_NUM_LC_ADDRESS, > + > + _NL_TELEPHONE_TEL_INT_FMT =3D (((10) << 16) | (0)), > + _NL_TELEPHONE_TEL_DOM_FMT, > + _NL_TELEPHONE_INT_SELECT, > + _NL_TELEPHONE_INT_PREFIX, > + _NL_TELEPHONE_CODESET, > + _NL_NUM_LC_TELEPHONE, > + > + _NL_MEASUREMENT_MEASUREMENT =3D (((11) << 16) | (0)), > + _NL_MEASUREMENT_CODESET, > + _NL_NUM_LC_MEASUREMENT, > + > + _NL_IDENTIFICATION_TITLE =3D (((12) << 16) | (0)), > + _NL_IDENTIFICATION_SOURCE, > + _NL_IDENTIFICATION_ADDRESS, > + _NL_IDENTIFICATION_CONTACT, > + _NL_IDENTIFICATION_EMAIL, > + _NL_IDENTIFICATION_TEL, > + _NL_IDENTIFICATION_FAX, > + _NL_IDENTIFICATION_LANGUAGE, > + _NL_IDENTIFICATION_TERRITORY, > + _NL_IDENTIFICATION_AUDIENCE, > + _NL_IDENTIFICATION_APPLICATION, > + _NL_IDENTIFICATION_ABBREVIATION, > + _NL_IDENTIFICATION_REVISION, > + _NL_IDENTIFICATION_DATE, > + _NL_IDENTIFICATION_CATEGORY, > + _NL_IDENTIFICATION_CODESET, > + _NL_NUM_LC_IDENTIFICATION, > + _NL_NUM > +}; > + > +typedef const char *THOUSANDS_SEP_T; > +typedef unsigned int size_t; > +enum { WORK_BUFFER_SIZE =3D 1000 / sizeof (char) }; > + > +enum __printf_buffer_mode > + { > + __printf_buffer_mode_failed, > + __printf_buffer_mode_sprintf, > + __printf_buffer_mode_snprintf, > + __printf_buffer_mode_sprintf_chk, > + __printf_buffer_mode_to_file, > + __printf_buffer_mode_asprintf, > + __printf_buffer_mode_dprintf, > + __printf_buffer_mode_strfmon, > + __printf_buffer_mode_fp, > + __printf_buffer_mode_fp_to_wide, > + __printf_buffer_mode_fphex_to_wide, > + __printf_buffer_mode_obstack, > +}; > + > +struct __locale_data > +{ > + const char *name; > + const char *filedata; > + off_t filesize; > + enum > + { > + ld_malloced, > + ld_mapped, > + ld_archive > + } alloc; > + void *private; > + > + unsigned int usage_count; > + > + int use_translit; > + > + unsigned int nstrings; > + union locale_data_value > + { > + const uint32_t *wstr; > + const char *string; > + unsigned int word; > + } > + values []; > +}; > + > +struct __printf_buffer > +{ > + char *write_base; > + char *write_ptr; > + char *write_end; > + uint64_t written; > + > + enum __printf_buffer_mode mode; > +}; > + > + > +void __printf_fphex_l_buffer (struct __printf_buffer *, locale_t, > + const struct printf_info *, > + const void *const *) __attribute__ ((visibility ("hidden"))); > + > +void __printf_fp_l_buffer (struct __printf_buffer *, locale_t, > + const struct printf_info *, > + const void *const *) __attribute__ ((visibility ("hidden"))); > + > +extern __thread locale_t __libc_tsd_LOCALE __attribute__ ((tls_model ("i= nitial-exec"))); > + > +static inline void > +__printf_fp_spec (struct __printf_buffer *target, > + const struct printf_info *info, const void *const *args) > +{ > + if (info->spec =3D=3D 'a' || info->spec =3D=3D 'A') > + __printf_fphex_l_buffer (target, ((__libc_tsd_LOCALE)), info, args); > + else > + __printf_fp_l_buffer (target, ((__libc_tsd_LOCALE)), info, args); > +} > + > +union printf_arg > + { > + wchar_t pa_wchar; > + int pa_int; > + long int pa_long_int; > + long long int pa_long_long_int; > + unsigned int pa_u_int; > + unsigned long int pa_u_long_int; > + unsigned long long int pa_u_long_long_int; > + double pa_double; > + long double pa_long_double; > + > + const char *pa_string; > + const wchar_t *pa_wstring; > + void *pa_pointer; > + void *pa_user; > +}; > + > + > +typedef void printf_va_arg_function (void *__mem, va_list *__ap); > + > +struct grouping_iterator > +{ > + unsigned int remaining_in_current_group; > + unsigned int remaining; > + const char *groupings; > + unsigned int non_repeating_groups; > + unsigned int separators; > +}; > + > +typedef struct > +{ > + int __count; > + union > + { > + unsigned int __wch; > + char __wchb[4]; > + } __value; > +} mbstate_t; > + > +struct printf_modifier_record; > +extern struct printf_modifier_record **__printf_modifier_table __attribu= te__ ((visibility ("hidden"))); > +extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, mbstate_t *= __restrict __ps) __attribute__ ((visibility ("hidden"))); > +extern __thread locale_t __libc_tsd_LOCALE __attribute__ ((tls_model ("i= nitial-exec"))); > +extern printf_va_arg_function **__printf_va_arg_table __attribute__ ((vi= sibility ("hidden"))); > + > +typedef int printf_function (FILE *__stream, const struct printf_info *_= _info, const void *const *__args); > + > +extern __thread int __libc_errno __attribute__ ((tls_model ("initial-exe= c"))); > + > +extern printf_function **__printf_function_table __attribute__ ((visibil= ity ("hidden"))); > + > +extern char *__strchrnul (const char *__s, int __c) __attribute__ ((__pu= re__)); > + > +extern __thread struct __locale_data *const *_nl_current_LC_NUMERIC __at= tribute__ ((visibility ("hidden"))) __attribute__ ((tls_model ("initial-exe= c"))); > + > +extern __inline __attribute__ ((__always_inline__)) const unsigned char = * > +__find_specmb (const unsigned char *format) > +{ > + return (const unsigned char *) __strchrnul ((const char *) format, '%'= ); > +} > + > +static void outstring_converted_wide_string (struct __printf_buffer *tar= get, > + const wchar_t *src, int prec, int width, _Bool left) {}; > + > +extern void __printf_buffer_write (struct __printf_buffer *buf, const ch= ar *s, > + size_t count) __attribute__ ((visibility ("hidden"))); > + > +static inline int __attribute__ ((__warn_unused_result__)) > +__printf_buffer_has_failed (struct __printf_buffer *buf) > +{ > + return buf->mode =3D=3D __printf_buffer_mode_failed; > +} > + > +static inline void > +__printf_buffer_mark_failed (struct __printf_buffer *buf) > +{ > + buf->mode =3D __printf_buffer_mode_failed; > +} > + > +void __printf_buffer_putc_1 (struct __printf_buffer *buf, char ch) > + __attribute__ ((visibility ("hidden"))); > + > +extern char *_itoa (unsigned long long int value, char *buflim, > + unsigned int base, int upper_case) __attribute__ ((visibility ("hi= dden"))); > + > +extern char *_itoa_word (unsigned long int value, char *buflim, > + unsigned int base, > + int upper_case) __attribute__ ((visibility ("hidden"))); > + > +_Bool __grouping_iterator_init (struct grouping_iterator *it, > + int category, locale_t loc, > + unsigned int digits) __attribute__ ((visi= bility ("hidden"))); > + > +_Bool __grouping_iterator_init_none (struct grouping_iterator *it, unsig= ned int digits) > + __attribute__ ((visibility ("hidden"))); > + > +int __translated_number_width (locale_t loc, const char *first, const ch= ar *last) > + __attribute__ ((visibility ("hidden"))); > + > +static inline void > +__printf_buffer_putc (struct __printf_buffer *buf, char ch) > +{ > + if (buf->write_ptr !=3D buf->write_end) > + *buf->write_ptr++ =3D ch; > + else > + __printf_buffer_putc_1 (buf, ch); > +} > + > +void __printf_buffer_pad_1 (struct __printf_buffer *buf, > + char ch, size_t count) __attribute__ ((visib= ility ("hidden"))); > + > +static void group_number (struct __printf_buffer *buf, > + struct grouping_iterator *iter, > + char *from, char *to, THOUSANDS_SEP_T thousands_sep, _Bool i18n) {}= ; > + > +extern void __libc_fatal (const char *__message) __attribute__ ((__noret= urn__)); > +int __printf_buffer_done (struct __printf_buffer *buf) __attribute__ ((v= isibility ("hidden"))); > +extern const char *__get_errname (int) __attribute__ ((visibility ("hidd= en"))); > +extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); > + > +static inline void > +__printf_buffer_pad (struct __printf_buffer *buf, char ch, ssize_t count= ) > +{ > + if (count > 0) > + __printf_buffer_pad_1 (buf, ch, count); > +} > + > +static const uint8_t jump_table[] =3D > + { > + 1, 0, 0, 4, > + 0, 14, 0, 6, > + 0, 0, 7, 2, > + 0, 3, 9, 0, > + 5, 8, 8, 8, > + 8, 8, 8, 8, > + 8, 8, 0, 0, > + 0, 0, 0, 0, > + 0, 26, 30, 25, > + 0, 19, 19, 19, > + 0, 29, 0, 0, > + 12, 0, 0, 0, > + 0, 0, 0, 21, > + 0, 0, 0, 0, > + 18, 0, 13, 0, > + 0, 0, 0, 0, > + 0, 26, 30, 20, > + 15, 19, 19, 19, > + 10, 15, 28, 0, > + 11, 24, 23, 17, > + 22, 12, 0, 21, > + 27, 16, 0, 31, > + 18, 0, 13 > + }; > + > +static void printf_positional (struct __printf_buffer *buf, > + const char *format, int readonly_format, > + va_list ap, va_list *ap_savep, > + int nspecs_done, const unsigned char *lead_str_end, > + char *work_buffer, int save_errno, > + const char *grouping, > + THOUSANDS_SEP_T thousands_sep, > + unsigned int mode_flags){}; > + > +void > +__printf_buffer (struct __printf_buffer *buf, const char *format, > + va_list ap, unsigned int mode_flags) > +{ > + > + THOUSANDS_SEP_T thousands_sep =3D 0; > + > + > + const char *grouping; > + > + > + const unsigned char *f; > + > + > + const unsigned char *lead_str_end; > + > + > + const unsigned char *end_of_spec; > + > + > + char work_buffer[WORK_BUFFER_SIZE]; > + char *workend; > + > + > + va_list ap_save; > + > + > + int nspecs_done; > + > + > + int save_errno =3D __libc_errno; > + > + > + > + int readonly_format =3D 0; > + > + > + grouping =3D (const char *) -1; > + > + __builtin_va_copy( ap_save, ap); > + > + nspecs_done =3D 0; > + f =3D lead_str_end =3D __find_specmb ((const unsigned char *) format); > + > + __printf_buffer_write (buf, format, lead_str_end - (const unsigned cha= r *) format); > + if (__printf_buffer_has_failed (buf)) > + return; > + > + if (*f =3D=3D '\0') > + return; > + > + > + if (__builtin_expect ((__printf_function_table !=3D > + ((void *)0) > + || __printf_modifier_table !=3D > + ((void *)0) > + || __printf_va_arg_table !=3D > + ((void *)0) > + ), 0)) > + goto do_positional; > + > + do > + { > + static const void *const step0_jumps[32] =3D { &&do_form_unknown, = &&do_flag_space, &&do_flag_plus, &&do_flag_minus, &&do_flag_hash, &&do_flag= _zero, &&do_flag_quote, &&do_width_asterics, &&do_width, &&do_precision, &&= do_mod_half, &&do_mod_long, &&do_mod_longlong, &&do_mod_size_t, &&do_form_p= ercent, &&do_form_integer, &&do_form_unsigned, &&do_form_octal, &&do_form_h= exa, &&do_form_float, &&do_form_character, &&do_form_string, &&do_form_poin= ter, &&do_form_number, &&do_form_strerror, &&do_form_wcharacter, &&do_form_= floathex, &&do_mod_ptrdiff_t, &&do_mod_intmax_t, &&do_flag_i18n, &&do_form_= binary, &&do_mod_bitwidth, }; static const void *const step1_jumps[32] =3D = { &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknow= n, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unkno= wn, &&do_form_unknown, &&do_precision, &&do_mod_half, &&do_mod_long, &&do_m= od_longlong, &&do_mod_size_t, &&do_form_percent, &&do_form_integer, &&do_fo= rm_unsigned, &&do_form_octal, &&do_form_hexa, &&do_form_float, &&do_form_ch= aracter, &&do_form_string, &&do_form_pointer, &&do_form_number, &&do_form_s= trerror, &&do_form_wcharacter, &&do_form_floathex, &&do_mod_ptrdiff_t, &&do= _mod_intmax_t, &&do_form_unknown, &&do_form_binary, &&do_mod_bitwidth, }; s= tatic const void *const step2_jumps[32] =3D { &&do_form_unknown, &&do_form_= unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form= _unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_for= m_unknown, &&do_mod_half, &&do_mod_long, &&do_mod_longlong, &&do_mod_size_t= , &&do_form_percent, &&do_form_integer, &&do_form_unsigned, &&do_form_octal= , &&do_form_hexa, &&do_form_float, &&do_form_character, &&do_form_string, &= &do_form_pointer, &&do_form_number, &&do_form_strerror, &&do_form_wcharacte= r, &&do_form_floathex, &&do_mod_ptrdiff_t, &&do_mod_intmax_t, &&do_form_unk= nown, &&do_form_binary, &&do_mod_bitwidth, }; static const void *const step= 3a_jumps[32] =3D { &&do_form_unknown, &&do_form_unknown, &&do_form_unknown,= &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown= , &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_mod_halfhal= f, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_perce= nt, &&do_form_integer, &&do_form_unsigned, &&do_form_octal, &&do_form_hexa,= &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown= , &&do_form_number, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown= , &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_binary= , &&do_form_unknown, }; static const void *const step3b_jumps[32] =3D { &&d= o_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&= do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &= &do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_mod_longlong, = &&do_form_unknown, &&do_form_unknown, &&do_form_percent, &&do_form_integer,= &&do_form_unsigned, &&do_form_octal, &&do_form_hexa, &&do_form_float, &&do= _form_character, &&do_form_string, &&do_form_pointer, &&do_form_number, &&d= o_form_strerror, &&do_form_wcharacter, &&do_form_floathex, &&do_form_unknow= n, &&do_form_unknown, &&do_form_unknown, &&do_form_binary, &&do_form_unknow= n, }; > + static const void *const step4_jumps[32] =3D { &&do_form_unknown, = &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown,= &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknown= , &&do_form_unknown, &&do_form_unknown, &&do_form_unknown, &&do_form_unknow= n, &&do_form_unknown, &&do_form_percent, &&do_form_integer, &&do_form_unsig= ned, &&do_form_octal, &&do_form_hexa, &&do_form_float, &&do_form_character,= &&do_form_string, &&do_form_pointer, &&do_form_number, &&do_form_strerror,= &&do_form_wcharacter, &&do_form_floathex, &&do_form_unknown, &&do_form_unk= nown, &&do_form_unknown, &&do_form_binary, &&do_form_unknown, }; > + > + int is_negative; > + union > + { > + unsigned long long int longlong; > + unsigned long int word; > + } number; > + int base; > + union printf_arg the_arg; > + char *string; > + int alt =3D 0; > + int space =3D 0; > + int left =3D 0; > + int showsign =3D 0; > + int group =3D 0; > + > + > + int is_long_double __attribute__ ((unused)) =3D 0; > + int is_short =3D 0; > + int is_long =3D 0; > + int is_char =3D 0; > + int width =3D 0; > + int prec =3D -1; > + > + > + int use_outdigits =3D 0; > + unsigned char pad =3D ' '; > + char spec; > + > + workend =3D work_buffer + WORK_BUFFER_SIZE; > + > + > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_space: > + space =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_plus: > + showsign =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_minus: > + left =3D 1; > + pad =3D ' '; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_hash: > + alt =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_zero: > + if (!left) > + pad =3D '0'; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_flag_quote: > + group =3D 1; > + > + if (grouping =3D=3D (const char *) -1) > + { > + > + > + > + > + thousands_sep =3D ((*_nl_current_LC_NUMERIC)->values[((int) (__THOUSA= NDS_SEP) & 0xffff)].string); > + > + > + grouping =3D ((*_nl_current_LC_NUMERIC)->values[((int) (__GROUPING) &= 0xffff)].string); > + if (*grouping =3D=3D '\0' || *grouping =3D=3D > + > + (0x7f * 2 + 1) > + > + > + > + > + > + || *thousands_sep =3D=3D '\0' > + > + ) > + grouping =3D > + > + ((void *)0) > + > + ; > + } > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + do_flag_i18n: > + use_outdigits =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step0_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_width_asterics: > + { > + const unsigned char *tmp; > + > + tmp =3D ++f; > + if (((unsigned int) ((*tmp) - '0') < 10)) > + { > + int pos =3D read_int (&tmp); > + > + if (pos =3D=3D -1) > + { > + (__libc_errno =3D ( > + > + 75 > + > + )); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + > + if (pos && *tmp =3D=3D '$') > + > + goto do_positional; > + } > + width =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + int > + > + ) > + > + ; > + > + > + if (width < 0) > + { > + width =3D -width; > + pad =3D ' '; > + left =3D 1; > + } > + } > + do { const void *ptr; spec =3D (*f); ptr =3D ((spec) < ' ' || (spe= c) > 'z') ? &&do_form_unknown : step1_jumps[(jump_table[(int) (spec) - ' ']= )]; goto *ptr; } while (0); > + > + > + do_width: > + width =3D read_int (&f); > + > + if (__builtin_expect ((width =3D=3D -1), 0)) > + { > + (__libc_errno =3D ( > + > + 75 > + > + )); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + > + if (*f =3D=3D '$') > + > + goto do_positional; > + do { const void *ptr; spec =3D (*f); ptr =3D ((spec) < ' ' || (spe= c) > 'z') ? &&do_form_unknown : step1_jumps[(jump_table[(int) (spec) - ' ']= )]; goto *ptr; } while (0); > + > + do_precision: > + ++f; > + if (*f =3D=3D '*') > + { > + const unsigned char *tmp; > + > + tmp =3D ++f; > + if (((unsigned int) ((*tmp) - '0') < 10)) > + { > + int pos =3D read_int (&tmp); > + > + if (pos =3D=3D -1) > + { > + (__libc_errno =3D ( > + > + 75 > + > + )); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + > + if (pos && *tmp =3D=3D '$') > + > + goto do_positional; > + } > + prec =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + int > + > + ) > + > + ; > + > + > + if (prec < 0) > + prec =3D -1; > + } > + else if (((unsigned int) ((*f) - '0') < 10)) > + { > + prec =3D read_int (&f); > + > + > + > + if (prec =3D=3D -1) > + { > + (__libc_errno =3D ( > + > + 75 > + > + )); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + } > + else > + prec =3D 0; > + do { const void *ptr; spec =3D (*f); ptr =3D ((spec) < ' ' || (spe= c) > 'z') ? &&do_form_unknown : step2_jumps[(jump_table[(int) (spec) - ' ']= )]; goto *ptr; } while (0); > + > + > + do_mod_half: > + is_short =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step3a_jumps[(jump_table[(int) (spec) - '= '])]; goto *ptr; } while (0); > + > + > + do_mod_halfhalf: > + is_short =3D 0; > + is_char =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_mod_long: > + is_long =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step3b_jumps[(jump_table[(int) (spec) - '= '])]; goto *ptr; } while (0); > + > + > + > + do_mod_longlong: > + is_long_double =3D 1; > + is_long =3D 1; > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + do_mod_size_t: > + is_long_double =3D sizeof (size_t) > sizeof (unsigned long int); > + is_long =3D sizeof (size_t) > sizeof (unsigned int); > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + do_mod_ptrdiff_t: > + is_long_double =3D sizeof (ptrdiff_t) > sizeof (unsigned long int)= ; > + is_long =3D sizeof (ptrdiff_t) > sizeof (unsigned int); > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + do_mod_intmax_t: > + is_long_double =3D sizeof (intmax_t) > sizeof (unsigned long int); > + is_long =3D sizeof (intmax_t) > sizeof (unsigned int); > + do { const void *ptr; spec =3D (*++f); ptr =3D ((spec) < ' ' || (s= pec) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' = '])]; goto *ptr; } while (0); > + > + > + do_mod_bitwidth: > + ++f; > + > + > + _Bool > + > + is_fast =3D > + > + 0 > + > + ; > + if (*f =3D=3D 'f') > + { > + ++f; > + is_fast =3D > + > + 1 > + > + ; > + } > + int bitwidth =3D 0; > + if (((unsigned int) ((*f) - '0') < 10)) > + bitwidth =3D read_int (&f); > + if (is_fast) > + switch (bitwidth) > + { > + case 8: > + bitwidth =3D 8; > + break; > + case 16: > + bitwidth =3D 32; > + break; > + case 32: > + bitwidth =3D 32; > + break; > + case 64: > + bitwidth =3D 64; > + break; > + } > + switch (bitwidth) > + { > + case 8: > + is_char =3D 1; > + break; > + case 16: > + is_short =3D 1; > + break; > + case 32: > + break; > + case 64: > + is_long_double =3D 1; > + is_long =3D 1; > + break; > + default: > + > + (__libc_errno =3D ( > + > + 22 > + > + )); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + do { const void *ptr; spec =3D (*f); ptr =3D ((spec) < ' ' || (spe= c) > 'z') ? &&do_form_unknown : step4_jumps[(jump_table[(int) (spec) - ' ']= )]; goto *ptr; } while (0); > + > + > + while (1) > + { > + > + > + > +{ > + > + > +do_form_percent: > + > + __printf_buffer_putc (buf, '%'); > + break; > + > +do_form_integer: > + > + base =3D 10; > + > + if (is_long_double) > + { > + long long int signed_number =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + long long int > + > + ) > + > + ; > + is_negative =3D signed_number < 0; > + number.longlong =3D is_negative ? (- signed_number) : signed_numbe= r; > + > + goto do_longlong_number; > + } > + else > + { > + long int signed_number; > + if (0) > + signed_number =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + long int > + > + ) > + > + ; > + else if (is_char) > + signed_number =3D (signed char) > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned int > + > + ) > + > + ; > + else if (!is_short) > + signed_number =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + int > + > + ) > + > + ; > + else > + signed_number =3D (short int) > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned int > + > + ) > + > + ; > + > + is_negative =3D signed_number < 0; > + number.word =3D is_negative ? (- signed_number) : signed_number; > + > + goto do_number; > + } > + > + > +do_form_unsigned: > + > + base =3D 10; > + goto do_unsigned_number; > + > + > +do_form_octal: > + > + base =3D 8; > + goto do_unsigned_number; > + > + > +do_form_hexa: > + > + base =3D 16; > + goto do_unsigned_number; > + > + > +do_form_binary: > + > + base =3D 2; > + goto do_unsigned_number; > + > + > +do_unsigned_number: > + > + > + > + is_negative =3D 0; > + showsign =3D 0; > + space =3D 0; > + > + if (is_long_double) > + { > + number.longlong =3D __builtin_va_arg( ap , unsigned long long int)= ; > + > + do_longlong_number: > + if (prec < 0) > + > + prec =3D 1; > + else > + > + > + pad =3D ' '; > + > + > + > + > + if (prec =3D=3D 0 && number.longlong =3D=3D 0) > + { > + string =3D workend; > + if (base =3D=3D 8 && alt) > + *--string =3D '0'; > + } > + else > + > + string =3D _itoa (number.longlong, workend, base, spec =3D=3D 'X= '); > + > + number.word =3D number.longlong !=3D 0; > + } > + else > + { > + if (0) > + number.word =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned long int > + > + ) > + > + ; > + else if (is_char) > + number.word =3D (unsigned char) > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned int > + > + ) > + > + ; > + else if (!is_short) > + number.word =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned int > + > + ) > + > + ; > + else > + number.word =3D (unsigned short int) > + > + __builtin_va_arg( > + > + ap > + > + , > + > + unsigned int > + > + ) > + > + ; > + > + do_number: > + if (prec < 0) > + > + prec =3D 1; > + else > + > + > + pad =3D ' '; > + > + > + > + > + if (prec =3D=3D 0 && number.word =3D=3D 0) > + { > + string =3D workend; > + if (base =3D=3D 8 && alt) > + *--string =3D '0'; > + } > + else > + > + string =3D _itoa_word (number.word, workend, base, > + spec =3D=3D 'X'); > + } > + > + > + struct grouping_iterator iter; > + > + > + _Bool > + > + number_slow_path =3D group || (use_outdigits && base =3D=3D 10); > + if (group) > + __grouping_iterator_init (&iter, 1, ((__libc_tsd_LOCALE)), > + workend - string); > + else if (use_outdigits && base =3D=3D 10) > + __grouping_iterator_init_none (&iter, workend - string); > + > + int number_length; > + > + if (use_outdigits && base =3D=3D 10) > + number_length =3D __translated_number_width (((__libc_tsd_LOCALE)), > + string, workend); > + else > + number_length =3D workend - string; > + if (group) > + number_length +=3D iter.separators * strlen (thousands_sep); > + > + > + > + _Bool > + > + octal_marker =3D (prec <=3D number_length && number.word !=3D 0 > + && alt && base =3D=3D 8); > + > + > + > + > + > + > + > + unsigned int prec_inc =3D (((0)>(prec - (workend - string)))?(0):(prec= - (workend - string))); > + > + if (!left) > + { > + width -=3D number_length + prec_inc; > + > + if (number.word !=3D 0 && alt && (base =3D=3D 16 || base =3D=3D 2)= ) > + > + width -=3D 2; > + > + if (octal_marker) > + --width; > + > + if (is_negative || showsign || space) > + --width; > + > + if (pad =3D=3D ' ') > + { > + __printf_buffer_pad (buf, ' ', width); > + width =3D 0; > + } > + > + if (is_negative) > + __printf_buffer_putc (buf, '-'); > + else if (showsign) > + __printf_buffer_putc (buf, '+'); > + else if (space) > + __printf_buffer_putc (buf, ' '); > + > + if (number.word !=3D 0 && alt && (base =3D=3D 16 || base =3D=3D 2)= ) > + { > + __printf_buffer_putc (buf, '0'); > + __printf_buffer_putc (buf, spec); > + } > + > + width +=3D prec_inc; > + __printf_buffer_pad (buf, '0', width); > + > + if (octal_marker) > + __printf_buffer_putc (buf, '0'); > + > + if (number_slow_path) > + group_number (buf, &iter, string, workend, thousands_sep, > + use_outdigits && base =3D=3D 10); > + else > + __printf_buffer_write (buf, string, workend - string); > + > + break; > + } > + else > + { > + > + > + if (is_negative) > + { > + __printf_buffer_putc (buf, '-'); > + --width; > + } > + else if (showsign) > + { > + __printf_buffer_putc (buf, '+'); > + --width; > + } > + else if (space) > + { > + __printf_buffer_putc (buf, ' '); > + --width; > + } > + > + if (number.word !=3D 0 && alt && (base =3D=3D 16 || base =3D=3D 2)= ) > + { > + __printf_buffer_putc (buf, '0'); > + __printf_buffer_putc (buf, spec); > + width -=3D 2; > + } > + > + if (octal_marker) > + --width; > + > + > + > + > + > + width -=3D number_length + prec_inc; > + > + __printf_buffer_pad (buf, '0', prec_inc); > + > + if (octal_marker) > + __printf_buffer_putc (buf, '0'); > + > + if (number_slow_path) > + group_number (buf, &iter, string, workend, thousands_sep, > + use_outdigits && base =3D=3D 10); > + else > + __printf_buffer_write (buf, string, workend - string); > + > + __printf_buffer_pad (buf, ' ', width); > + break; > + } > + > +do_form_pointer: > + > + { > + const void *ptr =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + void * > + > + ) > + > + ; > + if (ptr !=3D > + > + ((void *)0) > + > + ) > + { > + > + base =3D 16; > + number.word =3D (unsigned long int) ptr; > + is_negative =3D 0; > + alt =3D 1; > + group =3D 0; > + spec =3D 'x'; > + goto do_number; > + } > + else > + { > + > + string =3D (char *) "(nil)"; > + > + if (prec < 5) > + prec =3D 5; > + > + is_long =3D sizeof (char) > 1; > + goto do_print_string; > + } > + } > + > + > +do_form_number: > + if ((mode_flags & 0x0002) !=3D 0) > + { > + if (! readonly_format) > + { > + extern int __readonly_area (const void *, size_t) > + __attribute__ ((visibility ("hidden"))); > + readonly_format > + =3D __readonly_area (format, ((strlen (format) + 1) > + * sizeof (char))); > + } > + if (readonly_format < 0) > + __libc_fatal ("*** %n in writable segment detected ***\n"); > + } > + > + void *ptrptr =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + void * > + > + ) > + > + ; > + unsigned int written =3D __printf_buffer_done (buf); > + if (is_long_double) > + *(long long int *) ptrptr =3D written; > + else if (0) > + *(long int *) ptrptr =3D written; > + else if (is_char) > + *(char *) ptrptr =3D written; > + else if (!is_short) > + *(int *) ptrptr =3D written; > + else > + *(short int *) ptrptr =3D written; > + break; > + > +do_form_strerror: > + > + if (alt) > + string =3D (char *) __get_errname (save_errno); > + else > + string =3D (char *) __strerror_r (save_errno, (char *) work_buffer, > + WORK_BUFFER_SIZE * sizeof (char)); > + if (string =3D=3D > + > + ((void *)0) > + > + ) > + { > + > + base =3D 10; > + is_negative =3D save_errno < 0; > + number.word =3D save_errno; > + if (is_negative) > + number.word =3D -number.word; > + goto do_number; > + } > + else > + { > + is_long =3D 0; > + goto do_print_string; > + } > + > +do_form_character: > + > + if (is_long) > + goto do_form_wcharacter; > + --width; > + if (!left) > + __printf_buffer_pad (buf, ' ', width); > + > + > + > + > + __printf_buffer_putc (buf, (unsigned char) > + > + > + __builtin_va_arg( > + > + ap > + > + , > + > + int > + > + ) > + > + ); > + > + if (left) > + __printf_buffer_pad (buf, ' ', width); > + break; > + > +do_form_string: > + { > + size_t len; > + > + > + > + > + > + > + string =3D (char *) > + > + __builtin_va_arg( > + > + ap > + > + , > + > + const char * > + > + ) > + > + ; > + > + > + do_print_string: > + > + if (string =3D=3D > + > + ((void *)0) > + > + ) > + { > + > + if (prec =3D=3D -1 || prec >=3D (int) (sizeof (null) / sizeof ((= null)[0]) + 0 * sizeof (struct { _Static_assert (!__builtin_types_compatibl= e_p (__typeof (null), __typeof (&(null)[0])), "argument must be an array");= })) - 1) > + { > + string =3D (char *) null; > + len =3D (sizeof (null) / sizeof ((null)[0]) + 0 * sizeof (st= ruct { _Static_assert (!__builtin_types_compatible_p (__typeof (null), __ty= peof (&(null)[0])), "argument must be an array"); })) - 1; > + } > + else > + { > + string =3D (char *) L""; > + len =3D 0; > + } > + } > + else if (!is_long && spec !=3D 'S') > + { > + > + > + > + > + > + > + if (prec !=3D -1) > + > + > + len =3D __strnlen (string, prec); > + else > + len =3D strlen (string); > + > + } > + else > + { > + > + outstring_converted_wide_string (buf, (const wchar_t *) string, > + prec, width, left); > + > + break; > + > + } > + > + if ((width -=3D len) < 0) > + { > + __printf_buffer_write (buf, string, len); > + break; > + } > + > + if (!left) > + __printf_buffer_pad (buf, ' ', width); > + __printf_buffer_write (buf, string, len); > + if (left) > + __printf_buffer_pad (buf, ' ', width); > + } > + break; > + > +do_form_wcharacter: > + { > + > + char wcbuf[16]; > + mbstate_t mbstate; > + size_t len; > + > + memset (&mbstate, '\0', sizeof (mbstate_t)); > + len =3D __wcrtomb (wcbuf, __builtin_va_arg( ap , wchar_t) , &mbstate= ); > + if (len =3D=3D (size_t) -1) > + { > + > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + width -=3D len; > + if (!left) > + __printf_buffer_pad (buf, ' ', width); > + __printf_buffer_write (buf, wcbuf, len); > + if (left) > + __printf_buffer_pad (buf, ' ', width); > + } > + break; > + > +} > + > + > + do_form_float: > + do_form_floathex: > + { > + if (__builtin_expect (((mode_flags & 0x0001) !=3D 0), 0)) > + is_long_double =3D 0; > + > + struct printf_info info =3D > + { > + .prec =3D prec, > + .width =3D width, > + .spec =3D spec, > + .is_long_double =3D is_long_double, > + .is_short =3D is_short, > + .is_long =3D is_long, > + .alt =3D alt, > + .space =3D space, > + .left =3D left, > + .showsign =3D showsign, > + .group =3D group, > + .pad =3D pad, > + .extra =3D 0, > + .i18n =3D use_outdigits, > + .wide =3D sizeof (char) !=3D 1, > + .is_binary128 =3D 0 > + }; > + > + do { info.is_binary128 =3D 0; if (is_long_double) the_arg.pa_long_d= ouble =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + long double > + > + ) > + > + ; else the_arg.pa_double =3D > + > + __builtin_va_arg( > + > + ap > + > + , > + > + double > + > + ) > + > + ; } while (0);; > + const void *ptr =3D &the_arg; > + > + __printf_fp_spec (buf, &info, &ptr); > + } > + break; > + > + do_form_unknown: > + if (spec =3D=3D '\0') > + { > + > + (__libc_errno =3D ( 22)); > + __printf_buffer_mark_failed (buf); > + goto all_done; > + } > + > + > + > + goto do_positional; > + } > + > + > + ++nspecs_done; > + > + > + > + > + > + f =3D __find_specmb ((end_of_spec =3D ++f)); > + > + > + > + __printf_buffer_write (buf, (const char *) end_of_spec, > + f - end_of_spec); > + } > + while (*f !=3D '\0' && !__printf_buffer_has_failed (buf)); > + > + all_done: > + > + > + > + return; > + > + > +do_positional: > + printf_positional (buf, format, readonly_format, ap, &ap_save, > + nspecs_done, lead_str_end, work_buffer, > + save_errno, grouping, thousands_sep, mode_flags); > +} > + > +/* { dg-final { scan-assembler-times {vsetivli\tzero,\s*4,\s*e8,\s*mf4,\= s*t[au],\s*m[au]} 2 } } */ > -- > 2.36.3 >