🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6190

struct copy in hpux with gcc 2.7.2

#6190
From: Jarkko Sonninen
Date: Mon, 08 Jan 1996 00:00
48 lines
2396 bytes
Following program gives bus error in hp 9000/735 A.09.05 using 
gcc 2.7.2. Same code works if I use -fpcc-struct-return flag or gcc 2.4.5.
I guess it has something to do with aligning and copying structures.

	- Jarkko Sonninen

---

struct A {
    char c[5];
};

struct B {
    struct A a1, a2;
};

struct A koe (void) {
    struct A a;
    return a;
}

main () {
    struct B b;
    struct A *p = &b.a2;
    *p = koe (); /* this line causes bus error */
}

---

<boa:95:~/c> gcc -v gcc-hp.c  
Reading specs from /net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2/specs
gcc version 2.7.2
 /net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D_HPUX_SOURCE -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa) -D__hp9000s700 -D_PA_RISC1_1 gcc-hp.c /usr/tmp/cca05980.i
GNU CPP version 2.7.2 (hppa)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /net/hilja/contrib/gnu/hpuxa09/hppa1.1-hp-hpux9.05/include
 /net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2/include
 /usr/include
End of search list.
 /net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2/cc1 /usr/tmp/cca05980.i -quiet -dumpbase gcc-hp.c -version -o /usr/tmp/cca05980.s
GNU C version 2.7.2 (hppa) compiled by GNU C version 2.7.2.
 /net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2/as -o /usr/tmp/cca059801.o /usr/tmp/cca05980.s
 ld -u main /lib/crt0.o -L/net/hilja/contrib/gnu/hpuxa09/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2 -L/net/hilja/contrib/gnu/hpuxa09/lib /usr/tmp/cca059801.o -lgcc -lc -lgcc
<boa:96:~/c> ./a.out 
zsh: bus error  ./a.out
Technical Details
Message-ID: <199601081249.OAA29339@hilja.it.lut.fi>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,f88ed69911adc1e0,start
X-Google-Attributes: gid113d02,public
From: Jarkko.Sonninen@lut.fi (Jarkko Sonninen)
Subject: struct copy in hpux with gcc 2.7.2
Date: 1996/01/08
Message-ID: <199601081249.OAA29339@hilja.it.lut.fi>
X-Deja-AN: 134573123
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.bug