From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id B467D3858D1E for ; Mon, 15 Aug 2022 16:42:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B467D3858D1E Received: by mail-lj1-x236.google.com with SMTP id v10so8141354ljh.9 for ; Mon, 15 Aug 2022 09:42:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=hzL7SaDGZlSf8jTfBLEUyEGEbYtCRccpE3kbYkOPMps=; b=Bn8zj2O+3yPhVOaShlkVBMd0Do1EwFDlQvjX2YjZcYjzt56FBg5ryD9ST25O6aq+BH N8ponmkdIMk6evHUNfxICxjJpvPNxi2IlivhklWHHj3UQkqdY+t6yb0eH28MDS8kQ1qs Fiva12jCy8z39MaeynfNy+hcYKITuXpaCB94vSx8Dmnzrkb+RyJjYhnG/e9aD5MNxfrF OxVplaQiNAlPEWdSC86i73WCMiqv4ZPYZOLHhzrXP146i1/ugW4PsG2YIsMrx6r+qp8K JD3kmq9ZtbYyjakI5lPJq2U7jW4xRL4v+DejeYSuPLln7AyinoFNJxti5zXuuMo3pJzx FZ0A== X-Gm-Message-State: ACgBeo3ISQmTNT7p94yRL6qwrsyO+TFED19bqBOZMvBEq3DsxPwW6sTw BJJqFE6of1MbBSJWRurjVe+feJ1XcD0teuQ2obTvqw== X-Google-Smtp-Source: AA6agR45cusFCqb6/wjDLc5jXNA9rKcfi/nNrMLfvPAvHW/d8oljx6lEoCNYunwVA3PCpKLrakdylDFNJQG5+fB8kec= X-Received: by 2002:a2e:92c8:0:b0:25d:6ddf:e71d with SMTP id k8-20020a2e92c8000000b0025d6ddfe71dmr4978823ljh.170.1660581771095; Mon, 15 Aug 2022 09:42:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Frolov Daniil Date: Mon, 15 Aug 2022 19:42:39 +0300 Message-ID: Subject: Re: -Wformat-overflow handling for %b and %B directives in C2X standard To: Marek Polacek Cc: gcc-patches@gcc.gnu.org Content-Type: multipart/mixed; boundary="0000000000009673d705e64a5263" X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2022 16:42:59 -0000 --0000000000009673d705e64a5263 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=B2=D1=82, 12 =D0=B0=D0=BF=D1=80. 2022 =D0=B3. =D0=B2 00:56, Marek Polac= ek : > > On Thu, Apr 07, 2022 at 02:10:48AM +0500, Frolov Daniil wrote: > > Hello! Thanks for your feedback. I've tried to take into account your > > comments. New patch applied to the letter. > > Thanks. > > > The only thing I have not removed is the check_std_c2x () function. Fro= m my > > point of view -Wformat-overflow shouldn't be thrown if the standard < C= 2X. > > So it's protection for false triggering. > > Sorry but I still think that is the wrong behavior. If you want to warn > about C2X constructs in pre-C2X modes, use -Wpedantic. But if you want > to use %b/%B as an extension in older dialects, that's OK too, so I don't > know why users would want -Wformat-overflow disabled in that case. But > perhaps other people disagree with me. > Hi! Sorry for the late reply. If we want to look at it as on extension then I am agreed with you. Removed this function in new patch. > > =D1=81=D0=B1, 2 =D0=B0=D0=BF=D1=80. 2022 =D0=B3. =D0=B2 01:15, Marek Po= lacek : > > > > > On Sat, Apr 02, 2022 at 12:19:47AM +0500, Frolov Daniil via Gcc-patch= es > > > wrote: > > > > Hello, I've noticed that -Wformat-overflow doesn't handle %b and %B > > > > directives in the sprintf function. I've added a relevant issue in > > > bugzilla > > > > (bug #105129). > > > > I attach a patch with a possible solution to the letter. > > > > > > Thanks for the patch. Support for C2X %b, %B formats is relatively n= ew > > > (Oct 2021) so it looks like gimple-ssa-sprintf.cc hasn't caught up. > > > > > > This is not a regression, so should probably wait till GCC 13. Anywa= y... > > > > > > > From 2051344e9500651f6e94c44cbc7820715382b957 Mon Sep 17 00:00:00 2= 001 > > > > From: Frolov Daniil > > > > Date: Fri, 1 Apr 2022 00:47:03 +0500 > > > > Subject: [PATCH] Support %b, %B for -Wformat-overflow (sprintf, snp= rintf) > > > > > > > > testsuite: add tests to check -Wformat-overflow on %b. > > > > Wformat-overflow1.c is compiled using -std=3Dc2x so warning has to > > > > be throwed > > > > > > > > Wformat-overflow2.c doesn't throw warnings cause c2x std isn't > > > > used > > > > > > > > gcc/ChangeLog: > > > > > > > > * gimple-ssa-sprintf.cc > > > > (check_std_c2x): New function > > > > (fmtresult::type_max_digits): add base =3D=3D 2 handling > > > > (tree_digits): add handle for base =3D=3D 2 > > > > (format_integer): now handle %b and %B using base =3D 2 > > > > (parse_directive): add cases to handle %b and %B directives > > > > (compute_format_length): add handling for base =3D 2 > > > > > > The descriptions should start with a capital letter and end with a pe= riod, > > > like "Handle base =3D=3D 2." > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > * gcc.dg/Wformat-overflow1.c: New test. (using -std=3Dc2x) > > > > * gcc.dg/Wformat-overflow2.c: New test. (-std=3Dc11 no warnin= g) > > > > > > You can just say "New test." > > > > > > > --- > > > > gcc/gimple-ssa-sprintf.cc | 42 ++++++++++++++++++++= ---- > > > > gcc/testsuite/gcc.dg/Wformat-overflow1.c | 28 ++++++++++++++++ > > > > gcc/testsuite/gcc.dg/Wformat-overflow2.c | 16 +++++++++ > > > > 3 files changed, 79 insertions(+), 7 deletions(-) > > > > create mode 100644 gcc/testsuite/gcc.dg/Wformat-overflow1.c > > > > create mode 100644 gcc/testsuite/gcc.dg/Wformat-overflow2.c > > > > > > > > diff --git a/gcc/gimple-ssa-sprintf.cc b/gcc/gimple-ssa-sprintf.cc > > > > index c93f12f90b5..7f68c2b6e51 100644 > > > > --- a/gcc/gimple-ssa-sprintf.cc > > > > +++ b/gcc/gimple-ssa-sprintf.cc > > > > @@ -107,6 +107,15 @@ namespace { > > > > > > > > static int warn_level; > > > > > > > > +/* b_overflow_flag depends on the current standart when using gcc = */ > > > > > > "standard" > > > > > > /* Comments should be formatted like this. */ > > > > > > > +static bool b_overflow_flag; > > > > + > > > > +/* check is current standart version equals C2X*/ > > > > +static bool check_std_c2x () > > > > +{ > > > > + return !strcmp (lang_hooks.name, "GNU C2X"); > > > > +} > > > > > > Is this really needed? ISTM that this new checking shouldn't depend = on > > > -std=3Dc2x. If not using C2X, you only get a warning if -Wpedantic. = So > > > I think you should remove b_overflow_flag. > > > > > > > /* The minimum, maximum, likely, and unlikely maximum number of by= tes > > > > of output either a formatting function or an individual directi= ve > > > > can result in. */ > > > > @@ -535,6 +544,8 @@ fmtresult::type_max_digits (tree type, int base= ) > > > > unsigned prec =3D TYPE_PRECISION (type); > > > > switch (base) > > > > { > > > > + case 2: > > > > + return prec; > > > > case 8: > > > > return (prec + 2) / 3; > > > > case 10: > > > > @@ -857,11 +868,11 @@ tree_digits (tree x, int base, HOST_WIDE_INT = prec, > > > bool plus, bool prefix) > > > > > > > > /* Adjust a non-zero value for the base prefix, either hexadecim= al, > > > > or, unless precision has resulted in a leading zero, also oct= al. > > > */ > > > > - if (prefix && absval && (base =3D=3D 16 || prec <=3D ndigs)) > > > > + if (prefix && absval && (base =3D=3D 2 || base =3D=3D 16 || prec= <=3D ndigs)) > > > > { > > > > if (base =3D=3D 8) > > > > res +=3D 1; > > > > - else if (base =3D=3D 16) > > > > + else if (base =3D=3D 16 || base =3D=3D 2) /*0x...(0X...) and > > > 0b...(0B...)*/ > > > > res +=3D 2; > > > > } > > > > > > > > @@ -1229,6 +1240,10 @@ format_integer (const directive &dir, tree a= rg, > > > pointer_query &ptr_qry) > > > > case 'u': > > > > base =3D 10; > > > > break; > > > > + case 'b': > > > > + case 'B': > > > > + base =3D 2; > > > > + break; > > > > case 'o': > > > > base =3D 8; > > > > break; > > > > @@ -1351,10 +1366,10 @@ format_integer (const directive &dir, tree = arg, > > > pointer_query &ptr_qry) > > > > > > > > /* Bump up the counters if WIDTH is greater than LEN. */ > > > > res.adjust_for_width_or_precision (dir.width, dirtype, base, > > > > - (sign | maybebase) + (base = =3D=3D > > > 16)); > > > > + (sign | maybebase) + (base = =3D=3D 2 > > > || base =3D=3D 16)); > > > > /* Bump up the counters again if PRECision is greater still.= */ > > > > res.adjust_for_width_or_precision (dir.prec, dirtype, base, > > > > - (sign | maybebase) + (base = =3D=3D > > > 16)); > > > > + (sign | maybebase) + (base = =3D=3D 2 > > > || base =3D=3D 16)); > > > > > > > > return res; > > > > } > > > > @@ -1503,7 +1518,7 @@ format_integer (const directive &dir, tree ar= g, > > > pointer_query &ptr_qry) > > > > if (res.range.min =3D=3D 1) > > > > res.range.likely +=3D base =3D=3D 8 ? 1 : 2; > > > > else if (res.range.min =3D=3D 2 > > > > - && base =3D=3D 16 > > > > + && (base =3D=3D 16 || base =3D=3D 2) > > > > && (dir.width[0] =3D=3D 2 || dir.prec[0] =3D=3D 2)= ) > > > > ++res.range.likely; > > > > } > > > > @@ -1511,9 +1526,9 @@ format_integer (const directive &dir, tree ar= g, > > > pointer_query &ptr_qry) > > > > > > > > res.range.unlikely =3D res.range.max; > > > > res.adjust_for_width_or_precision (dir.width, dirtype, base, > > > > - (sign | maybebase) + (base =3D= =3D 16)); > > > > + (sign | maybebase) + (base =3D= =3D 2 || > > > base =3D=3D 16)); > > > > res.adjust_for_width_or_precision (dir.prec, dirtype, base, > > > > - (sign | maybebase) + (base =3D= =3D 16)); > > > > + (sign | maybebase) + (base =3D= =3D 2 || > > > base =3D=3D 16)); > > > > > > > > return res; > > > > } > > > > @@ -3680,6 +3695,8 @@ parse_directive (call_info &info, > > > > ++pf; > > > > break; > > > > } > > > > + > > > > + > > > > > > Drop this spurious change. > > > > > > > switch (target_to_host (*pf)) > > > > { > > > > @@ -3713,6 +3730,14 @@ parse_directive (call_info &info, > > > > case 'X': > > > > dir.fmtfunc =3D format_integer; > > > > break; > > > > + > > > > + case 'b': > > > > + case 'B': > > > > + if (b_overflow_flag) { > > > > + dir.fmtfunc =3D format_integer; > > > > + break; > > > > + } > > > > + return 0; > > > > > > > > case 'p': > > > > /* The %p output is implementation-defined. It's possible > > > > @@ -4038,6 +4063,9 @@ compute_format_length (call_info &info, > > > format_result *res, > > > > > > > > bool success =3D true; > > > > > > > > + /* Check for GNU C2X standart */ > > > > + b_overflow_flag =3D check_std_c2x (); > > > > + > > > > for (const char *pf =3D info.fmtstr; ; ++dirno) > > > > { > > > > directive dir (&info, dirno); > > > > diff --git a/gcc/testsuite/gcc.dg/Wformat-overflow1.c > > > b/gcc/testsuite/gcc.dg/Wformat-overflow1.c > > > > new file mode 100644 > > > > index 00000000000..cf9766fae14 > > > > --- /dev/null > > > > +++ b/gcc/testsuite/gcc.dg/Wformat-overflow1.c > > > > @@ -0,0 +1,28 @@ > > > > +/* > > > > + { dg-do compile } > > > > + { dg-options "-Wformat-overflow -std=3Dc2x" } > > > > +*/ > > > > + > > > > +extern int sprintf (char* restrict, const char* restrict, ...); > > > > + > > > > +void test_warn () { > > > > + > > > > + int n =3D __INT_MAX__; > > > > + char dst [5] =3D {0}; > > > > + sprintf (dst, "%b", n); /* { dg-warning "-Wformat-overflow" }= */ > > > > + > > > > + sprintf (dst, "%#b", n); /* { dg-warning "-Wformat-overflow" }= */ > > > > + > > > > +} > > > > + > > > > +void test_no_warn () { > > > > + > > > > + char dst [5] =3D {0}; > > > > + int n =3D 8; > > > > + sprintf (dst, "%b", n); > > > > + > > > > + char another_dst [34] =3D {0}; > > > > + n =3D __INT_MAX__; > > > > + sprintf (another_dst, "%#b", n); > > > > + > > > > +} > > > > diff --git a/gcc/testsuite/gcc.dg/Wformat-overflow2.c > > > b/gcc/testsuite/gcc.dg/Wformat-overflow2.c > > > > new file mode 100644 > > > > index 00000000000..c6b1d9062a6 > > > > --- /dev/null > > > > +++ b/gcc/testsuite/gcc.dg/Wformat-overflow2.c > > > > @@ -0,0 +1,16 @@ > > > > +/* > > > > + { dg-do compile } > > > > + { dg-options "-Wformat-overflow -std=3Dc11" } > > > > +*/ > > > > + > > > > +extern int sprintf (char* restrict, const char* restrict, ...); > > > > + > > > > +void test_no_warn () { > > > > + > > > > + /*There is no reason to throw warning if std < c2x*/ > > > > + > > > > + char dst [5] =3D {0}; > > > > + int n =3D 32; > > > > + sprintf (dst, "%b", n); > > > > + > > > > +} > > > > -- > > > > 2.25.1 > > > > > > > > > > > > > Marek > > > > > > > > > From 7b14a2aa909194841fa916f2db5d8aa1e4a6367e Mon Sep 17 00:00:00 2001 > > From: Frolov Daniil > > Date: Thu, 7 Apr 2022 02:05:58 +0500 > > Subject: [PATCH] Support %b, %B for -Wformat-overflow (sprintf, snprint= f) > > > > gcc/ChangeLog: > > > > * gimple-ssa-sprintf.cc (check_std_c2x): Handle base =3D=3D 2. > > (fmtresult::type_max_digits): Handle base =3D=3D 2. > > (tree_digits): Handle base =3D=3D 2. > > (format_integer): Handle base =3D=3D 2. > > (parse_directive): Add cases for %b and %B directives. > > (compute_format_length): Handle base =3D=3D 2. > > > > gcc/testsuite/ChangeLog: > > > > * gcc.dg/Wformat-overflow1.c: New test. > > * gcc.dg/Wformat-overflow2.c: New test. > > --- > > gcc/gimple-ssa-sprintf.cc | 40 +++++++++++++++++++----- > > gcc/testsuite/gcc.dg/Wformat-overflow1.c | 28 +++++++++++++++++ > > gcc/testsuite/gcc.dg/Wformat-overflow2.c | 16 ++++++++++ > > 3 files changed, 77 insertions(+), 7 deletions(-) > > create mode 100644 gcc/testsuite/gcc.dg/Wformat-overflow1.c > > create mode 100644 gcc/testsuite/gcc.dg/Wformat-overflow2.c > > > > diff --git a/gcc/gimple-ssa-sprintf.cc b/gcc/gimple-ssa-sprintf.cc > > index c93f12f90b5..6a14a004483 100644 > > --- a/gcc/gimple-ssa-sprintf.cc > > +++ b/gcc/gimple-ssa-sprintf.cc > > @@ -107,6 +107,15 @@ namespace { > > > > static int warn_level; > > > > +/* The b_overflow_flag depends on the current standard when using gcc.= */ > > +static bool b_overflow_flag; > > + > > +/* Check is current standard version equals C2X. */ > > +static bool check_std_c2x () > > +{ > > + return !strcmp (lang_hooks.name, "GNU C2X"); > > +} > > + > > /* The minimum, maximum, likely, and unlikely maximum number of bytes > > of output either a formatting function or an individual directive > > can result in. */ > > @@ -535,6 +544,8 @@ fmtresult::type_max_digits (tree type, int base) > > unsigned prec =3D TYPE_PRECISION (type); > > switch (base) > > { > > + case 2: > > + return prec; > > case 8: > > return (prec + 2) / 3; > > case 10: > > @@ -857,11 +868,11 @@ tree_digits (tree x, int base, HOST_WIDE_INT prec= , bool plus, bool prefix) > > > > /* Adjust a non-zero value for the base prefix, either hexadecimal, > > or, unless precision has resulted in a leading zero, also octal. = */ > > - if (prefix && absval && (base =3D=3D 16 || prec <=3D ndigs)) > > + if (prefix && absval && (base =3D=3D 2 || base =3D=3D 16 || prec <= =3D ndigs)) > > { > > if (base =3D=3D 8) > > res +=3D 1; > > - else if (base =3D=3D 16) > > + else if (base =3D=3D 16 || base =3D=3D 2) /* 0x...(0X...) and 0b= ...(0B...) */ > > res +=3D 2; > > } > > > > @@ -1229,6 +1240,10 @@ format_integer (const directive &dir, tree arg, = pointer_query &ptr_qry) > > case 'u': > > base =3D 10; > > break; > > + case 'b': > > + case 'B': > > + base =3D 2; > > + break; > > case 'o': > > base =3D 8; > > break; > > @@ -1351,10 +1366,10 @@ format_integer (const directive &dir, tree arg,= pointer_query &ptr_qry) > > > > /* Bump up the counters if WIDTH is greater than LEN. */ > > res.adjust_for_width_or_precision (dir.width, dirtype, base, > > - (sign | maybebase) + (base =3D= =3D 16)); > > + (sign | maybebase) + (base =3D= =3D 2 || base =3D=3D 16)); > > /* Bump up the counters again if PRECision is greater still. */ > > res.adjust_for_width_or_precision (dir.prec, dirtype, base, > > - (sign | maybebase) + (base =3D= =3D 16)); > > + (sign | maybebase) + (base =3D= =3D 2 || base =3D=3D 16)); > > > > return res; > > } > > @@ -1503,7 +1518,7 @@ format_integer (const directive &dir, tree arg, p= ointer_query &ptr_qry) > > if (res.range.min =3D=3D 1) > > res.range.likely +=3D base =3D=3D 8 ? 1 : 2; > > else if (res.range.min =3D=3D 2 > > - && base =3D=3D 16 > > + && (base =3D=3D 16 || base =3D=3D 2) > > && (dir.width[0] =3D=3D 2 || dir.prec[0] =3D=3D 2)) > > ++res.range.likely; > > } > > @@ -1511,9 +1526,9 @@ format_integer (const directive &dir, tree arg, p= ointer_query &ptr_qry) > > > > res.range.unlikely =3D res.range.max; > > res.adjust_for_width_or_precision (dir.width, dirtype, base, > > - (sign | maybebase) + (base =3D=3D 16= )); > > + (sign | maybebase) + (base =3D=3D 2 = || base =3D=3D 16)); > > res.adjust_for_width_or_precision (dir.prec, dirtype, base, > > - (sign | maybebase) + (base =3D=3D 16= )); > > + (sign | maybebase) + (base =3D=3D 2 = || base =3D=3D 16)); > > > > return res; > > } > > @@ -3713,6 +3728,14 @@ parse_directive (call_info &info, > > case 'X': > > dir.fmtfunc =3D format_integer; > > break; > > + > > + case 'b': > > + case 'B': > > + if (b_overflow_flag) { > > + dir.fmtfunc =3D format_integer; > > + break; > > + } > > + return 0; > > > > case 'p': > > /* The %p output is implementation-defined. It's possible > > @@ -4038,6 +4061,9 @@ compute_format_length (call_info &info, format_re= sult *res, > > > > bool success =3D true; > > > > + /* Check for GNU C2X standard */ > > + b_overflow_flag =3D check_std_c2x (); > > + > > for (const char *pf =3D info.fmtstr; ; ++dirno) > > { > > directive dir (&info, dirno); > > diff --git a/gcc/testsuite/gcc.dg/Wformat-overflow1.c b/gcc/testsuite/g= cc.dg/Wformat-overflow1.c > > new file mode 100644 > > index 00000000000..cf9766fae14 > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/Wformat-overflow1.c > > @@ -0,0 +1,28 @@ > > +/* > > + { dg-do compile } > > + { dg-options "-Wformat-overflow -std=3Dc2x" } > > +*/ > > + > > +extern int sprintf (char* restrict, const char* restrict, ...); > > + > > +void test_warn () { > > + > > + int n =3D __INT_MAX__; > > + char dst [5] =3D {0}; > > + sprintf (dst, "%b", n); /* { dg-warning "-Wformat-overflow" } */ > > + > > + sprintf (dst, "%#b", n); /* { dg-warning "-Wformat-overflow" } */ > > + > > +} > > + > > +void test_no_warn () { > > + > > + char dst [5] =3D {0}; > > + int n =3D 8; > > + sprintf (dst, "%b", n); > > + > > + char another_dst [34] =3D {0}; > > + n =3D __INT_MAX__; > > + sprintf (another_dst, "%#b", n); > > + > > +} > > diff --git a/gcc/testsuite/gcc.dg/Wformat-overflow2.c b/gcc/testsuite/g= cc.dg/Wformat-overflow2.c > > new file mode 100644 > > index 00000000000..c6b1d9062a6 > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/Wformat-overflow2.c > > @@ -0,0 +1,16 @@ > > +/* > > + { dg-do compile } > > + { dg-options "-Wformat-overflow -std=3Dc11" } > > +*/ > > + > > +extern int sprintf (char* restrict, const char* restrict, ...); > > + > > +void test_no_warn () { > > + > > + /*There is no reason to throw warning if std < c2x*/ > > + > > + char dst [5] =3D {0}; > > + int n =3D 32; > > + sprintf (dst, "%b", n); > > + > > +} > > -- > > 2.25.1 > > > > > Marek > Thanks --0000000000009673d705e64a5263 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Support-b-B-for-Wformat-overflow-sprintf-snprintf.patch" Content-Disposition: attachment; filename="0001-Support-b-B-for-Wformat-overflow-sprintf-snprintf.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l6uzgb780 RnJvbSA0NjJhYTI0MmEwM2YwM2I5Mzk0NjUxZTA2ZTU1MD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