https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67455

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-27
                 CC|                            |egallager at gcc dot gnu.org
          Component|objc                        |libobjc
            Summary|Inheriting from Object      |Inheriting from Object
                   |doesn't provide alloc, init |(with GNU runtime) doesn't
                   |or new rendering methods    |provide alloc, init, or
                   |usless                      |new, rendering methods
                   |                            |useless
     Ever confirmed|0                           |1

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
The only warning I get when compiling the program is:

$ /usr/local/bin/gcc -o 67455 67455.m -lobjc
67455.m: In function ‘main’:
67455.m:51:2: warning: incompatible implicit declaration of built-in function
‘printf’
  printf("Initial Value: %d\n", [aTestObject value]);
  ^~~~~~
67455.m:51:2: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
$

When running it, I get this output:

$ ./67455
Initial Value: 0
+45 Value: 45
-63 Value: -18
+103 Value: 85
$

After including <stdio.h>, when explicitly specifying the runtime flag, I only
get the warning with -fgnu-runtime, which leads to a crash when running it:

$ /usr/local/bin/gcc -fnext-runtime -o 67455_next 67455.m -lobjc
$ ./67455_next
Initial Value: 0
+45 Value: 45
-63 Value: -18
+103 Value: 85
$ /usr/local/bin/gcc -fgnu-runtime -o 67455_gnu 67455.m -lobjc
67455.m: In function ‘-[TestObject init]’:
67455.m:21:2: warning: ‘Object’ may not respond to ‘-init’
  if ((self = [super init]))
  ^~
67455.m:21:2: warning: (Messages without a matching method signature
67455.m:21:2: warning: will be assumed to return ‘id’ and accept
67455.m:21:2: warning: ‘...’ as arguments.)
67455.m: In function ‘main’:
67455.m:51:2: warning: ‘TestObject’ may not respond to ‘+alloc’
  TestObject *aTestObject = [[TestObject alloc] init];
  ^~~~~~~~~~
$ ./67455_gnu
Bus error
$

So confirming for the GNU runtime. Since it's a runtime issue, changing
component to libobjc. Feel free to change back if I'm wrong.

Reply via email to