This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gofrontend-dev] Go patch committed: Avoid warning by using a local var for std::ofstream
- From: John David Anglin <dave at hiauly3 dot hia dot nrc dot ca>
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Cc: Ian Lance Taylor <iant at golang dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "gofrontend-dev at googlegroups dot com" <gofrontend-dev at googlegroups dot com>
- Date: Wed, 21 Sep 2016 10:48:26 -0400
- Subject: Re: [gofrontend-dev] Go patch committed: Avoid warning by using a local var for std::ofstream
- Authentication-results: sourceware.org; auth=none
- References: <CAOyqgcW3Lu4CqTdKveMGO+2dakO8fPcXWziDqt=gs2usQpNV=Q@mail.gmail.com> <87lgympe22.fsf@mid.deneb.enyo.de>
On Tue, Sep 20, 2016 at 09:27:17PM +0200, Florian Weimer wrote:
> * Ian Lance Taylor:
>
> > GCC PR 77625 is about a warning while compiling the Go frontend. The
> > Go frontend called `new std::ofstream()`, and the warning is "error:
> > `new' of type `std::ofstream {aka std::basic_ofstream<char>}' with
> > extended alignment 16". Frankly I'm not sure how this supposed to
> > work: shouldn't it be possible to write new std::ofstream()? But the
> > problem is easy to avoid, since in this case the std::ofstream can be
> > a local variable, and that is a better approach anyhow. This patch
> > was bootstrapped on x86_64-pc-linux-gnu. Committed to mainline.
>
> This happens only on hppa, right? It looks as if libstdc++ is
> seriously broken there.
I'm not sure I understand the comment. I created a short testcase.
I agree that the issue is hppa specific but the extended alignment
is coming from the __lock field in pthread_mutex_t. I'm not sure
why this affects new std::ofstream().
The alignment of 16 arises in code that used the ldcw instruction.
Although this could be avoided in glibc there are numerous other
packages with objects requiring 16-byte alignment. So, I'm tending
to think the typedef for max_align_t should be adjusted on hppa-linux
so that it has 16-byte alignment. Is that the correct approach?