This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21834] New: Error when passing unsigned long long as function arguments
- From: "ulyssesric at yahoo dot com dot tw" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 May 2005 00:16:57 -0000
- Subject: [Bug c/21834] New: Error when passing unsigned long long as function arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I have a function that takes two usigned-long-long variables and two unsigned-char variables as
argument. Here is the sample code:
typedef unsigned char byte_t;
typedef unsigned long long qword_t;
void foo(
byte_t state,
qword_t srcAddr,
byte_t routeOptions,
qword_t dstAddr
) {
...
}
void main(void) {
....
foo(0x00,0x1234ll,0x01, 0x5678ll);
....
}
Compiled with avr-gcc 3.4.3, for Atmega 128:
avr-gcc -mmcu=atmega128 -g -Os -Wall -Wa,-adhlns=func1.o -std=gnu99 -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -ffreestanding -c func1.c -o func1.o
When I tried to check the values of variable srcAddr and dstAddr within foo() using UART, they are not
what they should be. srcAddr is something like 0xDE00000000001A6D, and dstAddr is
0x7800000000000056.
However, If I change the order of these arguments to :
void foo(
qword_t srcAddr,
qword_t dstAddr,
byte_t state,
byte_t routeOptions
) {
...
}
and the result would be correct.
--
Summary: Error when passing unsigned long long as function
arguments
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ulyssesric at yahoo dot com dot tw
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: X86 (Linux, Win32) and PowerPC (Darwin)
GCC target triplet: AVR, Atmega128
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21834