-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][Sema] Subclass
-Wshorten-64-to-32
under `-Wimplicit-int-con…
…version` (#80814) Although "implicit int conversions" is supposed to be a superset containing the more specific "64-to-32" case, previously they were a disjoint set, only enabled in common in the much larger `-Wconversion`.
- Loading branch information
1 parent
e50189b
commit 4b72c5e
Showing
4 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
clang/test/Sema/conversion-implicit-int-includes-64-to-32.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify -Wimplicit-int-conversion -triple x86_64-apple-darwin %s | ||
|
||
int test0(long v) { | ||
return v; // expected-warning {{implicit conversion loses integer precision}} | ||
} | ||
|
||
typedef int int4 __attribute__ ((vector_size(16))); | ||
typedef long long long2 __attribute__((__vector_size__(16))); | ||
|
||
int4 test1(long2 a) { | ||
int4 v127 = a; // no warning. | ||
return v127; | ||
} | ||
|
||
int test2(long v) { | ||
return v / 2; // expected-warning {{implicit conversion loses integer precision: 'long' to 'int'}} | ||
} | ||
|
||
char test3(short s) { | ||
return s * 2; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char'}} | ||
} |