tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Tinycc-devel] jmp_buf align problem on win64


From: Christian Jullien
Subject: RE: [Tinycc-devel] jmp_buf align problem on win64
Date: Thu, 3 Dec 2009 14:43:07 +0100

Thanks grischka, 

I try understanding why this declaration is not honored.
I've no clue.

I've only seen in x64_64-gen.c that

/* maximum alignment (for aligned attribute support) */
#define MAX_ALIGN     8

Should probably be changed to 16 but it does not solve the problem since
MAX_ALIGN seems to be use in a non relevant part of the code.

I give up.

This bug is really annoying for portability even it is easy for me to fix it
in my own code.

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
grischka
Sent: mercredi 2 décembre 2009 23:17
To: address@hidden
Subject: Re: [Tinycc-devel] jmp_buf align problem on win64


Christian Jullien wrote:
> Hi all,
> 
> Today I managed to try tcc on win64 (i.e. tcc generates 64bit .exe)
> I bootstrapped tcc with a recent gcc win64 and got a workable tcc that
> compiles my OpenLisp quietly (www.eligis.com). It eventually runs but
> crashes depending on jmp_buf stack alignment. Very often, I found that
> 64bits processors require that jmp_buf are aligned to 16 bytes boundary.
> 
> I checked with typedef _CRT_ALIGN(16) struct _JUMP_BUFFER with no success.

Yes, I remember that it was/is a problem when compiling tcc
with itself, too (there is a jmp_buf in TCCState).

Actually there is _CRT_ALIGN(16) for __x86_64 in include/setjmp.h,
but for some reason tcc has problems to remember it.

IIRC it works when used in combination with the variable directly,
such as:
     _CRT_ALIGN(16) jmp_buf buf;
or (translating the macro):
     __attribute__((aligned(16))) jmp_buf buf;

--- grischka

> 
> - Works:
> 
> #include <setjmp.h>
> 
> int
> main()
> {
>       jmp_buf buf;
>       setjmp( buf );
>       printf("%x\n", _JBLEN);
> }
> 
> - Fails:
> #include <setjmp.h>
> 
> int
> main()
> {
>       char *p; // add 8 bytes
>       jmp_buf buf;
>       setjmp( buf );
>       printf("%x\n", _JBLEN);
> }
> 
> - Works
> #include <setjmp.h>
> 
> int
> main()
> {
>       char *p;  // add 8 bytes
>       char *p1; // add 8+8 = 16 bytes
>       jmp_buf buf;
>       setjmp( buf );
>       printf("%x\n", _JBLEN);
> }
> 



_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel
----------------------------------------------------------------------------
-----------
Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
Aucun virus connu a ce jour par nos services n'a ete detecte.










reply via email to

[Prev in Thread] Current Thread [Next in Thread]