DynamoRIO / DynamoRIO/dynamorio
Typo in ARM opnd_compute_address_priv caught by GCC 7.3.0
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
With the GCC in Debian unstable I got this warning:
```
/.../dynamorio/core/arch/opnd_shared.c:1920:72: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]
(TEST(EFLAGS_C, mc->cpsr) ? (1 << (sizeof(reg_t)*8-1)) : 0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
```
GCC deserves a pat on the head for this, because it seems to have caught a real bug: the `||` at the end of line 1919 should be a `|`, I think. What the code seems to be doing is computing the effective address when RRX is used in an address calculation: a very weird thing to do, so it's not surprising if it was never tested. (Is there a place where a test for this could *easily* be added? Not worth adding a new top-level test just for this.)
Contributor guide
Research direction
Read core/arch/opnd_shared.c around lines 1919-1920 and trace the effective-address calculation for the ARM RRX case. Check whether an existing test can cover this path, as requested in the issue; done means correcting the operator and confirming the GCC warning no longer occurs without introducing a new top-level test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100