diff options
author | Jan Hubicka <jh@suse.cz> | 2010-09-24 18:24:45 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-09-24 16:24:45 +0000 |
commit | 1d0804d4b6a66182a23ea9df876fb33da0b7d702 (patch) | |
tree | a6a227dfae75d1896089bedcef4875d6a83e133d /gcc/expr.c | |
parent | 5642f5d5d5e3f6867cbe4b7b6fb1588365514c9c (diff) | |
download | gcc-1d0804d4b6a66182a23ea9df876fb33da0b7d702.zip gcc-1d0804d4b6a66182a23ea9df876fb33da0b7d702.tar.gz gcc-1d0804d4b6a66182a23ea9df876fb33da0b7d702.tar.bz2 |
re PR middle-end/45738 (ICE: tree check: expected var_decl, have debug_expr_decl in const_value_known_p, at varpool.c:375)
PR tree-optimization/45738
PR tree-optimization/45741
* expr.c (string_constant): Allow CONST_DECL too;
check that DECL_INITIAL is set.
* varpool.c (const_value_known_p): Only look into VAR_DECL
and CONST_DECL.
* gcc.c-torture/compile/pr45741.c: New.
* gfortran.fortran-torture/compile/pr45738.f90: New.
From-SVN: r164602
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -9854,12 +9854,14 @@ string_constant (tree arg, tree *ptr_offset) *ptr_offset = fold_convert (sizetype, offset); return array; } - else if (TREE_CODE (array) == VAR_DECL) + else if (TREE_CODE (array) == VAR_DECL + || TREE_CODE (array) == CONST_DECL) { int length; /* Variables initialized to string literals can be handled too. */ if (!const_value_known_p (array) + || !DECL_INITIAL (array) || TREE_CODE (DECL_INITIAL (array)) != STRING_CST) return 0; |