This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

functions returning a struct


I found a problem in egcs 1.1b, but it isn't really a bug. It is a
binary incompatibility with the libraries compiled by gcc 2.7.2.3.


I have compiled egcs 1.1b.
I have a Linux Redhat 5.0 x86 system. I have compiled the last version
of binutils I found, then egcs 1.1b.
My problem appear when I transmit the -fomit-frame-pointer (Segmentation
violation), but it exist too without this option.



I will try to describe the problem (in my bad english).

When I call a function returning a struct (I discover the problem with
div   of libc), the call of egcs is not the same of the gcc 2.7.2.3 one. 

Both give (push) an address of a structure to fill, but gcc 2.7.2.3
consider that the function will not touch that, and after the function
call, he add   4 + the normal number    to esp,    and egcs 1.1b
consider that the function will make a     retl $4   to remove the
address of the structure to fill in the stack. So there isn't any
problems with the programs compiled only with egcs, but there are ones
with the call of libraries (libc compiled with gcc 2.7.2.3 for example).
This make a segmentation violation with -fomit-frame-pointer, and a not
visible error without this option.

I asked some informations in the newsgroup fr.comp.lang.c++, but some
people said that it will perhaps change with the final version and it
will be binary compatible, and that gcc 2.7.2.3 and egcs are "different"
compiler, so I can't have full binary compatibility with the libraries
issued from gcc 2.7.2.3.

Is it a known problem, and is there another solution that compile every
libraries with egcs ?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]