public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/10971] New: Static function inlining fails in C99 mode
@ 2003-05-25 13:52 saptor@hotmail.com
  2003-05-25 14:52 ` [Bug optimization/10971] " pinskia@physics.uc.edu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: saptor@hotmail.com @ 2003-05-25 13:52 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Static function inlining fails in C99 mode
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: saptor@hotmail.com
                CC: gcc-bugs@gcc.gnu.org

Sample code (test.c):

static inline
void foo()
{   
   int i;

   if (1)
   {
      if (1)
         ;
      else
         ;

      if (1)
         i = 1;
   }
}

int main()
{
   foo();

   return 0;
}

Produces this output from GCC when compiled with these settings:

$ gcc-3.3 -O -std=c99 -Winline test.c

test2.c: In function `main':
test2.c:3: warning: inlining failed in call to `foo'
test2.c:20: warning: called from here

Why did foo() fail to inline?  Changing the source by taking out an "if"
statement, the assignment at the end, or not using -std=c99 makes the warning go
away.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
@ 2003-05-25 14:52 ` pinskia@physics.uc.edu
  2003-05-25 17:12 ` jsm28@cam.ac.uk
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-25 14:52 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-05-25 14:19:34
               date|                            |


------- Additional Comments From pinskia@physics.uc.edu  2003-05-25 14:19 -------
It fails because gcc is dump when inline because of it does not  remove deadcode before 
inlining.  There are many trees in foo so it is above the limit.  But you are right that 
removing -std=c99, it inlines at -O1.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
  2003-05-25 14:52 ` [Bug optimization/10971] " pinskia@physics.uc.edu
@ 2003-05-25 17:12 ` jsm28@cam.ac.uk
  2003-05-25 19:13 ` dhazeghi@yahoo.com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28@cam.ac.uk @ 2003-05-25 17:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From jsm28@cam.ac.uk  2003-05-25 16:34 -------
Subject: Re: [Bug optimization/10971] Static function inlining fails in C99
 mode

On Sun, 25 May 2003, pinskia@physics.uc.edu wrote:

> It fails because gcc is dump when inline because of it does not remove
> deadcode before inlining.  There are many trees in foo so it is above
> the limit.  But you are right that removing -std=c99, it inlines at -O1.

C99 adds lots of additional block scopes associated with if statements.  
The stupidity must be in counting compound statements or scopes as part of
the statement count for the purposes of inlining.





------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
  2003-05-25 14:52 ` [Bug optimization/10971] " pinskia@physics.uc.edu
  2003-05-25 17:12 ` jsm28@cam.ac.uk
@ 2003-05-25 19:13 ` dhazeghi@yahoo.com
  2003-06-22  3:24 ` pinskia at physics dot uc dot edu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi@yahoo.com @ 2003-05-25 19:13 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dhazeghi@yahoo.com  2003-05-25 17:30 -------
Hello,

I can confirm this behavior on gcc mainline (20030524) as well. This problem does not occur on 
gcc 3.1 (but -Winline was broken IIRC on the 3.1/2 branch, so I don't think this counts as a 
regression).

Dara



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
                   ` (2 preceding siblings ...)
  2003-05-25 19:13 ` dhazeghi@yahoo.com
@ 2003-06-22  3:24 ` pinskia at physics dot uc dot edu
  2003-08-07 13:39 ` pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-06-22  3:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
                   ` (3 preceding siblings ...)
  2003-06-22  3:24 ` pinskia at physics dot uc dot edu
@ 2003-08-07 13:39 ` pinskia at physics dot uc dot edu
  2003-11-07 15:16 ` pinskia at gcc dot gnu dot org
  2003-11-07 15:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07 13:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-07 13:39 -------
With the mainline after the new inlining counting mechanism this is fixed so closing as 
fixed.


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
                   ` (4 preceding siblings ...)
  2003-08-07 13:39 ` pinskia at physics dot uc dot edu
@ 2003-11-07 15:16 ` pinskia at gcc dot gnu dot org
  2003-11-07 15:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-07 15:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4


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

* [Bug optimization/10971] Static function inlining fails in C99 mode
  2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
                   ` (5 preceding siblings ...)
  2003-11-07 15:16 ` pinskia at gcc dot gnu dot org
@ 2003-11-07 15:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-07 15:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hartmut dot schirmer at
                   |                            |arcor dot de


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-07 15:22 -------
*** Bug 12937 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2003-11-07 15:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-25 13:52 [Bug optimization/10971] New: Static function inlining fails in C99 mode saptor@hotmail.com
2003-05-25 14:52 ` [Bug optimization/10971] " pinskia@physics.uc.edu
2003-05-25 17:12 ` jsm28@cam.ac.uk
2003-05-25 19:13 ` dhazeghi@yahoo.com
2003-06-22  3:24 ` pinskia at physics dot uc dot edu
2003-08-07 13:39 ` pinskia at physics dot uc dot edu
2003-11-07 15:16 ` pinskia at gcc dot gnu dot org
2003-11-07 15:22 ` 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).