document inconsistant?
Min Xu
mxu@cae.wisc.edu
Thu Apr 13 22:39:00 GMT 2000
peeterj@ca.ibm.com wrote:
> Hi Min,
>
> Bus error on Sun (HP, SGI, ...) typically indicates an unaligned variable
> access (at least in the instances where I have seen this problem). A
> comparison was done for you on AIX, but if the bus error was alignment
> related you won't hit it on AIX as AIX will handle alignment without
> raising an exception (it is still slower). In the debugger see if the
> address of one of the double variables in the trapping comparison isn't a
> multiple of 8 (== sizeof(double), the required double alignment).
>
> The interesting thing here is that you don't have any dynamically allocated
> memory that I can see (nothing where you could potentially mess up the data
> alignment), so if the double is unaligned it is possibly compiler related.
> However, I notice one glaring cause of potential trouble -- you are
> compiling and linking C++ code with the c front end instead of using the
> C++ compiler (g++). You should never have to do stuff like -lstdc++. I
> suspect that if you compile this properly your problem will go away.
>
> Peeter
Hi Peeter,
I am very glad to hear your insight opinion on this problem. Now I
have a more clear picture about bus error problem. I think you pointed
out a good point on my bad habbit, ;-). Previous I just feel using g++
is strange because of "++" should not be normal file name.
Unfortunately, our system admin already recompile the gcc without
default options for UltraSPARC, so I can't verify if this problem can
go away if I use g++ to compile my program. However, from now on,
I will always use g++ to compile my c++ code, instead of gcc.
Regards,
Min
More information about the Gcc
mailing list