vanam srihari kumar wrote:
I am using gpc 2.1 version on sun solaris 2.8 .
I have problem with the accesing structures containing real variables.
I observed following things
- I checked size of structures containing real
varibles using sizeof function,I found out that memory allocated is always in multiples of 8,If I use -fpack-struct option it is allocating correctly but I am unable to access the address of my struct variable as it is packed?
Try --maximum-field-algnment=8 instead of --pack-struct. Note that this may slowdown your program (just as --pack-struct does), so you can use instead
{$local maximum-field-alignment=8} type mystruc = ...; {$endlocal}
only when needed.
- I am always getting 'signal SIGSEGV, Segmentation
fault' error while accessing real variables of my structures.I am suspecting some problem with memory allocation of structures containing real variables.One Interesting thing is, it is not happening with all structures containg real variables but only few.There is no problem with stack overflow.
A configuration problem in the compiler back-end ? Something else ? What is in your opinion the "correct" size of a real and why must it be that size ? Does the segmentation fault occur when interfacing with other software, e.g. linked-in libraries or system routines ? Can you reproduce the problem with a testprogram ? What about running the gpc testsuite ?
"Porting UNIX Applications to the Solaris Operating Environment" http://developers.sun.com/solaris/articles/portingUNIXapps.html mentions the use of the -misalign and -misalign2 options, but I don't know if it is related.
Regards,
Adriaan van Os