aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-09-04 19:36:49 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-09-04 17:36:49 +0000
commit17f39a395648213a0c6014e84ff34f3ff565a10b (patch)
tree57771775ce3d663de352f64104a3e0370a61a56f /gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c
parent5f7ae6b656d4468b1f2ebf3f773e494c7d147624 (diff)
downloadgcc-17f39a395648213a0c6014e84ff34f3ff565a10b.zip
gcc-17f39a395648213a0c6014e84ff34f3ff565a10b.tar.gz
gcc-17f39a395648213a0c6014e84ff34f3ff565a10b.tar.bz2
foldconst-2.c: New testcase.
* gcc.dg/tree-ssa/foldconst-2.c: New testcase. * gcc.dg/tree-ssa/foldconst-3.c: New testcase. * gimple-fold.c (maybe_fold_reference): Use fold_const_aggregate_ref. * tree-ssa-ccp.c (fold_const_aggregate_ref): Use fold_read_from_constant_string. * gimple.h (canonicalize_constructor_val): Declare. * gimple-fold.c (canonicalize_constructor_val): New function. (get_symbol_constant_value):Use it. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. From-SVN: r163861
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c b/gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c
new file mode 100644
index 0000000..8fdad90
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/foldconst-2.c
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+typedef union tree_node *tree;
+enum tree_code
+{
+ OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, POINTER_TYPE, FIXED_POINT_TYPE,
+};
+struct tree_base
+{
+ unsigned public_flag:1;
+};
+struct tree_decl_with_vis
+{
+ unsigned comdat_flag:1;
+};
+union tree_node
+{
+ struct tree_base base;
+ struct tree_decl_with_vis decl_with_vis;
+};
+enum tree_index
+{
+ TI_LONG_DOUBLE_PTR_TYPE, TI_INTEGER_PTR_TYPE, TI_VOID_TYPE, TI_PTR_TYPE,
+ TI_VA_LIST_FPR_COUNTER_FIELD, TI_BOOLEAN_TYPE, TI_FILEPTR_TYPE,
+ TI_CURRENT_TARGET_PRAGMA, TI_CURRENT_OPTIMIZE_PRAGMA, TI_MAX
+};
+extern tree global_trees[TI_MAX];
+emit_support_tinfos (void)
+{
+ static tree *const fundamentals[] = {
+ &global_trees[TI_VOID_TYPE], &global_trees[TI_BOOLEAN_TYPE],
+ };
+ int ix;
+ for (ix = 0; fundamentals[ix]; ix++)
+ {
+ {
+ tree tinfo;
+ {
+ ((void) (!(((tinfo)->base.public_flag) && !(__extension__ (
+ {
+ __typeof
+ (tinfo)
+ __t
+ =
+ (tinfo);
+ __t;}
+ )->decl_with_vis.
+ comdat_flag)) ?
+ fancy_abort ("../../gcc/cp/rtti.c", 1529,
+ __FUNCTION__), 0 : 0));
+ }
+ }
+ }
+}
+/* We should copy loop header to fundamentals[0] and then fold it way into
+ known value. */
+/* { dg-final { scan-tree-dump-not "fundamentals.0" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */