[llvm-commits] [llvm-gcc-4.0] r41760 - /llvm-gcc-4.0/trunk/gcc/c-typeck.c
Bill Wendling
isanbard at gmail.com
Fri Sep 7 01:10:24 PDT 2007
Author: void
Date: Fri Sep 7 03:10:23 2007
New Revision: 41760
URL: http://llvm.org/viewvc/llvm-project?rev=41760&view=rev
Log:
A variable that's constant in a constructor shouldn't make the
constructor itself non-constant.
Modified:
llvm-gcc-4.0/trunk/gcc/c-typeck.c
Modified: llvm-gcc-4.0/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-typeck.c?rev=41760&r1=41759&r2=41760&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-typeck.c Fri Sep 7 03:10:23 2007
@@ -6157,8 +6157,14 @@
if (value == error_mark_node)
constructor_erroneous = 1;
- else if (!TREE_CONSTANT (value))
- constructor_constant = 0;
+ else if (!(TREE_CONSTANT (value)
+ || (DECL_P (value)
+ && DECL_INITIAL (value)
+ && DECL_INITIAL (value) != error_mark_node
+ && ! TREE_THIS_VOLATILE (value)
+ && ! TYPE_P (DECL_INITIAL (value))
+ && TREE_CONSTANT (DECL_INITIAL (value)))))
+ constructor_constant = 0;
else if (!initializer_constant_valid_p (value, TREE_TYPE (value))
|| ((TREE_CODE (constructor_type) == RECORD_TYPE
|| TREE_CODE (constructor_type) == UNION_TYPE)
More information about the llvm-commits
mailing list