public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18742] New: small struct not passed correctly as vararg
@ 2004-11-30 17:12 gcc-bugzilla at gcc dot gnu dot org
  2004-11-30 17:26 ` [Bug target/18742] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-11-30 17:12 UTC (permalink / raw)
  To: gcc-bugs


	The following code tests that complex values are passed
        correctly. A value received by the callee is tested component by
        component to be equal with the (global) value that was passed.
        This fails for the  struct of type at2 that is passed as a var arg.

    failed in foo.c: 43
    failed in foo.c: 44

Environment:
System: Darwin jonagold.local 7.6.0 Darwin Kernel Version 7.6.0: Sun Oct 10 12:05:27 PDT 2004; root:xnu/xnu-517.9.4.obj~1/RELEASE_PPC Power Macintosh powerpc


	
host: powerpc-apple-darwin7.6.0
build: powerpc-apple-darwin7.6.0
target: powerpc-apple-darwin7.6.0
configured with: ../gcc/configure --prefix=/scratch/lindig --enable-languages=c : (reconfigured) ../gcc/configure --prefix=/scratch/lindig --enable-languages=c

How-To-Repeat:
    
    Compile and run the following code.


# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.c"



# 1 "/scratch/lindig/lib/gcc/powerpc-apple-darwin7.6.0/4.0.0/include/stdarg.h" 1 3 4
# 43 "/scratch/lindig/lib/gcc/powerpc-apple-darwin7.6.0/4.0.0/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 105 "/scratch/lindig/lib/gcc/powerpc-apple-darwin7.6.0/4.0.0/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 5 "foo.c" 2
extern int printf (char *, ...);

static int errors = 0;

static void failed( int line )
{ printf ("failed in %s: %d\n", "foo.c", line); errors++; }

static unsigned long int *av2 = (unsigned long int *) 361451618U;

static struct bt2 { float fv2; } kv2 = { 3984.018652 };

static
struct dt2
{ char gv2; struct ct2 { unsigned char hv2; unsigned char iv2; } jv2; }
lv2
=
    { '\x4f', { '\x27', '\x20' } };

static struct at2 { short int bv2; char cv2; } dv2 = { 14855, '\x3d' };

static double ev2 = 67318.083071;

static unsigned long int * callee_af2( struct bt2 ap2, struct dt2 bp2, ... )
{
    va_list ap;
    struct at2 mv2;
    double nv2;
    __builtin_va_start(ap,bp2);
    if (kv2.fv2 != ap2.fv2) failed (33);
    if (lv2.gv2 != bp2.gv2) failed (34);
    if (lv2.jv2.hv2 != bp2.jv2.hv2) failed (35);
    if (lv2.jv2.iv2 != bp2.jv2.iv2) failed (36);
    mv2 = __builtin_va_arg(ap,struct at2);
    nv2 = __builtin_va_arg(ap,double);
    if (mv2.bv2 != dv2.bv2) failed (39);
    if (mv2.cv2 != dv2.cv2) failed (40);
    if (nv2 != ev2) failed (41);
    __builtin_va_end(ap);
    return av2;
}

static void caller_bf2( )
{
    unsigned long int *ov2;
    ov2 = callee_af2 (kv2, lv2, dv2, ev2); if (av2 != ov2) failed (49);
}

int main( int argc, char **argv )
{ caller_bf2 (); return errors; }
------- Additional Comments From lindig at cs dot uni-sb dot de  2004-11-30 17:12 -------
Fix:
	No fix known.

-- 
           Summary: small struct not passed correctly as vararg
           Product: gcc
           Version: 0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lindig at cs dot uni-sb dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.6.0
  GCC host triplet: powerpc-apple-darwin7.6.0
GCC target triplet: powerpc-apple-darwin7.6.0


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


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-18742-9042@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2010-07-24  8:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-30 17:12 [Bug c/18742] New: small struct not passed correctly as vararg gcc-bugzilla at gcc dot gnu dot org
2004-11-30 17:26 ` [Bug target/18742] " pinskia at gcc dot gnu dot org
2005-01-10 15:32 ` chli002 at rz dot uni-saarland dot de
2005-01-10 15:47 ` dje at gcc dot gnu dot org
2005-01-10 19:18 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18742-9042@http.gcc.gnu.org/bugzilla/>
2010-07-24  8:08 ` iains 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).