diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_grammar.y | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_grammar.y b/usr/src/cmd/mdb/common/mdb/mdb_grammar.y index eda38203e5..97ea454627 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_grammar.y +++ b/usr/src/cmd/mdb/common/mdb/mdb_grammar.y @@ -25,7 +25,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2015, Joyent, Inc. All rights reserved. + */ #include <mdb/mdb_types.h> #include <mdb/mdb_debug.h> @@ -297,6 +299,13 @@ expression: expression '+' expression { $$ = $1 + $3; } if ($3 == 0UL) yyerror("attempted to divide by zero"); + /* + * Annoyingly, x86 generates a #DE when dividing + * LONG_MIN by -1; check for this case explicitly. + */ + if ($1 == LONG_MIN && $3 == -1L) + yyerror("divide overflow"); + $$ = (intmax_t)$1 / (intmax_t)$3; } |