Re: Question about setjmp on Itanium HPUX.
From: Keith Thompson (kst-u_at_mib.org)
Date: 11/19/04
- Next message: Keith Thompson: "Re: Typedef with GCC/G++"
- Previous message: dati_remo_at_libero.it: "Tool for buffer overflow prevention"
- In reply to: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Next in thread: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Reply: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Nov 2004 08:38:34 GMT
dhandly@convex.hp.com (Dennis Handly) writes:
> Keith Thompson (kst-u@mib.org) wrote:
> : Then the implementation needs to define jmp_buf so that any declared
> : object of that type will be aligned properly, even if it's a member of
> : a struct. It's free to use compiler magic if necessary (such as an
> : alignment #pragma).
>
> Unfortunately there is no such magic. pack overrides. :-(
I'm not sure what you mean by "pack", but I'm guessing you're
referring to an implementation-defined #pragma that causes struct
members to be packed more tightly than they normally would be. For
example, given something like
struct foo { char c; double d; };
#pragma pack struct foo /* or whatever the syntax is */
struct foo obj;
I would expect the compiler to do whatever it needs to to make obj.d
accessible as a double. If obj.d is byte-aligned because of the
pragma, but the hardware requires stricter alignment, the compiler
probably needs to do something like the equivalent of a memcpy() to a
properly aligned chunk of memory to access the value. Perhaps it
handles this except in the special case of type jmp_buf, which
apparently requires 16-byte alignment.
But as it turns out this doesn't necessarily mean the compiler is
broken. C99 6.10.6p1 says:
A preprocessing directive of the form
# pragma pp-tokensopt new-line
where the preprocessing token STDC does not immediately follow
pragma in the directive (prior to any macro replacement) causes
the implementation to behave in an implementation-defined
manner. The behavior might cause translation to fail or cause the
translator or the resulting program to behave in a non-conforming
manner. Any such pragma that is not recognized by the
implementation is ignored.
If that's not what you meant by "pack", please clarify.
-- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.
- Next message: Keith Thompson: "Re: Typedef with GCC/G++"
- Previous message: dati_remo_at_libero.it: "Tool for buffer overflow prevention"
- In reply to: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Next in thread: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Reply: Dennis Handly: "Re: Question about setjmp on Itanium HPUX."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|