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

Re: finding strict aliasing problems


Brad Lucier <lucier@math.purdue.edu> writes:

|> int
|> main()
|> {
|>   long int x = (long int) malloc (sizeof(int)+sizeof(double));

This does not work.  long is not required to be able to hold all
significant bits of a pointer.  Use void * instead, or if you absolutely
want to use an integer type, use [u]intptr_t.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


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