File nvl423594.patch of Package gcc43
Index: gcc/tree-gimple.h
===================================================================
--- gcc/tree-gimple.h.orig 2008-02-19 10:55:59.000000000 +0100
+++ gcc/tree-gimple.h 2009-11-20 13:50:36.000000000 +0100
@@ -119,6 +119,7 @@ extern void gimplify_body (tree *, tree,
extern void push_gimplify_context (void);
extern void pop_gimplify_context (tree);
extern void gimplify_and_add (tree, tree *);
+extern void force_gimplify_and_add (tree, tree *);
/* Miscellaneous helpers. */
extern void gimple_add_tmp_var (tree);
Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c.orig 2009-11-20 13:50:29.000000000 +0100
+++ gcc/gimplify.c 2009-11-20 13:50:36.000000000 +0100
@@ -6751,4 +6751,20 @@ force_gimple_operand_bsi (block_stmt_ite
return expr;
}
+void
+force_gimplify_and_add (tree stmt, tree *list)
+{
+ tree t;
+ push_gimplify_context ();
+ gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
+ gimplify_ctxp->allow_rhs_cond_expr = true;
+ gimplify_and_add (stmt, list);
+ if (gimple_referenced_vars (cfun))
+ {
+ for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
+ add_referenced_var (t);
+ }
+ pop_gimplify_context (NULL);
+}
+
#include "gt-gimplify.h"
Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c.orig 2009-01-07 11:02:13.000000000 +0100
+++ gcc/tree-sra.c 2009-11-20 13:50:36.000000000 +0100
@@ -2186,7 +2186,7 @@ sra_build_assignment (tree dst, tree src
stmt = build_gimple_modify_stmt (stmp,
fold_build1 (VIEW_CONVERT_EXPR,
stype, var));
- append_to_statement_list (stmt, &list);
+ force_gimplify_and_add (stmt, &list);
var = stmp;
}
Index: gcc/testsuite/gcc.c-torture/compile/nvl423594.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.c-torture/compile/nvl423594.c 2009-11-20 13:50:36.000000000 +0100
@@ -0,0 +1,16 @@
+void Deactivate(void);
+typedef struct {
+ char ctype;
+ char action;
+ short options;
+} pwdStatus_t;
+void getCredentials(char *buffer)
+{
+ pwdStatus_t SessionSt;
+ int pst = 0;
+ __builtin_memset(&SessionSt,0,sizeof(SessionSt));
+ __builtin_memcpy(&pst,buffer,sizeof(pwdStatus_t));
+ __builtin_memcpy(&SessionSt, &pst, sizeof(pwdStatus_t));
+ Deactivate();
+}
+