This is the mail archive of the gcc-bugs@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]

[Bug target/77330] __float128 segfaults on 32-bit x86 due to 8-byte malloc alignment


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;
}

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