public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109462] New: [13 Regression] Possible miscompilation of clang LocalizationChecker since r13-1938
@ 2023-04-10 10:32 jakub at gcc dot gnu.org
  2023-04-10 10:32 ` [Bug tree-optimization/109462] " jakub at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-10 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109462
           Summary: [13 Regression] Possible miscompilation of clang
                    LocalizationChecker since r13-1938
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54823
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54823&action=edit
LocalizationChecker.ii.xz

As mentioned in (but not reported to us) in
https://github.com/llvm/llvm-project/issues/59227
// clang -cc1 test.m -analyze -setup-static-analyzer
-analyzer-checker=optin.osx.cocoa.localizability.EmptyLocalizationContextChecker
#define nil ((id)0)
#define NSLocalizedString(key, comment) [[NSBundle mainBundle]
localizedStringForKey:(key) value:@"" table:nil]
struct CGPoint { double x; double y; };
typedef struct CGPoint CGPoint;
@interface NSObject
+ (id)alloc;
- (id)init;
@end
@class NSDictionary;
@interface NSString : NSObject
- (void)drawAtPoint:(CGPoint)point withAttributes:(NSDictionary *)attrs;
+ (instancetype)localizedStringWithFormat:(NSString *)format, ...;
@end
@interface NSBundle : NSObject
+ (NSBundle *)mainBundle;
- (NSString *)localizedStringForKey:(NSString *)key
                              value:(NSString *)value
                              table:(NSString *)tableName;
@end
@interface LocalizationTestSuite : NSObject
@end
@implementation LocalizationTestSuite
- (void)testNilLocalizationContext {
  NSString *string = NSLocalizedString(@"LocalizedString", nil);
}
@end
reports an (expected) warning when
clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp is compiled with
r13-1937 and earlier, while
when compiled with r13-1938 and later the warning is not emitted.
The r13-1938 changes cause differences in
_ZNK5clang13SourceManager16getDecomposedLocENS_14SourceLocationE
and
_ZN12_GLOBAL__N_131EmptyLocalizationContextChecker13MethodCrawler20VisitObjCMessageExprEPKN5clang15ObjCMessageExprE
functions and it is the latter that matters for whether the warning is reported
or not (proved by hand-combining assembly
from the 2 revisions, everything from r13-1937 but the
_ZN12_GLOBAL__N_131EmptyLocalizationContextChecker13MethodCrawler20VisitObjCMessageExprEPKN5clang15ObjCMessageExprE
function from r13-1938 doesn't report the warning, everything from r13-1938 but
that function from r13-1937 does.
First difference in both functions appears in the dom2 dumps.

Flags used to compile were -fPIC -fno-semantic-interposition
-fvisibility-inlines-hidden -ffunction-sections -fdata-sections -fno-common
-fno-strict-aliasing -O3 -fno-exceptions -funwind-tables -fno-rtti -std=c++17
LocalizationChecker.ii

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-13 18:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-10 10:32 [Bug tree-optimization/109462] New: [13 Regression] Possible miscompilation of clang LocalizationChecker since r13-1938 jakub at gcc dot gnu.org
2023-04-10 10:32 ` [Bug tree-optimization/109462] " jakub at gcc dot gnu.org
2023-04-10 10:37 ` pinskia at gcc dot gnu.org
2023-04-10 11:13 ` jakub at gcc dot gnu.org
2023-04-11 12:13 ` jakub at gcc dot gnu.org
2023-04-11 12:56 ` jakub at gcc dot gnu.org
2023-04-11 20:14 ` amacleod at redhat dot com
2023-04-11 21:23 ` amacleod at redhat dot com
2023-04-12  7:49 ` jakub at gcc dot gnu.org
2023-04-12  7:50 ` jakub at gcc dot gnu.org
2023-04-12 13:10 ` cvs-commit at gcc dot gnu.org
2023-04-12 14:23 ` cvs-commit at gcc dot gnu.org
2023-04-12 14:42 ` marxin at gcc dot gnu.org
2023-04-12 15:20 ` jakub at gcc dot gnu.org
2023-04-13 18:12 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).