Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 450967 - bad code produced under -O0 -ftest-coverage
Summary: bad code produced under -O0 -ftest-coverage
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-06-11 22:19 UTC by Roland McGrath
Modified: 2008-06-12 13:04 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-12 13:04:08 UTC

Attachments (Terms of Use)
test case preprocessed C source (deleted)
2008-06-11 22:19 UTC, Roland McGrath
no flags Details

System ID Priority Status Summary Last Updated
GNU Compiler Collection 36507 None None None Never

Description Roland McGrath 2008-06-11 22:19:56 UTC
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 22:19:56 UTC
Created attachment 309006 [details]
test case preprocessed C source

Comment 2 Jakub Jelinek 2008-06-12 12:34:22 UTC
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 13:04:08 UTC
Tracking upstream.

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