This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: finding strict aliasing problems
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Subject: Re: finding strict aliasing problems
- From: Andreas Schwab <schwab at suse dot de>
- Date: 02 May 2001 10:30:05 +0200
- Cc: gdr at codesoucery dot com (Gabriel Dos Reis),mrs at windriver dot com (Mike Stump), jakub at redhat dot com,jbuck at racerx dot synopsys dot com, feeley at iro dot umontreal dot ca, gcc at gcc dot gnu dot org
- References: <200105012255.RAA32049@zakon.math.purdue.edu>
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