This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR45109


This fixes PR45109 similar to how it was fixed on trunk.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  I will
install the testcase to trunk as well and the patch to the
4.5 branch where the issue is latent after testing finished there.

Richard.

2010-08-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45109
	* tree-ssa-structalias.c (get_constraint_for_component_ref):
	Explicitly strip handled components and indirect references.

	* gcc.c-torture/compile/pr45109.c: New testcase.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 162997)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** get_constraint_for_component_ref (tree t
*** 2928,2934 ****
    /* Some people like to do cute things like take the address of
       &0->a.b */
    forzero = t;
!   while (!SSA_VAR_P (forzero) && !CONSTANT_CLASS_P (forzero))
      forzero = TREE_OPERAND (forzero, 0);
  
    if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
--- 2928,2935 ----
    /* Some people like to do cute things like take the address of
       &0->a.b */
    forzero = t;
!   while (handled_component_p (forzero)
! 	 || INDIRECT_REF_P (forzero))
      forzero = TREE_OPERAND (forzero, 0);
  
    if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
Index: gcc/testsuite/gcc.c-torture/compile/pr45109.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr45109.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr45109.c	(revision 0)
***************
*** 0 ****
--- 1,38 ----
+ struct o_fsm_t;
+ struct o_fsm_event_t;
+ 
+ typedef void (*fn_t) (struct o_fsm_t *,
+ 		      struct o_fsm_event_t const *);
+ 
+ struct o_fsm_state_t {
+     fn_t dispatch;
+ };
+ 
+ struct o_fsm_t {
+     fn_t dispatch;
+ };
+ 
+ extern struct o_fsm_state_t o_fsm_tran(struct o_fsm_t *fsm,
+ 				       struct o_fsm_state_t next_state);
+ static void plist_parser_state_start(struct o_fsm_t *fsm,
+ 				     struct o_fsm_event_t const *fsm_event);
+ 
+ struct o_fsm_state_t o_fsm_state(fn_t dispatch_fcn)
+ {
+   return *(struct o_fsm_state_t *)&dispatch_fcn;
+ }
+ 
+ typedef struct _o_plist_parser_t {
+     struct o_fsm_t fsm;
+ } o_plist_parser_t;
+ 
+ static void plist_parser_state_start(struct o_fsm_t *fsm,
+ 				     struct o_fsm_event_t const *fsm_event)
+ {
+ }
+ 
+ void o_plist_deserialize_xml(int fin)
+ {
+   o_plist_parser_t parser;
+   o_fsm_tran(&parser.fsm, o_fsm_state(plist_parser_state_start));
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]