In the attached file (cfi_flash.c), the function flash_detect_cfi is inlined
into the function flash_get_size. flash_detect_cfi accepts (arg 2) a pointer to
structure defined on stack in flash_get_size. Upon completion, some fields from
the structure in question are referenced (lines 1731 - 1734).

The generated code for the function (flash_get_size.asm, lines 63-70) does none
of these, introducing a nasty runtime bug.

Build parameters:

powerpc-linux-gnuspe-gcc -g  -Os   -fPIC -ffixed-r14 -meabi -D__KERNEL__
-DTEXT_BASE=0xfffc0000 -I/root/u-boot-1.3.3/include -fno-builtin
-ffreestanding -nostdinc
-isystem /usr/local/powerpc/lib/gcc/powerpc-linux-gnuspe/4.3.1/include
-pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2
-Wa,-me500 -msoft-float -mno-string -mno-spe -DCONFIG_E500=1
-DCONFIG_MPC85xx=1 -DCONFIG_MPC8548=1 -Wall -Wstrict-prototypes
-c -o cfi_flash.o cfi_flash.c


-- 
           Summary: Incorrect code generated after function inlining
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oakad at yahoo dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: powerpc-linux-gnuspe


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

Reply via email to