Bug 16321 - 64 bit structure passing problem (g++, not gcc)
Summary: 64 bit structure passing problem (g++, not gcc)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ABI, wrong-code
Depends on:
Blocks:
 
Reported: 2004-07-01 21:19 UTC by Jeff Moskow
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: powerpc-ibm-aix5.1.0.0
Target: powerpc-ibm-aix5.1.0.0
Build: powerpc-ibm-aix5.1.0.0
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Moskow 2004-07-01 21:19:29 UTC
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);
}
Comment 1 Andrew Pinski 2004-07-01 21:22:57 UTC
Can you try a newer compiler than 3.2?
3.4 would be the best compiler to try.
Comment 2 jeff@silk.rtr.com 2004-07-02 12:56:15 UTC
Subject: Re:  64 bit structure passing problem (g++, not gcc)

Sure, but it will have to wait until I get back from vacation (the week of the 12th).

Jeff

According to pinskia at gcc dot gnu dot org:
>
>
>------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-01 21:22 -------
>Can you try a newer compiler than 3.2?
>3.4 would be the best compiler to try.
>
>-- 
>
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16321
>
>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.
>


Comment 3 Giovanni Bajo 2004-08-16 00:26:49 UTC
Waiting for a double-check with GCC 3.4.
Comment 4 Andrew Pinski 2004-11-15 03:39:56 UTC
Any  news?
Comment 5 Jeff Moskow 2004-11-16 22:00:52 UTC
Subject: Re:  64 bit structure passing problem (g++, not gcc)

Hi,
	I tested it with gcc 3.4.3 today and the bug seems to have been fixed.
Regards,
	Jeff

According to pinskia at gcc dot gnu dot org:
>
>
>------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-15 03:39 -------
>Any  news?
>
>-- 
>
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16321
>
>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.
>


Comment 6 Andrew Pinski 2004-11-16 22:48:27 UTC
Closing as fixed.