From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32205 invoked by alias); 31 May 2005 00:17:04 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32098 invoked by uid 48); 31 May 2005 00:16:57 -0000 Date: Tue, 31 May 2005 01:22:00 -0000 From: "ulyssesric at yahoo dot com dot tw" To: gcc-bugs@gcc.gnu.org Message-ID: <20050531001655.21834.ulyssesric@yahoo.com.tw> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/21834] New: Error when passing unsigned long long as function arguments X-Bugzilla-Reason: CC X-SW-Source: 2005-05/txt/msg03942.txt.bz2 List-Id: 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