diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-05-06 15:41:35 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-05-06 15:41:35 -0400 |
commit | fc0c675f04a8eb8d197c6e924c6f2d4198a69041 (patch) | |
tree | b7c3068c5cd0dc096f0504f078d57356136e08eb /gcc/c-common.c | |
parent | 2786cbadc7943950874df60f65da3f6a081162d9 (diff) | |
download | gcc-fc0c675f04a8eb8d197c6e924c6f2d4198a69041.zip gcc-fc0c675f04a8eb8d197c6e924c6f2d4198a69041.tar.gz gcc-fc0c675f04a8eb8d197c6e924c6f2d4198a69041.tar.bz2 |
(truthvalue_conversion, case ADDR_EXPR): Don't treat address of
external decl as always nonzero.
From-SVN: r11941
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 3c9018a..8a834dd 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2080,6 +2080,12 @@ truthvalue_conversion (expr) return real_zerop (expr) ? boolean_false_node : boolean_true_node; case ADDR_EXPR: + /* If we are taking the address of a external decl, it might be zero + if it is weak, so we cannot optimize. */ + if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (expr, 0))) == 'd' + && DECL_EXTERNAL (TREE_OPERAND (expr, 0))) + break; + if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0))) return build (COMPOUND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0), boolean_true_node); |