[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-11-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
 Target|i?86-linux-gnu  |i?86-*
   Last reconfirmed||2020-11-01

--- Comment #6 from Jonathan Wakely  ---
This is also an issue on (at least) Solaris, Vxworks 7 and mingw.

See https://sourceforge.net/p/mingw-w64/bugs/778/ and
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973495 and Bug 77691 for
problems caused by GCC's incorrect definition of max_align_t.

[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-09-13 Thread officesamurai at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

--- Comment #5 from Mikhail Kremniov  ---
I see. So this is not considered a bug then?

P.S. it seems that -faligned-new=8 can be used as a workaround in this case,
even in pre-c++17 modes, so the issue doesn't look that bad in the end.

[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-09-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

--- Comment #4 from Jonathan Wakely  ---
The change to max_align_t was done in r240248 in 2016, glibc's malloc was
changed some time after.

[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-09-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

--- Comment #3 from Jonathan Wakely  ---
operator new just gets its memory from malloc.

GCC changed the alignment of max_align_t on x86 targets, but if you don't have
a newer malloc then it won't know about that change and so disagrees with GCC's
max_align_t definition.

[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-09-11 Thread officesamurai at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

--- Comment #2 from Mikhail Kremniov  ---
(In reply to Andrew Pinski from comment #1)
> malloc is not controlled by gcc.

Yeah, I shouldn't have mentioned malloc because there seems to be no
requirement for it to align the returned addresses by alignof(max_align_t).
But new-expression should still return properly aligned objects, shouldn't it?
So it looks like this issue is C++-specific after all.

[Bug target/97025] In -m32 mode the alignment of pointers returned by malloc or operator new is less than alignof(std::max_align_t)

2020-09-11 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97025

--- Comment #1 from Andrew Pinski  ---
malloc is not controlled by gcc.