discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clang 14 issues building Objective-C with ARC


From: Frederik Seiffert
Subject: Clang 14 issues building Objective-C with ARC
Date: Mon, 8 Aug 2022 17:13:31 +0200

As mentioned in Saturday’s meeting I am seeing a couple issues building Objective-C code with ARC using Clang/LLVM 14 or 15rc1 on Windows, whereas the same code works fine using Clang 13.

I managed to distill one issue here, it would be great if someone could check whether this also affects platforms other than Windows:
https://github.com/llvm/llvm-project/issues/56952

Additionally I’m seeing some very strange behavior calling class methods in GNUstep with Clang 14 and 15rc1 using ARC and -O1 or -O2, which might be related:

@try {
id processInfoClass = [NSProcessInfo class];
NSLog(@"processInfoClass: %@ (%p)", processInfoClass, processInfoClass);
id processInfo = [NSProcessInfo processInfo];
NSLog(@"processInfo: %@ (%p)", processInfo, processInfo);
id arguments = [processInfo arguments];
NSLog(@"arguments: %@", arguments);
@catch (id exc) {
NSLog(@"Exception: %@", exc);
}


This will result in the following exception when calling -processInfo:
<NSException: 0x8d20a068> NAME:NSInvalidArgumentException REASON:NSObject(class) does not recognize processInfo INFO:(null)

But when I replace [NSProcessInfo processInfo] with [processInfoClass processInfo], I’m getting this exception from calling -arguments instead:
<NSException: 0xebb88048> NAME:NSInvalidArgumentException REASON:NSProcessInfo(class) does not recognize arguments INFO:(null)

It seems like there’s some mixup with what kind of class objects the compiler returns, but it depends on the exact code, e.g. when calling just one of these methods above individually it works fine. Again it would be great if someone could try to reproduce this on other platforms to get a better picture.

At the same time I was wondering if we can come up with a way to catch issues like that sooner in the future, ideally already during LLVM beta/RC phases. One option might be to add a CI phase to always build with the latest LLVM (RC) release from GitHub (https://github.com/llvm/llvm-project/releases). Ideally we’d also have more tests for Objective-C with the GNU runtime in LLVM itself, but I’m not sure if anyone here would have the expertise to add these.

Frederik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]