-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix enum display on negative numbers or bit masks with MSB set. Do not sign-extend values when comparing. Thanks a lot Honggyu for reporting and debugging the issues. Fixed: #1784 Signed-off-by: Namhyung Kim <[email protected]>
- Loading branch information
Showing
6 changed files
with
74 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
static int cnt; | ||
|
||
enum memory_order_modifier { | ||
zero = 0, | ||
memory_order_mask = 0x0ffff, | ||
memory_order_modifier_mask = 0xffff0000, | ||
memory_order_hle_acquire = 0x10000, | ||
memory_order_hle_release = 0x20000 | ||
}; | ||
|
||
__attribute__((noinline)) void foo(enum memory_order_modifier m) | ||
{ | ||
if (m != zero) | ||
cnt++; | ||
} | ||
|
||
int main() | ||
{ | ||
foo(memory_order_mask); | ||
foo(memory_order_modifier_mask); | ||
foo(memory_order_hle_acquire); | ||
foo(memory_order_hle_release); | ||
return cnt == 4 ? 0 : -1; | ||
} |
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,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import re | ||
|
||
from runtest import TestBase | ||
|
||
class TestCase(TestBase): | ||
def __init__(self): | ||
TestBase.__init__(self, 'enum2', result=""" | ||
# DURATION TID FUNCTION | ||
[ 57041] | main() { | ||
0.535 us [ 57041] | foo(memory_order_mask); | ||
0.109 us [ 57041] | foo(memory_order_modifier_mask); | ||
0.069 us [ 57041] | foo(memory_order_hle_acquire); | ||
0.068 us [ 57041] | foo(memory_order_hle_release); | ||
1.783 us [ 57041] | } = 0; /* main */ | ||
""", cflags='-g') | ||
|
||
def build(self, name, cflags='', ldflags=''): | ||
if not "dwarf" in self.feature: | ||
return TestBase.TEST_SKIP | ||
# cygprof doesn't support arguments now | ||
if cflags.find('-finstrument-functions') >= 0: | ||
return TestBase.TEST_SKIP | ||
|
||
return TestBase.build(self, name, cflags, ldflags) | ||
|
||
def setup(self): | ||
self.option = '-F main -a' |
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