Article View: gnu.gcc.help
Article #235Incompatibility in passing structures and unions to SunOS system calls
From: Jim Sim
Date: Wed, 12 Aug 1992 18:48
Date: Wed, 12 Aug 1992 18:48
22 lines
1655 bytes
1655 bytes
When I call semctl, which receives a union as one of its arguments, from a program compiled with the SunOS cc compiler, my program works. When I compile the same program with gcc, the program aborts. Similarly, when I call lwp_yield, which receives a structure as its argument, from a program compiled with the SunOS cc compiler, my program works. When I compile the same program with gcc, the program aborts. If I modify either program to pass the address of the union or structure and compile with gcc, the program works. I did this because I was once told that the SunOS cc compiler passes structures and unions by address. Is there a gcc compiler option that will pass unions and structures in a manner that is compatible with the SunOS cc compiler? Can anyone explain the differences in how the SunOS cc compiler and the gcc compiler pass unions and structures? If there is not a compiler option to make union/structure passing compatible, what is the best way to write the code so that it will work with either compiler when making calls to system services that receive unions or structures?
Technical Details
Message-ID:
<SIM.92Aug12124839@mdtf14.fnal.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!newsaintmailShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!newsaintmail From: sim@mdtf14.fnal.gov (Jim Sim) Subject: Incompatibility in passing structures and unions to SunOS system calls Message-ID: <SIM.92Aug12124839@mdtf14.fnal.gov> Sender: daemon@linac.fnal.gov (The Background Man) Nntp-Posting-Host: mdtf14.fnal.gov Organization: Fermilab, Batavia, IL Distribution: usa Date: Wed, 12 Aug 1992 18:48:39 GMT Lines: 24