public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21834] New: Error when passing unsigned long long as function arguments
@ 2005-05-31  1:22 ulyssesric at yahoo dot com dot tw
  2005-05-31  3:35 ` [Bug target/21834] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: ulyssesric at yahoo dot com dot tw @ 2005-05-31  1:22 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2007-05-30 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-31  1:22 [Bug c/21834] New: Error when passing unsigned long long as function arguments ulyssesric at yahoo dot com dot tw
2005-05-31  3:35 ` [Bug target/21834] " pinskia at gcc dot gnu dot org
2005-05-31  3:38 ` ulyssesric at yahoo dot com dot tw
2005-05-31  3:41 ` ulyssesric at yahoo dot com dot tw
2005-06-19 14:02 ` pinskia at gcc dot gnu dot org
     [not found] <bug-21834-10737@http.gcc.gnu.org/bugzilla/>
2007-05-30 20:29 ` eweddington at cso dot atmel dot com

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).