🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jarkko Sonninen Mon, 08 Jan 1996 00:00
struct copy in hpux with gcc 2.7.2
#6190
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads