This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gofrontend-dev] Go patch committed: Avoid warning by using a local var for std::ofstream


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]