Bug 450967 - bad code produced under -O0 -ftest-coverage
bad code produced under -O0 -ftest-coverage
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-06-11 18:19 EDT by Roland McGrath
Modified: 2008-06-12 09:04 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-06-12 09:04:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test case preprocessed C source (77.78 KB, text/plain)
2008-06-11 18:19 EDT, Roland McGrath
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 36507 None None None Never

  None (edit)
Description Roland McGrath 2008-06-11 18:19:56 EDT
Description of problem:

Version-Release number of selected component (if applicable):
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) 

How reproducible:

Steps to Reproduce:
1./usr/libexec/gcc/x86_64-redhat-linux/4.3.0/cc1 -fpreprocessed regset-x86_64.i
-quiet -dumpbase regset-x86_64.c -mtune=generic -auxbase-strip
libutrace_a-regset-x86_64.o -g -Wall -std=gnu99 -version -fprofile-arcs
-ftest-coverage -o regset-x86_64.s
2.Look in regset-x86_64.s for "fetch".
3.See call to undefined local function symbol.
Actual results:
An object that can't be linked.

Expected results:
Correct code.

Additional info:
file attached
Comment 1 Roland McGrath 2008-06-11 18:19:56 EDT
Created attachment 309006 [details]
test case preprocessed C source
Comment 2 Jakub Jelinek 2008-06-12 08:34:22 EDT
This has nothing to do with -fprofile-arcs or -ftest-coverage, everything to do
with -O0 -std=gnu99.  Small testcase:
int main (void)
  int i = 2;
  inline int bar (void)
    return i;
  return bar () - 2;
which works with -O0 -std=gnu99 -fgnu89-inline, or -O1 -std=gnu99, or -O0
-std=gnu89, but doesn't work with -O0 -std=gnu99.  inline without extern in
the misdesigned ISO C99 semantics means that external definition is not
provided.  Though, talking about external definitions for nested functions is
weird and extern inline int bar (void) { return i; } as nested function is
diagnosed as error.
Comment 3 Jakub Jelinek 2008-06-12 09:04:08 EDT
Tracking upstream.

Note You need to log in before you can comment on or make changes to this bug.