c/938: inline nested functions not compiled correctly when using -O0

stephen.thomas@st.com stephen.thomas@st.com
Thu Nov 30 06:06:00 GMT 2000


>Number:         938
>Category:       c
>Synopsis:       inline nested functions not compiled correctly when using -O0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 30 06:06:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Stephen R. Thomass
>Release:        2.97
>Organization:
>Environment:
All
>Description:
When the following code is compiled with -O0:

int ggg (void)
{
  int v = 42;

  static inline int fff (int x)
  {
    return x*10;
  }

  return fff (v);
}

the resulting object file contains an undefined reference
to 'fff.0', & will fail to link. Disassembly of the object
file appears to contain no definition of function fff.
The problem only seems to occur with nested inline
functions, and only when -O0 is used. With -O1, the function 
fff is correctly optimized away.

The problem occurs with the latest gcc snapshot as of
Nov 30, on http://www.codesourcery.com/gcc-compile/shtml .
The problem was not present in release 2.95.2.
>How-To-Repeat:
Compile any code with a nested inline function using -O0.
>Fix:
Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list