summaryrefslogtreecommitdiff
path: root/dtc-parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'dtc-parser.y')
-rw-r--r--dtc-parser.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/dtc-parser.y b/dtc-parser.y
index 00d4dbb..000873f 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -419,7 +419,15 @@ integer_mul:
$$ = 0;
}
}
- | integer_mul '%' integer_unary { $$ = $1 % $3; }
+ | integer_mul '%' integer_unary
+ {
+ if ($3 != 0) {
+ $$ = $1 % $3;
+ } else {
+ ERROR(&@$, "Division by zero");
+ $$ = 0;
+ }
+ }
| integer_unary
;