public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Hans-Peter Nilsson <hp@axis.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: Avoid use of naked int32_t in unseq_backend_simd.h, PR108672
Date: Sat, 4 Feb 2023 09:27:25 +0000	[thread overview]
Message-ID: <CAH6eHdT1vvJ5vmQ2PAmPR_V0GtyOb-eL6M=ro-7kuHh6M1rqLw@mail.gmail.com> (raw)
In-Reply-To: <20230204031940.A747420426@pchp3.se.axis.com>

[-- Attachment #1: Type: text/plain, Size: 1999 bytes --]

On Sat, 4 Feb 2023, 03:20 Hans-Peter Nilsson via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> Tested cris-elf and native x86_64-pc-linux-gnu.
> Ok to commit?
>

Yes, we already do this with other stdint.h types when we don't want to
include stdint.h if we don't *really* need all of it.

OK, thanks.



> ---- 8< ----
> The use of a "naked" int32_t (i.e. without a fitting #include:
> stdint.h or cstdint or inttypes.h or an equivalent internal header),
> in libstdc++-v3/include/pstl/unseq_backend_simd.h, caused an error for
> cris-elf and apparently pru-elf and I guess all "newlib targets".
> (Unfortunately, there's a lack of other *-elf targets in recent months
> of gcc-testresults archives.)
>
> This does not manifest on e.g. native x86_64-pc-linux-gnu, because
> there, a definition is included as an effect of including stdlib.h in
> cstdlib (following the trace in native xtreme-header-2_a.ii with
> glibc-2.31-13+deb11u5).  Maybe better than chasing the right #includes
> is to directly use the built-in type, like so:
>
> libstdc++-v3:
>
>         PR libstdc++/108672
>         * include/pstl/unseq_backend_simd.h (__simd_or): Use __INT32_TYPE__
>         instead of int32_t.
> ---
>  libstdc++-v3/include/pstl/unseq_backend_simd.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/pstl/unseq_backend_simd.h
> b/libstdc++-v3/include/pstl/unseq_backend_simd.h
> index a05de39f7576..f6265f5c16e5 100644
> --- a/libstdc++-v3/include/pstl/unseq_backend_simd.h
> +++ b/libstdc++-v3/include/pstl/unseq_backend_simd.h
> @@ -74,7 +74,7 @@ __simd_or(_Index __first, _DifferenceType __n, _Pred
> __pred) noexcept
>      const _Index __last = __first + __n;
>      while (__last != __first)
>      {
> -        int32_t __flag = 1;
> +        __INT32_TYPE__ __flag = 1;
>          _PSTL_PRAGMA_SIMD_REDUCTION(& : __flag)
>          for (_DifferenceType __i = 0; __i < __block_size; ++__i)
>              if (__pred(*(__first + __i)))
> --
> 2.30.2
>
>

      reply	other threads:[~2023-02-04  9:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04  3:19 Hans-Peter Nilsson
2023-02-04  9:27 ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdT1vvJ5vmQ2PAmPR_V0GtyOb-eL6M=ro-7kuHh6M1rqLw@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@axis.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).