diff options
author | Richard Stallman <rms@gnu.org> | 1992-05-17 22:13:51 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-05-17 22:13:51 +0000 |
commit | 26b3c423d5a1bbefbdd659dce21a84a260bae459 (patch) | |
tree | 441b9d55cd2e165f785d10996da493dd963d0652 | |
parent | 98f21a70bfc35eae3e85e2257bc0c972d3db9968 (diff) | |
download | gcc-26b3c423d5a1bbefbdd659dce21a84a260bae459.zip gcc-26b3c423d5a1bbefbdd659dce21a84a260bae459.tar.gz gcc-26b3c423d5a1bbefbdd659dce21a84a260bae459.tar.bz2 |
*** empty log message ***
From-SVN: r1005
-rw-r--r-- | gcc/c-typeck.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2de86ae..751a258 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -782,6 +782,17 @@ c_alignof (type) return size_int (TYPE_ALIGN (type) / BITS_PER_UNIT); } + +/* Print a warning if a constant expression had overflow in folding. + This doesn't really work--it is waiting for changes in fold. */ + +void +constant_expression_warning (value) + tree value; +{ + if (TREE_CODE (value) == NON_LVALUE_EXPR && TREE_CONSTANT_OVERFLOW (value)) + pedwarn ("overflow in constant expression"); +} /* Implement the __alignof keyword: Return the minimum required alignment of EXPR, measured in bytes. For VAR_DECL's and @@ -3013,7 +3024,7 @@ build_unary_op (code, xarg, noconvert) return error_mark_node; /* Report a read-only lvalue. */ - if (TYPE_READONLY (TREE_TYPE (arg))) + if (TREE_READONLY (arg)) readonly_warning (arg, ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) @@ -4203,6 +4214,9 @@ store_init_value (decl, init) } #endif + /* ANSI wants warnings about out-of-range constant initializers. */ + constant_expression_warning (value); + DECL_INITIAL (decl) = value; } |