diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-08-24 18:28:40 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-08-24 18:28:40 -0400 |
commit | d4424a75ec3ad8c1a7a638ef515284dd9f6b0549 (patch) | |
tree | 2a73e434a8989364ac08075fa2f86077461a3422 | |
parent | aff2a12b7029cbbe67612a4d2ce9edfe7bb150fe (diff) | |
download | gcc-d4424a75ec3ad8c1a7a638ef515284dd9f6b0549.zip gcc-d4424a75ec3ad8c1a7a638ef515284dd9f6b0549.tar.gz gcc-d4424a75ec3ad8c1a7a638ef515284dd9f6b0549.tar.bz2 |
(default_conversion): Don't substitute constant value if array since
will return address.
From-SVN: r7970
-rw-r--r-- | gcc/c-typeck.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index aedc7e5..bb638dc 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -990,8 +990,11 @@ default_conversion (exp) /* Constants can be used directly unless they're not loadable. */ if (TREE_CODE (exp) == CONST_DECL) exp = DECL_INITIAL (exp); - /* Replace a nonvolatile const static variable with its value. */ - else if (optimize && TREE_CODE (exp) == VAR_DECL) + + /* Replace a nonvolatile const static variable with its value unless + it is an array, in which case we must be sure that taking the + address of the array produces consistent results. */ + else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE) { exp = decl_constant_value (exp); type = TREE_TYPE (exp); |