From ea028b590cba888d909410be1c0f725c7b159cdf Mon Sep 17 00:00:00 2001 From: pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 26 Sep 2006 15:36:21 +0000 Subject: [PATCH] 2006-09-26 Andrew Pinski <pinskia@physics.uc.edu> PR objc/29195 * objc-act.c (objc_push_parm): If we change the type of the decl, relayout the decl. 2006-09-26 Andrew Pinski <pinskia@physics.uc.edu> PR objc/29195 * objc/compile/method-1.m: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117229 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/objc/ChangeLog | 6 ++++++ gcc/objc/objc-act.c | 15 +++++++++++++-- gcc/testsuite/ChangeLog | 25 +++++++++++++++---------- gcc/testsuite/objc/compile/method-1.m | 12 ++++++++++++ 4 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/objc/compile/method-1.m diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index ec777a64ac06..df8a5872220c 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,9 @@ +2006-09-26 Andrew Pinski <pinskia@physics.uc.edu> + + PR objc/29195 + * objc-act.c (objc_push_parm): If we change the type of the + decl, relayout the decl. + 2006-09-19 Eric Christopher <echristo@apple.com> * objc-act.c (JBLEN): Rename to OBJC_JBLEN, diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 7ac785f53909..1d3513b6a58f 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -8223,11 +8223,22 @@ static GTY(()) tree objc_parmlist = NULL_TREE; static void objc_push_parm (tree parm) { + bool relayout_needed = false; /* Decay arrays and functions into pointers. */ if (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE) - TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (TREE_TYPE (parm))); + { + TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (TREE_TYPE (parm))); + relayout_needed = true; + } else if (TREE_CODE (TREE_TYPE (parm)) == FUNCTION_TYPE) - TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (parm)); + { + TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (parm)); + relayout_needed = true; + } + + if (relayout_needed) + relayout_decl (parm); + DECL_ARG_TYPE (parm) = lang_hooks.types.type_promotes_to (TREE_TYPE (parm)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fc16e5f23df..b196528b8206 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,18 +1,23 @@ +2006-09-26 Andrew Pinski <pinskia@physics.uc.edu> + + PR objc/29195 + * objc/compile/method-1.m: New test. + 2006-09-25 Lee Millward <lee.millward@codesourcery.com> - PR c++/26938 - * g++.dg/template/crash58.C: New test. - * g++.dg/parse/crash28.C: Adjust error markers. - * g++.dg/template/crash34.C: Likewise. - * g++.dg/template/friend31.C: Likewise. - * g++.dg/template/crash32.C: Likewise. + PR c++/26938 + * g++.dg/template/crash58.C: New test. + * g++.dg/parse/crash28.C: Adjust error markers. + * g++.dg/template/crash34.C: Likewise. + * g++.dg/template/friend31.C: Likewise. + * g++.dg/template/crash32.C: Likewise. - PR c++/27329 - * g++.dg/template/crash59.C: New test. + PR c++/27329 + * g++.dg/template/crash59.C: New test. PR c++/27667 - * g++.dg/template/spec33.C: New test. - * g++.old-deja/g++.pt/spec20.C: Adjust error markers. + * g++.dg/template/spec33.C: New test. + * g++.old-deja/g++.pt/spec20.C: Adjust error markers. 2006-09-24 Zdenek Dvorak <dvorakz@suse.cz> Adam Nemet <anemet@caviumnetworks.com> diff --git a/gcc/testsuite/objc/compile/method-1.m b/gcc/testsuite/objc/compile/method-1.m new file mode 100644 index 000000000000..e9bb989bef6d --- /dev/null +++ b/gcc/testsuite/objc/compile/method-1.m @@ -0,0 +1,12 @@ +/* PR objc/29195 */ +/* Test that array decls are changed to a pointer type + correctly and make sure we don't crash because the + decl was not relayed out. */ + +@ implementation NGActiveSocket ++ (void) socketPair:(int [2]) + _pair +{ + _pair[0] = 0; +} +@end -- GitLab