When a prototyped function of var-arg is called without any arguments
to the variable part, "crxor 6,6,6" is not generated.  "-O0
-mno-prototype" does NOT resolve the problem either.

--------test.c--------
int test(const char *a, ...);

void test1(const char *a)
{ test(a, 0); }

void test2(const char *a)
{ test(a); }

--------test.s--------
        .file   "test.c"
        .section        ".text"
        .align 2
        .globl test1
        .type   test1, @function
test1:
        stwu 1,-24(1)
        mflr 0
        stw 31,20(1)
        stw 0,28(1)
        mr 31,1
        stw 3,8(31)
        lwz 3,8(31)
        li 4,0
        crxor 6,6,6    <== has it
        bl test
        lwz 11,0(1)
        lwz 0,4(11)
        mtlr 0
        lwz 31,-4(11)
        mr 1,11
        blr
        .size   test1, .-test1
        .align 2
        .globl test2
        .type   test2, @function
test2:
        stwu 1,-24(1)
        mflr 0
        stw 31,20(1)
        stw 0,28(1)
        mr 31,1
        stw 3,8(31)
        lwz 3,8(31)
        bl test       <== does not have
        lwz 11,0(1)
        lwz 0,4(11)
        mtlr 0
        lwz 31,-4(11)
        mr 1,11
        blr
        .size   test2, .-test2
        .ident  "GCC: (GNU) 3.4.3"

-- 
           Summary: CALL_V4_CLEAR_FP_ARGS flag not properly set
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tong_ho at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-eabi-gcc


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

Reply via email to