public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37107]  New: Incorrect code generated after function inlining
@ 2008-08-13  8:10 oakad at yahoo dot com
  2008-08-13  8:11 ` [Bug c/37107] " oakad at yahoo dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-13  8:10 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
@ 2008-08-13  8:11 ` oakad at yahoo dot com
  2008-08-13  8:12 ` oakad at yahoo dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-13  8:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from oakad at yahoo dot com  2008-08-13 08:10 -------
Created an attachment (id=16063)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16063&action=view)
Original source file


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
  2008-08-13  8:11 ` [Bug c/37107] " oakad at yahoo dot com
@ 2008-08-13  8:12 ` oakad at yahoo dot com
  2008-08-16 22:15 ` [Bug middle-end/37107] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-13  8:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from oakad at yahoo dot com  2008-08-13 08:10 -------
Created an attachment (id=16064)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16064&action=view)
Assembly of the problematic function


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
  2008-08-13  8:11 ` [Bug c/37107] " oakad at yahoo dot com
  2008-08-13  8:12 ` oakad at yahoo dot com
@ 2008-08-16 22:15 ` pinskia at gcc dot gnu dot org
  2008-08-20  6:34 ` oakad at yahoo dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-16 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-08-16 22:14 -------
Can you provide the preprocessed source which you can get via the -save-temps
option.  Also does using -fno-strict-aliasing fix the issue?  


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
                   ` (2 preceding siblings ...)
  2008-08-16 22:15 ` [Bug middle-end/37107] " pinskia at gcc dot gnu dot org
@ 2008-08-20  6:34 ` oakad at yahoo dot com
  2008-08-20  6:35 ` oakad at yahoo dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-20  6:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from oakad at yahoo dot com  2008-08-20 06:32 -------
(In reply to comment #3)
> Can you provide the preprocessed source which you can get via the -save-temps
> option.  Also does using -fno-strict-aliasing fix the issue?  
> 

-fno-strict-aliasing appears to have no effect on issue.
Different optimization level (-O2) still generates problematic code.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
                   ` (4 preceding siblings ...)
  2008-08-20  6:35 ` oakad at yahoo dot com
@ 2008-08-20  6:35 ` oakad at yahoo dot com
  2008-12-27  6:23 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-20  6:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from oakad at yahoo dot com  2008-08-20 06:33 -------
Created an attachment (id=16103)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16103&action=view)
Preprocessed cfi_flash.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
                   ` (3 preceding siblings ...)
  2008-08-20  6:34 ` oakad at yahoo dot com
@ 2008-08-20  6:35 ` oakad at yahoo dot com
  2008-08-20  6:35 ` oakad at yahoo dot com
  2008-12-27  6:23 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: oakad at yahoo dot com @ 2008-08-20  6:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from oakad at yahoo dot com  2008-08-20 06:34 -------
Created an attachment (id=16104)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16104&action=view)
Full assembler output of cfi_flash.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/37107] Incorrect code generated after function inlining
  2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
                   ` (5 preceding siblings ...)
  2008-08-20  6:35 ` oakad at yahoo dot com
@ 2008-12-27  6:23 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-27  6:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-12-27 06:22 -------
How about -fno-delete-null-pointer-checks -O2?


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-27  6:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-13  8:10 [Bug c/37107] New: Incorrect code generated after function inlining oakad at yahoo dot com
2008-08-13  8:11 ` [Bug c/37107] " oakad at yahoo dot com
2008-08-13  8:12 ` oakad at yahoo dot com
2008-08-16 22:15 ` [Bug middle-end/37107] " pinskia at gcc dot gnu dot org
2008-08-20  6:34 ` oakad at yahoo dot com
2008-08-20  6:35 ` oakad at yahoo dot com
2008-08-20  6:35 ` oakad at yahoo dot com
2008-12-27  6:23 ` pinskia at gcc dot gnu dot org

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