This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/77330] __float128 segfaults on 32-bit x86 due to 8-byte malloc alignment
- From: "mikulas at artax dot karlin.mff.cuni.cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 23 Aug 2016 13:24:25 +0000
- Subject: [Bug target/77330] __float128 segfaults on 32-bit x86 due to 8-byte malloc alignment
- Auto-submitted: auto-generated
- References: <bug-77330-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77330
--- Comment #3 from mikulas at artax dot karlin.mff.cuni.cz ---
BTW. gcc thinks that with -m32, allocated memory is aligned to 4 bytes and with
-m64 and -mx32, allocated memory is aligned to 16 bytes. You can try to compile
this program into assembler and see if the malloc call is optimized away. On
-m32, it gets optimized away with the constant "3" and it won't get optimized
away with "7" or more.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
void *p = malloc(123);
printf("%d\n", (int)p & 3);
return 0;
}