finding strict aliasing problems

Andreas Schwab schwab@suse.de
Wed May 2 04:37:00 GMT 2001


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



More information about the Gcc mailing list