Bug 27438 - [4.1/4.2/4.3 Regression] [unit-at-a-time] '_OBJC_INSTANCE_0' defined but not used warning
Summary: [4.1/4.2/4.3 Regression] [unit-at-a-time] '_OBJC_INSTANCE_0' defined but not ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 4.1.0
: P5 normal
Target Milestone: 4.1.2
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2006-05-04 22:19 UTC by Tima Vaisburd
Modified: 2007-01-24 06:06 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 4.1.0 4.2.0
Last reconfirmed: 2006-05-05 07:06:12


Attachments
Test case (27.17 KB, text/plain)
2006-05-04 22:25 UTC, Tima Vaisburd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tima Vaisburd 2006-05-04 22:19:43 UTC
The compiler emits the series of warnings like

GSCategories.m:50: warning: '_OBJC_INSTANCE_0' defined but not used
[...]

when it sees the construct @"string".

According to Anrew Pinski (pinskia@physics.uc.edu) this is a compiler bug
Comment 1 Andrew Pinski 2006-05-04 22:21:37 UTC
And I asked you to read http://gcc.gnu.org/bugs.html which means attaching the preprocessed source.
Comment 2 Tima Vaisburd 2006-05-04 22:25:59 UTC
Created attachment 11378 [details]
Test case

Compilation made by:

gcc -c -save-temps -m64 -mcpu=v9 NSArchiver.m -c \
      -MMD -MP -I/usr/local/geneva/packages/include -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"sparc\" -DGNUSTEP_TARGET_OS=\"solaris2.8\" -DGNUSTEP_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -Wall -Wno-char-subscripts -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fpic -fPIC -DGSWARN -DGSDIAGNOSE -g -O2 -fno-strict-aliasing -fgnu-runtime -fconstant-string-class=NSConstantString -I../Headers/Additions -I../Headers -I./. -I. -I/usr/local/geneva/packages/include -I/usr/local/geneva/packages/GNUstep/System/Library/Headers -I/usr/local/geneva/packages/GNUstep/System/Library/Headers -I/usr/local/geneva/packages/include/libxml2 -IGNUstep/Library/Headers -I/usr/local/geneva/packages/GNUstep/Local/Library/Headers -I/usr/local/geneva/packages/GNUstep/System/Library/Headers \
       -o shared_obj/NSArchiver.o
Comment 3 Andrew Pinski 2006-05-05 03:18:23 UTC
Reducing.
Comment 4 Andrew Pinski 2006-05-05 07:06:12 UTC
Small testcase with the GNU runtime:
@interface NXConstantString
{
  void *isa;
  const char * const nxcsptr;
  const unsigned int nxcslen;
}
@end
NXConstantString *a =   @"NSInconsistentArchiveException";
Comment 5 Andrew Pinski 2006-05-05 07:31:13 UTC
(In reply to comment #4)
> Small testcase with the GNU runtime:
Note only -Wall -funit-at-a-time is enough to reproduce the bug.
Comment 6 Mark Mitchell 2006-05-14 22:33:39 UTC
P5: Objective-C is not release-critical.
Comment 7 Mark Mitchell 2006-05-25 02:36:47 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 8 Andrew Pinski 2007-01-22 17:35:20 UTC
I have a simple fix.
Comment 9 Andrew Pinski 2007-01-24 06:01:24 UTC
Subject: Bug 27438

Author: pinskia
Date: Wed Jan 24 06:01:09 2007
New Revision: 121102

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121102
Log:
2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc-act.c (objc_add_static_instance): Mark the decl as
        TREE_USED.

2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc.dg/const-str-12.m: New test.


Added:
    trunk/gcc/testsuite/objc.dg/const-str-12.m
Modified:
    trunk/gcc/objc/ChangeLog
    trunk/gcc/objc/objc-act.c
    trunk/gcc/testsuite/ChangeLog

Comment 10 Andrew Pinski 2007-01-24 06:06:22 UTC
Subject: Bug 27438

Author: pinskia
Date: Wed Jan 24 06:06:07 2007
New Revision: 121103

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121103
Log:
2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc-act.c (objc_add_static_instance): Mark the decl as
        TREE_USED.

2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc.dg/const-str-12.m: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/objc.dg/const-str-12.m
      - copied unchanged from r121102, trunk/gcc/testsuite/objc.dg/const-str-12.m
Modified:
    branches/gcc-4_1-branch/gcc/objc/ChangeLog
    branches/gcc-4_1-branch/gcc/objc/objc-act.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 11 Andrew Pinski 2007-01-24 06:06:51 UTC
Subject: Bug 27438

Author: pinskia
Date: Wed Jan 24 06:06:29 2007
New Revision: 121104

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121104
Log:
2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc-act.c (objc_add_static_instance): Mark the decl as
        TREE_USED.

2007-01-23  Andrew Pinski  <pinskia@gmail.com>

        PR objc/27438
        * objc.dg/const-str-12.m: New test.



Added:
    branches/gcc-4_2-branch/gcc/testsuite/objc.dg/const-str-12.m
      - copied unchanged from r121102, trunk/gcc/testsuite/objc.dg/const-str-12.m
Modified:
    branches/gcc-4_2-branch/gcc/objc/ChangeLog
    branches/gcc-4_2-branch/gcc/objc/objc-act.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 12 Andrew Pinski 2007-01-24 06:06:53 UTC
Fixed.