diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-16 22:10:10 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-16 22:10:10 +0000 |
commit | 6d0025f4332e78bb49dfbd312160720fa295b00d (patch) | |
tree | c0995f241340b5f698925d91af5ffa83db5f4b1e /gcc/c-typeck.c | |
parent | 832570c5e63f133db192f6c1acd7f6103cd285ea (diff) | |
download | ppe42-gcc-6d0025f4332e78bb49dfbd312160720fa295b00d.tar.gz ppe42-gcc-6d0025f4332e78bb49dfbd312160720fa295b00d.zip |
* c-typeck.c (build_c_cast): Fold constant variables into
initial values.
* gcc.dg/c90-const-expr-3.c (DZERO): New static variable
(foo): Add few extra tests
* gcc.dg/c99-const-expr-3.c: Likewise.
* gcc.c-torture/execute/20030216-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@62987 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index bbd94a044fa..f3b6bb96fbc 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3765,8 +3765,11 @@ build_c_cast (type, expr) get_alias_set (TREE_TYPE (type)))) warning ("dereferencing type-punned pointer will break strict-aliasing rules"); } - + ovalue = value; + /* Replace a nonvolatile const static variable with its value. */ + if (optimize && TREE_CODE (value) == VAR_DECL) + value = decl_constant_value (value); value = convert (type, value); /* Ignore any integer overflow caused by the cast. */ |