From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,28e4c7badb3be46f,start X-Google-Attributes: gidf678f,public From: raines@jupiter.slac.stanford.edu (Paul E. Raines) Subject: problems with flag -xtaso_short to cc Date: 1996/02/29 Message-ID: #1/1 X-Deja-AN: 141565501 sender: raines@jupiter.SLAC.Stanford.EDU organization: Stanford Linear Accelerator Center newsgroups: comp.unix.osf.misc To port some code from AIX, we wish to use 32-bit pointers. The C compiler appears to provide the -xtaso_short flag for this. We have found several problems with it. One is that it does not seem to be consistant. Here is the output of a simple program to print the size of objects. Note that witht he -xtaso_short flag, sizeof(int*) is 4 while sizeof(&i) where i is an integer is still 8. ================================================================= $ cc -g -taso -xtaso_short ptest.c -o ptest $ ./ptest Sizeof(int) = 4 Sizeof(int*) = 4 Sizeof(long) = 8 Sizeof(long*) = 4 Sizeof(i) = 4 Sizeof(&i) = 8 Sizeof(l) = 8 Sizeof(&l) = 8 $ cc -g ptest.c -o ptest $ ./ptest Sizeof(int) = 4 Sizeof(int*) = 8 Sizeof(long) = 8 Sizeof(long*) = 8 Sizeof(i) = 4 Sizeof(&i) = 8 Sizeof(l) = 8 Sizeof(&l) = 8 $ cat ptest.c #include #include #include int main(int argc, char **argv) { int i; long l; printf("Sizeof(int) = %d\n", sizeof(int)); printf("Sizeof(int*) = %d\n", sizeof(int*)); printf("Sizeof(long) = %d\n", sizeof(long)); printf("Sizeof(long*) = %d\n", sizeof(long*)); printf("Sizeof(i) = %d\n", sizeof(i)); printf("Sizeof(&i) = %d\n", sizeof(&i)); printf("Sizeof(l) = %d\n", sizeof(l)); printf("Sizeof(&l) = %d\n", sizeof(&l)); exit(0); } ================================================================= The other problems is that the argv argument to main is still 64 bytes and if you pass argv to another function as (char **) and try to access it with string functions, it core dumps. The simple work around here was to copy the entire argv contents in main to a local (char **) variable using repeated mallocs. A similar problem to this is that many functions core-dump in 32-mode. One of these is tolower. The following code coredumps. ================================================================= $ cat xtest.c #include #include #include #include void cUtToUpper(const char* is,char* os){ int i, l=strlen(is); for(i=0; i