public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18956] New: 'bus error' at runtime while passing a special struct to a C++ member function
@ 2004-12-13 14:51 jrr at concept dot de
  2005-06-19 14:53 ` [Bug middle-end/18956] [3.4 only] [hppa] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 5+ messages in thread
From: jrr at concept dot de @ 2004-12-13 14:51 UTC (permalink / raw)
  To: gcc-bugs

The following simple C++ program dies with a 'bus error' on PA/HPUX:

struct WrongPadding {
    unsigned short one, two, three;
    /* unsigned short padding_dummy;  --> BUS ERROR w/o this padding member */
};

struct A {
public:
    void foo(int a, int b, struct WrongPadding bar) {}
};

int main(int argc, char* argv[]) {
    A obj;
    struct WrongPadding bar;
    obj.foo(0, 0, bar); // --> Bus Error when calling this member function
    return 0;
}


----

To reproduce:
-------------

$ g++ -Wall buserror.cpp -o buserror
$ ./buserror
Bus error (core dumped)

----

I suspect a problem with alignment / struct padding when calling the member
function foo. As a work-around, I added an additional 'unsigned short' member to
the struct. The 64-bit port (target hppa64-hp-hpux11.00) of gcc-3.3.3 does not
have this problem. I wasn't able to reproduce something similar with C (instead
of C++).

----

Software version information follows:
-------------------------------------

* GCC-3.3.3 was configured with:
  $ g++ -v
  Reading specs from /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.3.3/specs
  Configured with: /extra/src/gcc-3.3.3/configure --enable-languages=c,c++
    --with-gnu-as --with-as=/usr/local/32bit/bin/as --with-ld=/usr/ccs/bin/ld
    --disable-nls
  Thread model: single
  gcc version 3.3.3

* HP Linker version: (recent linker patch applied)
  $ /usr/ccs/bin/ld -V
  92453-07 linker command s800.sgs ld PA64 B.11.41 REL 040808
  /usr/ccs/bin/ld: 92453-07 linker linker ld B.11.41 040911

* GNU assembler version: (compiled from binutils-2.14)
  $ /usr/local/32bit/bin/as -v
  GNU assembler version 2.14 (hppa2.0w-hp-hpux11.00)
  using BFD version 2.14 20030612

* binutils 2.14 was built by commercial ANSI-C compiler:
  $ what /opt/ansic/bin/cc
  /opt/ansic/bin/cc:
        $Revision: 92453-07 linker linker crt0.o B.11.16.01 030316 $
        LINT B.11.11.08 CXREF B.11.11.08
        HP92453-01 B.11.11.08 HP C Compiler
         $ PATCH/11.00:PHCO_27774  Oct  3 2002 09:45:59 $

-- 
           Summary: 'bus error' at runtime while passing a special struct to
                    a C++ member function
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jrr at concept dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa2.0w-hp-hpux11.00
  GCC host triplet: hppa2.0w-hp-hpux11.00
GCC target triplet: hppa2.0w-hp-hpux11.00


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18956


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-28  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-18956-9784@http.gcc.gnu.org/bugzilla/>
2005-11-26  7:19 ` [Bug middle-end/18956] [3.4 only] [hppa] 'bus error' at runtime while passing a special struct to a C++ member function gdr at gcc dot gnu dot org
2005-11-26 16:57 ` dave at hiauly1 dot hia dot nrc dot ca
2005-11-28 10:20 ` gdr at gcc dot gnu dot org
2006-02-28  9:49 ` gdr at gcc dot gnu dot org
2004-12-13 14:51 [Bug c++/18956] New: " jrr at concept dot de
2005-06-19 14:53 ` [Bug middle-end/18956] [3.4 only] [hppa] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).