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]

va_arg on Alpha Linux


I compiled the following program using gcc 3.2.2 on Alpha RedHat 6.1.

#include <stdarg.h>
#include <stdio.h>

struct aaa_t{
        int bbb[13];
};

void foo(struct aaa_t c, int n, ...){
        va_list va;
	double d;
        va_start(va, n);
	d = va_arg(va, double);
        printf("%f\n", d);
}

int main(){
        struct aaa_t c;
        foo(c, 1, 3.0);
}

$ gcc test_va.c
$ ./a.out
0.000000

Is it a bug?
When I compiled using Compaq C, d is 3.

$ gcc -v
Reading specs from local/bin/../lib/gcc-lib/alphaev67-unknown-linux-gnu/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/home/susukita/local
Thread model: posix
gcc version 3.2.2

SUSUKITA, Ryutaro
The Institute of Physical and Chemical Research (RIKEN)
Computational Science Division
To: bug-gcc at gnu dot org
cc: va_arg on Alpha Linux
Subject: susukita
--------
I compiled the following program using gcc 3.2.2 on Alpha RedHat 6.1.

#include <stdarg.h>
#include <stdio.h>

struct aaa_t{
        int bbb[13];
};

void foo(struct aaa_t c, int n, ...){
        va_list va;
	double d;
        va_start(va, n);
	d = va_arg(va, double);
        printf("%f\n", d);
}

int main(){
        struct aaa_t c;
        foo(c, 1, 3.0);
}

$ gcc test_va.c
$ ./a.out
0.000000

Is it a bug?
When I compiled using Compaq C, d is 3.

$ gcc -v
Reading specs from local/bin/../lib/gcc-lib/alphaev67-unknown-linux-gnu/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/home/susukita/local
Thread model: posix
gcc version 3.2.2

SUSUKITA, Ryutaro
The Institute of Physical and Chemical Research (RIKEN)
Computational Science Division


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