First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 34985
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Manuel López-Ibáñez <manu@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Sam Ravnborg <sam@ravnborg.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 34985 depends on: Show dependency tree
Show dependency graph
Bug 34985 blocks: 33702

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2008-02-02 12:52 Opened: 2008-01-26 19:28
Exact gcc version (Fedora 8): gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)

Following small code snippet:

static void remove_one(void);
static void __attribute__((__used__)) remove_one(void)
{
}

build with:
gcc -c -Wall test.c

produces following warning:
test.c:4: warning: ‘remove_one’ defined but not used

Removing the forward declaration (prototye) or
adding the attribute to the forward declaration make
the warning disappear.

I had expected the attribution on the function to take
precedence over the forward declaration.

Browsing the gcc manual did not reveal an answer and searching
the web / the bug database did not bring up an answer
so I decided to report it as a bug.

/Sam

------- Comment #1 From Richard Guenther 2008-01-26 20:09 -------
Confirmed.  Not a regression.

------- Comment #2 From Manuel López-Ibáñez 2008-02-02 12:52 -------
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00044.html

I miss the patch tracker :(

------- Comment #3 From Manuel López-Ibáñez 2008-07-29 10:01 -------
Subject: Bug 34985

Author: manu
Date: Tue Jul 29 10:00:25 2008
New Revision: 138235

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138235
Log:
2008-07-29  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR 34985
        * c-decl.c (merge_decls): Merge USED flags.
cp/
        * decl.c (duplicate_decls): Merge USED flags.
testsuite/
        * gcc.dg/pr34985.c: New.
        * g++.dg/warn/pr34985.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/warn/pr34985.C
    trunk/gcc/testsuite/gcc.dg/pr34985.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog

------- Comment #4 From Manuel López-Ibáñez 2008-07-29 10:08 -------
Fixed in GCC 4.4

First Last Prev Next    No search results available      Search page      Enter new bug