public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/99995] New: [11 Regression] FAIL: 17_intro/headers/c++1998/49745.cc with -std=gnu++20
Date: Fri, 09 Apr 2021 13:25:19 +0000	[thread overview]
Message-ID: <bug-99995-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99995

            Bug ID: 99995
           Summary: [11 Regression] FAIL:
                    17_intro/headers/c++1998/49745.cc with -std=gnu++20
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

In C++20 mode <memory> includes <bits/atomic_wait.h> which includes <unistd.h>
for SYS_futex, and that means that POSIX truncate is declared, leading to:

In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/atomic_wait.h:44,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/atomic_base.h:41,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_atomic.h:33,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/memory:78,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/powerpc64le-unknown-linux-gnu/bits/stdc++.h:82,
                 from <command-line>:
/usr/include/unistd.h:1015: note: previous declaration 'int truncate(const
char*, __off_t)'
compiler exited with status 1
FAIL: 17_intro/headers/c++1998/49745.cc (test for excess errors)
Excess errors:
/home/jwakely/src/gcc/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc:22:
error: 'int truncate' redeclared as different kind of entity

This is only seen when adding -std=gnu++20 (or similar) to the test flags
explicitly, and only when PCH is enabled so that -include bits/stdc++.h is
added to the test flags, because otherwise that test doesn't include <memory>.
But the underlying problem is that including <unistd.h> means Bug 49745 has
returned: we include <unistd.h> from C++ library headers.

This is only an issue for C++20 mode, and will fix itself when the code to use
futexes moves into libstdc++.so rather than being in headers.

In the meantime, we might want to XFAIL that test for c++20 mode.

             reply	other threads:[~2021-04-09 13:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 13:25 redi at gcc dot gnu.org [this message]
2021-04-12  7:41 ` [Bug libstdc++/99995] " rguenth at gcc dot gnu.org
2021-04-12 10:35 ` cvs-commit at gcc dot gnu.org
2021-04-12 10:37 ` [Bug libstdc++/99995] [11 Regression] should not include <unistd.h> in c++20 mode redi at gcc dot gnu.org
2021-04-21 12:06 ` [Bug libstdc++/99995] [11/12 " redi at gcc dot gnu.org
2022-05-06  8:30 ` [Bug libstdc++/99995] [11/12/13 " jakub at gcc dot gnu.org
2023-05-08 12:21 ` [Bug libstdc++/99995] [11/12/13/14 " rguenth at gcc dot gnu.org

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=bug-99995-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).