-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0816-Potentially-ambiguous-macro-operator-names-used.patch
57 lines (45 loc) · 2.44 KB
/
0816-Potentially-ambiguous-macro-operator-names-used.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gregory Morse <[email protected]>
Date: Sat, 20 Jul 2019 11:57:46 +0200
Subject: [PATCH] 0816: Potentially ambiguous macro operator names used
4 operators are emitted in finally C code: ZEXT, SEXT, CONCAT, SUB
Although generally the sizes are just one character (from 1 to 8) potentially numeric values can be 16 bytes long.
The suffix 112 to any of these for example. Could be 1 byte and 12 bytes. Or 11 bytes and 2 bytes. Obviously the naming convention here is poorly chosen.
However that being said, this behavior could be deliberately depended upon in other areas though AFAIK only custom tools would do so. It is better to change it earlier than later partly for that reason as tools could learn to depend on the behavior as opposed to doing what I have done and choosing to fix the ambiguity in the C source to begin with.
---
Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
index d8350e28b1..f357f8143d 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
@@ -1107,7 +1107,7 @@ string TypeOpIntZext::getOperatorName(const PcodeOp *op) const
{
ostringstream s;
- s << name << dec << op->getIn(0)->getSize() << op->getOut()->getSize();
+ s << name << dec << op->getIn(0)->getSize() << "_" << op->getOut()->getSize();
return s.str();
}
@@ -1133,7 +1133,7 @@ string TypeOpIntSext::getOperatorName(const PcodeOp *op) const
{
ostringstream s;
- s << name << dec << op->getIn(0)->getSize() << op->getOut()->getSize();
+ s << name << dec << op->getIn(0)->getSize() << "_" << op->getOut()->getSize();
return s.str();
}
@@ -2033,7 +2033,7 @@ string TypeOpPiece::getOperatorName(const PcodeOp *op) const
{
ostringstream s;
- s << name << dec << op->getIn(0)->getSize() << op->getIn(1)->getSize();
+ s << name << dec << op->getIn(0)->getSize() << "_" << op->getIn(1)->getSize();
return s.str();
}
@@ -2112,7 +2112,7 @@ string TypeOpSubpiece::getOperatorName(const PcodeOp *op) const
{
ostringstream s;
- s << name << dec << op->getIn(0)->getSize() << op->getOut()->getSize();
+ s << name << dec << op->getIn(0)->getSize() << "_" << op->getOut()->getSize();
return s.str();
}
--
2.45.1