aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2007-07-10 23:08:52 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2007-07-10 23:08:52 +0000
commit837edd5f118f0c094fa52e5cb9ca2a299a5b1d5c (patch)
tree4b25914785f1c180a9b1d207bac7c0dc0a43c6bb /gcc/java/class.c
parent55f0dee2ea7701b0ae5241d2f76eea602774a223 (diff)
downloadgcc-837edd5f118f0c094fa52e5cb9ca2a299a5b1d5c.zip
gcc-837edd5f118f0c094fa52e5cb9ca2a299a5b1d5c.tar.gz
gcc-837edd5f118f0c094fa52e5cb9ca2a299a5b1d5c.tar.bz2
re PR bootstrap/32617 (explow.c references DECL_ALIGN of a FUNCTION_DECL)
2007-07-09 Geoffrey Keating <geoffk@apple.com> PR 32617 * c-common.c (c_alignof_expr): Look at DECL_ALIGN of FUNCTION_DECLs. (handle_aligned_attribute): Allow use on FUNCTION_DECLs. * varasm.c (assemble_start_function): Honor DECL_ALIGN for FUNCTION_DECLs. Don't use align_functions_log if DECL_USER_ALIGN. * print-tree.c (print_node): Print DECL_ALIGN and DECL_USER_ALIGN even for FUNCTION_DECLs. * c-decl.c (merge_decls): Propagate DECL_ALIGN even for FUNCTION_DECLs. * tree.h (DECL_ALIGN): Update for new location of 'align'. (DECL_FUNCTION_CODE): Update for new location and name of 'function_code'. (DECL_OFFSET_ALIGN): Update for new location of 'off_align'. (struct tree_decl_common): Move 'align' and 'off_align' out of union, ensure they're still on a 32-bit boundary. Remove other fields in union 'u1'. (struct tree_function_decl): Add field 'function_code' replacing 'u1.f' in tree_decl_common. * tree.c (build_decl_stat): Set initial value of DECL_ALIGN. * doc/extend.texi (Function Attributes): Add 'aligned' attribute. (Variable Attributes): Cross-reference 'aligned' attribute to Function Attributes. * flags.h (force_align_functions_log): Delete. * toplev.c (force_align_functions_log): Delete. Index: gcc/testsuite/ChangeLog 2007-07-09 Geoffrey Keating <geoffk@apple.com> PR 32617 * gcc.c-torture/execute/align-3.c: New. Index: gcc/java/ChangeLog 2007-07-09 Geoffrey Keating <geoffk@apple.com> PR 32617 * lang.c (java_init): Remove setting of force_align_functions_log. * class.c (add_method_1): Set DECL_ALIGN of non-static method to cope with ptrmemfunc_vbit_in_pfn. Index: gcc/cp/ChangeLog 2007-07-09 Geoffrey Keating <geoffk@apple.com> PR 32617 * decl.c (cxx_init_decl_processing): Don't set force_align_functions_log. (grokfndecl): Honour ptrmemfunc_vbit_in_pfn. * typeck.c (cxx_alignof_expr): When alignof is used on a plain FUNCTION_DECL, return its alignment. From-SVN: r126529
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 3d43726..bbfe4f2 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -725,6 +725,14 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
TREE_CHAIN (fndecl) = TYPE_METHODS (this_class);
TYPE_METHODS (this_class) = fndecl;
+ /* If pointers to member functions use the least significant bit to
+ indicate whether a function is virtual, ensure a pointer
+ to this function will have that bit clear. */
+ if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
+ && !(access_flags & ACC_STATIC)
+ && DECL_ALIGN (fndecl) < 2 * BITS_PER_UNIT)
+ DECL_ALIGN (fndecl) = 2 * BITS_PER_UNIT;
+
/* Notice that this is a finalizer and update the class type
accordingly. This is used to optimize instance allocation. */
if (name == finalize_identifier_node