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]
Other format: [Raw text]

[Bug c++/16321] New: 64 bit structure passing problem (g++, not gcc)


The following code fails using -maix64 (g++, NOT gcc).  Using -DFIX64 (to make
the structure size a multiple of 8 bytes fixes the problem).

#include <stdio.h>
#include <string.h>

typedef struct _x {
    char str1[80];
    char str2[40];
    int i;
#ifdef FIX64
    int dummy;
#endif
} x;

int sub( x d )
{
    printf( "%s\n", d.str1 );
    printf( "%s\n", d.str2 );
}

main()
{
    x data;
    strncpy( data.str1, "this is the first test string", 80 );
    strncpy( data.str2, "this is the second test string", 40 );
    sub(data);
}

-- 
           Summary: 64 bit structure passing problem (g++, not gcc)
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jeff at rtr dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0


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


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