Bug 69844 - [6 Regression] Possibly bogus error: unknown type name in ObjC code
Summary: [6 Regression] Possibly bogus error: unknown type name in ObjC code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-16 17:32 UTC by Marek Polacek
Modified: 2016-02-23 19:59 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-02-18 00:00:00


Attachments
XAD7ZipParser.mi (107.19 KB, text/plain)
2016-02-16 17:32 UTC, Marek Polacek
Details
gcc6-pr69844.patch (879 bytes, patch)
2016-02-18 16:50 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2016-02-16 17:32:52 UTC
Created attachment 37708 [details]
XAD7ZipParser.mi

$ gcc -std=gnu99 -O2 -Wno-import -Wno-multichar -g -D_FILE_OFFSET_BITS=64 -isystem /usr/include/GNUstep -DGNUSTEP -DGNU_RUNTIME=1 -D_NATIVE_OBJC_EXCEPTIONS -fgnu-runtime -fexceptions -fobjc-exceptions -fconstant-string-class=NSConstantString -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -MMD -MFBuild/XAD7ZipParser.d -MTBuild/XAD7ZipParser.o -c XAD7ZipParser.m -o Build/XAD7ZipParser.o
XAD7ZipParser.m: In function '-[XAD7ZipParser parseWithSeparateMacForks]':
XAD7ZipParser.m:147:2: error: unknown type name 'NSDictionary'
  NSDictionary *additionalstreams=nil;
  ^~~~~~~~~~~~
XAD7ZipParser.m:147:2: note: use 'struct' keyword to refer to the type

Started with r230322 - mine :(.

.mi file attached.
Comment 1 Marek Polacek 2016-02-18 12:34:43 UTC
I think a safe fix would be to just add if (!c_dialect_objc ()) to the change that caused this.
Comment 2 Jakub Jelinek 2016-02-18 16:04:50 UTC
Reduced testcase:
@class D;

void
foo (void)
{
  for (;;)
    ;
  D *d = (id) 0;
  (void) d;
}
Comment 3 Jakub Jelinek 2016-02-18 16:50:08 UTC
Created attachment 37734 [details]
gcc6-pr69844.patch

Untested fix.
Comment 4 Jakub Jelinek 2016-02-23 19:47:56 UTC
Author: jakub
Date: Tue Feb 23 19:47:24 2016
New Revision: 233643

URL: https://gcc.gnu.org/viewcvs?rev=233643&root=gcc&view=rev
Log:
	PR objc/69844
	* c-parser.c (c_parser_for_statement): Properly handle ObjC classes
	in id_kind reclassification.

	* objc.dg/pr69844.m: New test.

Added:
    trunk/gcc/testsuite/objc.dg/pr69844.m
Modified:
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-parser.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2016-02-23 19:59:43 UTC
Fixed.