From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9702C3858D1E; Mon, 10 Apr 2023 10:32:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9702C3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681122734; bh=NvDSOgXq/n3Qhjtn6nSCkHh+1uaz1oDnzr/ZqJBbpks=; h=From:To:Subject:Date:From; b=XV2YMqgCHg67ggpkYsO+UMYQ3+8jcKh1rEQRasP1iE9b4b4EVI8kaSs3AW19ocnif AcEbSUNmjyKwPE2aejOC0XW5VSid2AcR82zW8Z0LxixQ5c/GSOJ5BgF7TlZBoELKQ+ y5wC4EBfN0zxjjYPatgfNpagWYCwtEECJYJ52rRQ= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109462] New: [13 Regression] Possible miscompilation of clang LocalizationChecker since r13-1938 Date: Mon, 10 Apr 2023 10:32:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109462 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=3D54823&action=3Dedit 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=3Doptin.osx.cocoa.localizability.EmptyLocalizationContext= Checker #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 =3D 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_131EmptyLocalizationContextChecker13MethodCrawler20VisitObj= CMessageExprEPKN5clang15ObjCMessageExprE functions and it is the latter that matters for whether the warning is repo= rted or not (proved by hand-combining assembly from the 2 revisions, everything from r13-1937 but the _ZN12_GLOBAL__N_131EmptyLocalizationContextChecker13MethodCrawler20VisitObj= CMessageExprEPKN5clang15ObjCMessageExprE 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=3Dc= ++17 LocalizationChecker.ii=