From 25a164d401975fb130aea968accabaaa2e9bb5ec Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 28 Feb 2008 10:49:42 +0000 Subject: svn merge -r132546:132742 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_3-branch/ git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_3-branch@132743 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 59 +++++++ gcc/DATESTAMP | 2 +- gcc/Makefile.in | 8 +- gcc/config/cris/cris.h | 1 + gcc/config/darwin-ppc-ldouble-patch.def | 94 ++++++++++ gcc/config/darwin-protos.h | 1 + gcc/config/darwin.c | 43 +++++ gcc/config/i386/netware-libgcc.exp | 9 + gcc/config/i386/netware.c | 191 +++++++++++++-------- gcc/config/i386/netware.h | 24 ++- gcc/config/rs6000/darwin.h | 3 + gcc/config/rs6000/eabispe.h | 2 +- gcc/config/rs6000/linuxspe.h | 2 +- gcc/config/rs6000/rs6000.c | 4 + gcc/cp/ChangeLog | 15 ++ gcc/cp/Make-lang.in | 2 +- gcc/cp/decl.c | 5 + gcc/cp/rtti.c | 37 ++-- gcc/fold-const.c | 17 +- gcc/fortran/ChangeLog | 12 ++ gcc/fortran/f95-lang.c | 6 + gcc/fortran/trans-decl.c | 27 --- gcc/fortran/trans-expr.c | 8 +- gcc/fortran/trans.h | 4 - gcc/testsuite/ChangeLog | 70 ++++++++ gcc/testsuite/g++.dg/ext/always_inline-1.C | 26 +++ gcc/testsuite/g++.dg/ext/always_inline-2.C | 26 +++ gcc/testsuite/g++.dg/ext/always_inline-3.C | 26 +++ gcc/testsuite/g++.dg/ext/always_inline-4.C | 20 +++ gcc/testsuite/g++.dg/ext/visibility/typeinfo2.C | 23 +++ gcc/testsuite/g++.dg/ext/visibility/typeinfo3.C | 24 +++ gcc/testsuite/gcc.c-torture/execute/pr34971.c | 22 +++ gcc/testsuite/gcc.c-torture/execute/pr35390.c | 13 ++ gcc/testsuite/gcc.dg/bf-ms-attrib.c | 1 + gcc/testsuite/gcc.dg/builtins-config.h | 2 + .../gcc.dg/debug/dwarf2/aranges-fnsec-1.c | 2 +- gcc/testsuite/gcc.dg/pthread-init-1.c | 1 + gcc/testsuite/gcc.dg/pthread-init-2.c | 1 + gcc/testsuite/gcc.target/i386/mmx-4.c | 4 + gcc/testsuite/gcc.target/i386/pr25993.c | 2 +- gcc/testsuite/gcc.target/i386/sse-6.c | 4 + gcc/testsuite/gfortran.dg/large_real_kind_2.F90 | 2 - gcc/testsuite/gfortran.dg/large_real_kind_3.F90 | 24 +++ .../gfortran.dg/large_real_kind_form_io_2.f90 | 2 +- gcc/testsuite/lib/target-supports.exp | 13 ++ 45 files changed, 743 insertions(+), 141 deletions(-) create mode 100644 gcc/config/darwin-ppc-ldouble-patch.def create mode 100644 gcc/testsuite/g++.dg/ext/always_inline-1.C create mode 100644 gcc/testsuite/g++.dg/ext/always_inline-2.C create mode 100644 gcc/testsuite/g++.dg/ext/always_inline-3.C create mode 100644 gcc/testsuite/g++.dg/ext/always_inline-4.C create mode 100644 gcc/testsuite/g++.dg/ext/visibility/typeinfo2.C create mode 100644 gcc/testsuite/g++.dg/ext/visibility/typeinfo3.C create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr34971.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr35390.c create mode 100644 gcc/testsuite/gfortran.dg/large_real_kind_3.F90 (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acad0552e9c..37b985a8741 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,62 @@ +2008-02-28 Uros Bizjak + + Backport from mainline: + 2008-02-25 Francois-Xavier Coudert + Uros Bizjak + + PR target/25477 + * gcc/config/darwin-protos.h: Add darwin_patch_builtins prototype. + * gcc/config/darwin-ppc-ldouble-patch.def: New file. + * gcc/config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): New macro. + * gcc/config/rs6000/rs6000.c (rs6000_init_builtins): Call + SUBTARGET_INIT_BUILTINS if defined. + * gcc/config/darwin.c (darwin_patch_builtin, + darwin_patch_builtins): New functions. + +2008-02-27 Richard Guenther + + Backport from mainline: + 2008-02-27 Richard Guenther + + PR middle-end/35390 + * fold-const.c (fold_unary): Return the correct argument, + converted to the result type. + + PR middle-end/34971 + * fold-const.c (fold_binary): Use the types precision, not the + bitsize of the mode if folding rotate expressions. Build rotates + only for full modes. + +2008-02-25 Jan Beulich + + * Makefile.in: Also prefix uses of crt0.o and mcrt0.o with $(T). + * config/i386/netware-libgcc.exp: Add __bswap?i2, + __emultls_get_address, __emultls_register_common, + __floatundi?f, and _Unwind_GetIPInfo. + * config/i386/netware.c (gen_stdcall_or_fastcall_decoration): + Sync with config/i386/winnt.c:gen_stdcall_or_fastcall_suffix(). + (gen_regparm_prefix): Likewise. + (i386_nlm_encode_section_info): Sync with + config/i386/winnt.c:i386_pe_encode_section_info(). + (i386_nlm_maybe_mangle_decl_assembler_name): New. + i386_nlm_mangle_decl_assembler_name): New. + (netware_override_options): New. + * config/i386/netware.h (netware_override_options): Declare. + (OVERRIDE_OPTIONS): Re-define to netware_override_options. + (i386_nlm_mangle_decl_assembler_name): Declare. + (TARGET_MANGLE_DECL_ASSEMBLER_NAME): Define. + +2008-02-22 Nathan Froyd + + * config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): + Use spe_abi. + * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Likewise. + +2008-02-22 Hans-Peter Nilsson + + * config/cris/cris.h (REG_CLASS_FROM_LETTER): Recognize 'b' for + GENNONACR_REGS. + 2008-02-21 Janis Johnson PR target/34526 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d8470ee4d38..3fa410d0bf0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20080222 +20080228 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a87e3bb663e..486a8111991 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1697,14 +1697,14 @@ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \ # Compile the start modules crt0.o and mcrt0.o that are linked with # every program -crt0.o: s-crt0 ; @true -mcrt0.o: s-crt0; @true +$(T)crt0.o: s-crt0 ; @true +$(T)mcrt0.o: s-crt0; @true s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ - -o crt0.o -c $(CRT0_S) + -o $(T)crt0.o -c $(CRT0_S) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ - -o mcrt0.o -c $(MCRT0_S) + -o $(T)mcrt0.o -c $(MCRT0_S) $(STAMP) s-crt0 # # Compiling object files from source files. diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 9e59b88216b..b8f4ae56713 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -600,6 +600,7 @@ enum reg_class #define REG_CLASS_FROM_LETTER(C) \ ( \ (C) == 'a' ? ACR_REGS : \ + (C) == 'b' ? GENNONACR_REGS : \ (C) == 'h' ? MOF_REGS : \ (C) == 'x' ? SPECIAL_REGS : \ (C) == 'c' ? CC0_REGS : \ diff --git a/gcc/config/darwin-ppc-ldouble-patch.def b/gcc/config/darwin-ppc-ldouble-patch.def new file mode 100644 index 00000000000..fa360f8b745 --- /dev/null +++ b/gcc/config/darwin-ppc-ldouble-patch.def @@ -0,0 +1,94 @@ +PATCH_BUILTIN (BUILT_IN_ACOSHL) +PATCH_BUILTIN (BUILT_IN_ACOSL) +PATCH_BUILTIN (BUILT_IN_ASINHL) +PATCH_BUILTIN (BUILT_IN_ASINL) +PATCH_BUILTIN (BUILT_IN_ATAN2L) +PATCH_BUILTIN (BUILT_IN_ATANHL) +PATCH_BUILTIN (BUILT_IN_ATANL) +PATCH_BUILTIN (BUILT_IN_CABSL) +PATCH_BUILTIN (BUILT_IN_CACOSHL) +PATCH_BUILTIN (BUILT_IN_CACOSL) +PATCH_BUILTIN (BUILT_IN_CARGL) +PATCH_BUILTIN (BUILT_IN_CASINHL) +PATCH_BUILTIN (BUILT_IN_CASINL) +PATCH_BUILTIN (BUILT_IN_CATANHL) +PATCH_BUILTIN (BUILT_IN_CATANL) +PATCH_BUILTIN (BUILT_IN_CBRTL) +PATCH_BUILTIN (BUILT_IN_CCOSHL) +PATCH_BUILTIN (BUILT_IN_CCOSL) +PATCH_BUILTIN (BUILT_IN_CEILL) +PATCH_BUILTIN (BUILT_IN_CEXPL) +PATCH_BUILTIN (BUILT_IN_CIMAGL) +PATCH_BUILTIN (BUILT_IN_CLOGL) +PATCH_BUILTIN (BUILT_IN_CONJL) +PATCH_BUILTIN (BUILT_IN_COPYSIGNL) +PATCH_BUILTIN (BUILT_IN_COSHL) +PATCH_BUILTIN (BUILT_IN_COSL) +PATCH_BUILTIN (BUILT_IN_CPOWL) +PATCH_BUILTIN (BUILT_IN_CPROJL) +PATCH_BUILTIN (BUILT_IN_CREALL) +PATCH_BUILTIN (BUILT_IN_CSINHL) +PATCH_BUILTIN (BUILT_IN_CSINL) +PATCH_BUILTIN (BUILT_IN_CSQRTL) +PATCH_BUILTIN (BUILT_IN_CTANHL) +PATCH_BUILTIN (BUILT_IN_CTANL) +PATCH_BUILTIN (BUILT_IN_ERFCL) +PATCH_BUILTIN (BUILT_IN_ERFL) +PATCH_BUILTIN (BUILT_IN_EXP2L) +PATCH_BUILTIN (BUILT_IN_EXPL) +PATCH_BUILTIN (BUILT_IN_EXPM1L) +PATCH_BUILTIN (BUILT_IN_FABSL) +PATCH_BUILTIN (BUILT_IN_FDIML) +PATCH_BUILTIN (BUILT_IN_FLOORL) +PATCH_BUILTIN (BUILT_IN_FMAL) +PATCH_BUILTIN (BUILT_IN_FMAXL) +PATCH_BUILTIN (BUILT_IN_FMINL) +PATCH_BUILTIN (BUILT_IN_FMODL) +PATCH_BUILTIN (BUILT_IN_FREXPL) +PATCH_BUILTIN (BUILT_IN_HYPOTL) +PATCH_BUILTIN (BUILT_IN_ILOGBL) +PATCH_BUILTIN (BUILT_IN_LDEXPL) +PATCH_BUILTIN (BUILT_IN_LGAMMAL) +PATCH_BUILTIN (BUILT_IN_LLRINTL) +PATCH_BUILTIN (BUILT_IN_LLROUNDL) +PATCH_BUILTIN (BUILT_IN_LOG10L) +PATCH_BUILTIN (BUILT_IN_LOG1PL) +PATCH_BUILTIN (BUILT_IN_LOG2L) +PATCH_BUILTIN (BUILT_IN_LOGBL) +PATCH_BUILTIN (BUILT_IN_LOGL) +PATCH_BUILTIN (BUILT_IN_LRINTL) +PATCH_BUILTIN (BUILT_IN_LROUNDL) +PATCH_BUILTIN (BUILT_IN_MODFL) +PATCH_BUILTIN (BUILT_IN_NEARBYINTL) +PATCH_BUILTIN (BUILT_IN_NEXTAFTERL) +PATCH_BUILTIN (BUILT_IN_NEXTTOWARDL) +PATCH_BUILTIN (BUILT_IN_POWL) +PATCH_BUILTIN (BUILT_IN_REMAINDERL) +PATCH_BUILTIN (BUILT_IN_REMQUOL) +PATCH_BUILTIN (BUILT_IN_RINTL) +PATCH_BUILTIN (BUILT_IN_ROUNDL) +PATCH_BUILTIN (BUILT_IN_SCALBLNL) +PATCH_BUILTIN (BUILT_IN_SCALBNL) +PATCH_BUILTIN (BUILT_IN_SINHL) +PATCH_BUILTIN (BUILT_IN_SINL) +PATCH_BUILTIN (BUILT_IN_SQRTL) +PATCH_BUILTIN (BUILT_IN_TANHL) +PATCH_BUILTIN (BUILT_IN_TANL) +PATCH_BUILTIN (BUILT_IN_TGAMMAL) +PATCH_BUILTIN (BUILT_IN_TRUNCL) + +PATCH_BUILTIN_NO64 (BUILT_IN_VFPRINTF) +PATCH_BUILTIN_NO64 (BUILT_IN_VFSCANF) +PATCH_BUILTIN_NO64 (BUILT_IN_VPRINTF) +PATCH_BUILTIN_NO64 (BUILT_IN_VSCANF) +PATCH_BUILTIN_NO64 (BUILT_IN_VSNPRINTF) +PATCH_BUILTIN_NO64 (BUILT_IN_VSPRINTF) +PATCH_BUILTIN_NO64 (BUILT_IN_VSSCANF) + +PATCH_BUILTIN_VARIADIC (BUILT_IN_FPRINTF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_FSCANF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_PRINTF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_SCANF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_SNPRINTF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_SPRINTF) +PATCH_BUILTIN_VARIADIC (BUILT_IN_SSCANF) diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index a8ce17c0111..c894bf05104 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -89,3 +89,4 @@ extern void darwin_cpp_builtins (struct cpp_reader *); extern void darwin_asm_output_anchor (rtx symbol); extern bool darwin_kextabi_p (void); extern void darwin_override_options (void); +extern void darwin_patch_builtins (void); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 307698d095f..6a7e0fdc638 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1735,4 +1735,47 @@ darwin_override_options (void) flag_var_tracking_uninit = 1; } +/* Add $LDBL128 suffix to long double builtins. */ + +static void +darwin_patch_builtin (int fncode) +{ + tree fn = built_in_decls[fncode]; + tree sym; + char *newname; + + if (!fn) + return; + + sym = DECL_ASSEMBLER_NAME (fn); + newname = ACONCAT (("_", IDENTIFIER_POINTER (sym), "$LDBL128", NULL)); + + set_user_assembler_name (fn, newname); + + fn = implicit_built_in_decls[fncode]; + if (fn) + set_user_assembler_name (fn, newname); +} + +void +darwin_patch_builtins (void) +{ + if (LONG_DOUBLE_TYPE_SIZE != 128) + return; + +#define PATCH_BUILTIN(fncode) darwin_patch_builtin (fncode); +#define PATCH_BUILTIN_NO64(fncode) \ + if (!TARGET_64BIT) \ + darwin_patch_builtin (fncode); +#define PATCH_BUILTIN_VARIADIC(fncode) \ + if (!TARGET_64BIT \ + && (strverscmp (darwin_macosx_version_min, "10.3.9") >= 0)) \ + darwin_patch_builtin (fncode); +#include "darwin-ppc-ldouble-patch.def" +#undef PATCH_BUILTIN +#undef PATCH_BUILTIN_NO64 +#undef PATCH_BUILTIN_VARIADIC +} + + #include "gt-darwin.h" diff --git a/gcc/config/i386/netware-libgcc.exp b/gcc/config/i386/netware-libgcc.exp index a3498c0e720..309cf754943 100644 --- a/gcc/config/i386/netware-libgcc.exp +++ b/gcc/config/i386/netware-libgcc.exp @@ -6,6 +6,8 @@ __addvsi3, # __ashldi3, # __ashrdi3, + __bswapdi2, + __bswapsi2, __clzdi2, __clzsi2, __ctzdi2, @@ -18,12 +20,18 @@ __divsc3, # __divtc3, __divxc3, + __emutls_get_address, + __emutls_register_common, __ffsdi2, __ffssi2, __fixunsdfdi, __fixunssfdi, # __fixunstfdi, __fixunsxfdi, + __floatundisf, + __floatundidf, +# __floatunditf, + __floatundixf, __gcc_bcmp, __gcc_personality_v0, # __lshrdi3, @@ -64,6 +72,7 @@ _Unwind_GetDataRelBase, _Unwind_GetGR, _Unwind_GetIP, + _Unwind_GetIPInfo, _Unwind_GetLanguageSpecificData, _Unwind_GetRegionStart, _Unwind_GetTextRelBase, diff --git a/gcc/config/i386/netware.c b/gcc/config/i386/netware.c index 0357baff169..63c26cc7551 100644 --- a/gcc/config/i386/netware.c +++ b/gcc/config/i386/netware.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for NetWare. Contributed by Jan Beulich (jbeulich@novell.com) - Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -32,28 +32,25 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "ggc.h" - -/* Return string which is the former assembler name modified with an - underscore prefix and a suffix consisting of an atsign (@) followed - by the number of bytes of arguments */ +/* Return string which is the function name, identified by ID, modified + with PREFIX and a suffix consisting of an atsign (@) followed by the + number of bytes of arguments. If ID is NULL use the DECL_NAME as base. + Return NULL if no change required. */ static tree -gen_stdcall_or_fastcall_decoration (tree decl, char prefix) +gen_stdcall_or_fastcall_decoration (tree decl, tree id, char prefix) { - unsigned total = 0; - /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead - of DECL_ASSEMBLER_NAME. */ - const char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - char *newsym; + unsigned HOST_WIDE_INT total = 0; + const char *old_str = IDENTIFIER_POINTER (id != NULL_TREE ? id : DECL_NAME (decl)); + char *new_str; tree type = TREE_TYPE (decl); - tree arg; - function_args_iterator args_iter; if (prototype_p (type)) { - /* These attributes are ignored for variadic functions in - i386.c:ix86_return_pops_args. For compatibility with MS - compiler do not add @0 suffix here. */ + tree arg; + function_args_iterator args_iter; + + /* This attribute is ignored for variadic functions. */ if (stdarg_p (type)) return NULL_TREE; @@ -61,50 +58,50 @@ gen_stdcall_or_fastcall_decoration (tree decl, char prefix) by convert_arguments in c-typeck.c or cp/typeck.c. */ FOREACH_FUNCTION_ARGS(type, arg, args_iter) { - unsigned parm_size; + HOST_WIDE_INT parm_size; + unsigned HOST_WIDE_INT parm_boundary_bytes; if (! COMPLETE_TYPE_P (arg)) break; - parm_size = int_size_in_bytes (TYPE_SIZE (arg)); + parm_size = int_size_in_bytes (arg); if (parm_size < 0) break; + parm_boundary_bytes = PARM_BOUNDARY / BITS_PER_UNIT; + /* Must round up to include padding. This is done the same way as in store_one_arg. */ - parm_size = ((parm_size + PARM_BOUNDARY - 1) - / PARM_BOUNDARY * PARM_BOUNDARY); - total += parm_size; + total += (parm_size + parm_boundary_bytes - 1) + / parm_boundary_bytes * parm_boundary_bytes; } } - newsym = alloca (1 + strlen (asmname) + 1 + 10 + 1); - return get_identifier_with_length (newsym, - sprintf (newsym, - "%c%s@%u", - prefix, - asmname, - total / BITS_PER_UNIT)); + new_str = alloca (1 + strlen (old_str) + 1 + 10 + 1); + sprintf (new_str, "%c%s@" HOST_WIDE_INT_PRINT_UNSIGNED, + prefix, old_str, total); + + return get_identifier (new_str); } -/* Return string which is the former assembler name modified with an - _n@ prefix where n represents the number of arguments passed in - registers */ +/* Return string which is the function name, identified by ID, modified + with an _n@ prefix (where n represents the number of arguments passed in + registers). If ID is NULL use the DECL_NAME as base. + Return NULL if no change required. */ static tree -gen_regparm_prefix (tree decl, unsigned nregs) +gen_regparm_prefix (tree decl, tree id, unsigned int nregs) { - unsigned total = 0; - /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead - of DECL_ASSEMBLER_NAME. */ - const char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - char *newsym; + unsigned HOST_WIDE_INT total = 0; + const char *old_str = IDENTIFIER_POINTER (id != NULL_TREE ? id : DECL_NAME (decl)); + char *new_str; tree type = TREE_TYPE (decl); - tree arg; - function_args_iterator args_iter; if (prototype_p (type)) { + tree arg; + function_args_iterator args_iter; + /* This attribute is ignored for variadic functions. */ if (stdarg_p (type)) return NULL_TREE; @@ -113,7 +110,8 @@ gen_regparm_prefix (tree decl, unsigned nregs) by convert_arguments in c-typeck.c or cp/typeck.c. */ FOREACH_FUNCTION_ARGS(type, arg, args_iter) { - unsigned parm_size; + HOST_WIDE_INT parm_size; + unsigned HOST_WIDE_INT parm_boundary_bytes; if (! COMPLETE_TYPE_P (arg)) break; @@ -122,21 +120,58 @@ gen_regparm_prefix (tree decl, unsigned nregs) if (parm_size < 0) break; - parm_size = ((parm_size + PARM_BOUNDARY - 1) - / PARM_BOUNDARY * PARM_BOUNDARY); - total += parm_size; + parm_boundary_bytes = PARM_BOUNDARY / BITS_PER_UNIT; + + /* Must round up to include padding. This is done the same + way as in store_one_arg. */ + total += (parm_size + parm_boundary_bytes - 1) + / parm_boundary_bytes * parm_boundary_bytes; } } - if (nregs > total / BITS_PER_WORD) - nregs = total / BITS_PER_WORD; + if (nregs > total / UNITS_PER_WORD) + nregs = total / UNITS_PER_WORD; gcc_assert (nregs <= 9); - newsym = alloca (3 + strlen (asmname) + 1); - return get_identifier_with_length (newsym, - sprintf (newsym, - "_%u@%s", - nregs, - asmname)); + new_str = alloca (3 + strlen (old_str) + 1); + sprintf (new_str, "_%u@%s", nregs, old_str); + + return get_identifier (new_str); +} + +/* Maybe decorate and get a new identifier for the DECL of a stdcall or + fastcall function. The original identifier is supplied in ID. */ + +static tree +i386_nlm_maybe_mangle_decl_assembler_name (tree decl, tree id) +{ + tree type_attributes = TYPE_ATTRIBUTES (TREE_TYPE (decl)); + tree new_id; + + if (lookup_attribute ("stdcall", type_attributes)) + new_id = gen_stdcall_or_fastcall_decoration (decl, id, '_'); + else if (lookup_attribute ("fastcall", type_attributes)) + new_id = gen_stdcall_or_fastcall_decoration (decl, id, FASTCALL_PREFIX); + else if ((new_id = lookup_attribute ("regparm", type_attributes))) + new_id = gen_regparm_prefix (decl, id, + TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (new_id)))); + else + new_id = NULL_TREE; + + return new_id; +} + +/* This is used as a target hook to modify the DECL_ASSEMBLER_NAME + in the language-independent default hook + langhooks.c:lhd_set_decl_assembler_name () + and in cp/mangle.c:mangle_decl (). */ +tree +i386_nlm_mangle_decl_assembler_name (tree decl, tree id) +{ + tree new_id = TREE_CODE (decl) == FUNCTION_DECL + ? i386_nlm_maybe_mangle_decl_assembler_name (decl, id) + : NULL_TREE; + + return (new_id ? new_id : id); } void @@ -146,31 +181,28 @@ i386_nlm_encode_section_info (tree decl, rtx rtl, int first) if (first && TREE_CODE (decl) == FUNCTION_DECL + /* Do not change the identifier if a verbatim asmspec + or if stdcall suffix already added. */ && *IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)) != '*' && !strchr (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), '@')) { - tree type_attributes = TYPE_ATTRIBUTES (TREE_TYPE (decl)); - tree newid; - - if (lookup_attribute ("stdcall", type_attributes)) - newid = gen_stdcall_or_fastcall_decoration (decl, '_'); - else if (lookup_attribute ("fastcall", type_attributes)) - newid = gen_stdcall_or_fastcall_decoration (decl, FASTCALL_PREFIX); - else if ((newid = lookup_attribute ("regparm", type_attributes)) != NULL_TREE) - newid = gen_regparm_prefix (decl, - TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (newid)))); - if (newid != NULL_TREE) - { - rtx rtlname = XEXP (rtl, 0); + /* FIXME: In Ada, and perhaps other language frontends, + imported stdcall names may not yet have been modified. + Check and do it know. */ + rtx symbol = XEXP (rtl, 0); + tree new_id; + tree old_id = DECL_ASSEMBLER_NAME (decl); + + gcc_assert (GET_CODE (symbol) == SYMBOL_REF); - if (GET_CODE (rtlname) == MEM) - rtlname = XEXP (rtlname, 0); - XSTR (rtlname, 0) = IDENTIFIER_POINTER (newid); + if ((new_id = i386_nlm_maybe_mangle_decl_assembler_name (decl, old_id))) + { /* These attributes must be present on first declaration, change_decl_assembler_name will warn if they are added later and the decl has been referenced, but duplicate_decls - should catch the mismatch before this is called. */ - change_decl_assembler_name (decl, newid); + should catch the mismatch first. */ + change_decl_assembler_name (decl, new_id); + XSTR (symbol, 0) = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); } } } @@ -201,3 +233,24 @@ i386_nlm_strip_name_encoding (const char *str) } return name; } + +/* Sometimes certain combinations of command options do not make + sense on a particular target machine. You can define a macro + `OVERRIDE_OPTIONS' to take account of this. This macro, if + defined, is executed once just after all the command options have + been parsed. + + Don't use this macro to turn on various extra optimizations for + `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ + +void +netware_override_options (void) +{ + override_options (); + + if (flag_pic) + { + error ("-fPIC and -fpic are not supported for this target"); + flag_pic = 0; + } +} diff --git a/gcc/config/i386/netware.h b/gcc/config/i386/netware.h index e7459a2fe79..d4f31e0bbb2 100644 --- a/gcc/config/i386/netware.h +++ b/gcc/config/i386/netware.h @@ -72,6 +72,18 @@ along with GCC; see the file COPYING3. If not see #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | \ MASK_FLOAT_RETURNS | MASK_ALIGN_DOUBLE | MASK_MS_BITFIELD_LAYOUT) +/* Sometimes certain combinations of command options do not make + sense on a particular target machine. You can define a macro + `OVERRIDE_OPTIONS' to take account of this. This macro, if + defined, is executed once just after all the command options have + been parsed. + + Don't use this macro to turn on various extra optimizations for + `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ +#undef OVERRIDE_OPTIONS +extern void netware_override_options (void); +#define OVERRIDE_OPTIONS netware_override_options () + #undef MATH_LIBRARY #define MATH_LIBRARY "" @@ -142,13 +154,15 @@ along with GCC; see the file COPYING3. If not see function named by the symbol (such as what section it is in). On i386 running NetWare, modify the assembler name with an underscore (_) - prefix and a suffix consisting of an atsign (@) followed by a string of - digits that represents the number of bytes of arguments passed to the - function, if it has the attribute STDCALL. Alternatively, if it has the - REGPARM attribute, prefix it with an underscore (_), a digit representing - the number of registers used, and an atsign (@). */ + or atsign (@) prefix and a suffix consisting of an atsign (@) followed by + a string of digits that represents the number of bytes of arguments passed + to the function, if it has the attribute STDCALL. Alternatively, if it has + the REGPARM attribute, prefix it with an underscore (_), a digit + representing the number of registers used, and an atsign (@). */ void i386_nlm_encode_section_info (tree, rtx, int); +extern tree i386_nlm_mangle_decl_assembler_name (tree, tree); const char *i386_nlm_strip_name_encoding (const char *); #define SUBTARGET_ENCODE_SECTION_INFO i386_nlm_encode_section_info +#define TARGET_MANGLE_DECL_ASSEMBLER_NAME i386_nlm_mangle_decl_assembler_name #undef TARGET_STRIP_NAME_ENCODING #define TARGET_STRIP_NAME_ENCODING i386_nlm_strip_name_encoding diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 6c88757d24e..f6c9ee3c2e2 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -432,3 +432,6 @@ /* When generating kernel code or kexts, we don't use Altivec by default, as kernel code doesn't save/restore those registers. */ #define OS_MISSING_ALTIVEC (flag_mkernel || flag_apple_kext) + +/* Darwin has to rename some of the long double builtins. */ +#define SUBTARGET_INIT_BUILTINS darwin_patch_builtins () diff --git a/gcc/config/rs6000/eabispe.h b/gcc/config/rs6000/eabispe.h index 0acc17c7022..c3a3f2b4e53 100644 --- a/gcc/config/rs6000/eabispe.h +++ b/gcc/config/rs6000/eabispe.h @@ -31,7 +31,7 @@ #define SUBSUBTARGET_OVERRIDE_OPTIONS \ if (rs6000_select[1].string == NULL) \ rs6000_cpu = PROCESSOR_PPC8540; \ - if (!rs6000_explicit_options.abi) \ + if (!rs6000_explicit_options.spe_abi) \ rs6000_spe_abi = 1; \ if (!rs6000_explicit_options.float_gprs) \ rs6000_float_gprs = 1; \ diff --git a/gcc/config/rs6000/linuxspe.h b/gcc/config/rs6000/linuxspe.h index 1aea7442c54..c526cf8dce4 100644 --- a/gcc/config/rs6000/linuxspe.h +++ b/gcc/config/rs6000/linuxspe.h @@ -30,7 +30,7 @@ #define SUBSUBTARGET_OVERRIDE_OPTIONS \ if (rs6000_select[1].string == NULL) \ rs6000_cpu = PROCESSOR_PPC8540; \ - if (!rs6000_explicit_options.abi) \ + if (!rs6000_explicit_options.spe_abi) \ rs6000_spe_abi = 1; \ if (!rs6000_explicit_options.float_gprs) \ rs6000_float_gprs = 1; \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e2dc8a6ed08..1d8ddd4ffdf 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -9176,6 +9176,10 @@ rs6000_init_builtins (void) if (built_in_decls [BUILT_IN_CLOG]) set_user_assembler_name (built_in_decls [BUILT_IN_CLOG], "__clog"); #endif + +#ifdef SUBTARGET_INIT_BUILTINS + SUBTARGET_INIT_BUILTINS; +#endif } /* Search through a set of builtins and enable the mask bits. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index df4d9fc1f4b..aab0fb08570 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2008-02-27 Jakub Jelinek + + PR c++/35368 + * rtti.c: Include c-pragma.h. + (push_abi_namespace, pop_abi_namespace): New functions. + (build_dynamic_cast_1, tinfo_base_init, get_pseudo_ti_index, + create_tinfo_types, emit_support_tinfos): Use them. + * Make-lang.in (cp/rtti.o): Depend on $(C_PRAGMA_H). + +2008-02-22 Andrew Pinski + + PR C++/34715 + * decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS for + template decls' function decl. + 2008-02-22 Paolo Carlini PR c++/35282 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index d2a69f40384..6207ed13dd6 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -264,7 +264,7 @@ cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \ $(TARGET_H) debug.h $(TREE_FLOW_H) cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \ - $(TARGET_H) gt-cp-rtti.h + $(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(RTL_H) except.h \ toplev.h cp/cfns.h $(EXPR_H) libfuncs.h $(TREE_INLINE_H) $(TARGET_H) cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) $(FLAGS_H) $(EXPR_H) \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 72949301370..82c55e0ec63 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1675,6 +1675,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) = DECL_INTERFACE_KNOWN (new_result); DECL_DECLARED_INLINE_P (old_result) = DECL_DECLARED_INLINE_P (new_result); + DECL_DISREGARD_INLINE_LIMITS (old_result) + |= DECL_DISREGARD_INLINE_LIMITS (new_result); + } else { @@ -1682,6 +1685,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) |= DECL_INLINE (new_result); DECL_DECLARED_INLINE_P (old_result) |= DECL_DECLARED_INLINE_P (new_result); + DECL_DISREGARD_INLINE_LIMITS (old_result) + |= DECL_DISREGARD_INLINE_LIMITS (new_result); check_redeclaration_exception_specification (newdecl, olddecl); } } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 1925d04fbc5..f2085e4f26a 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1,6 +1,6 @@ /* RunTime Type Identification Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Mostly written by Jason Merrill (jason@cygnus.com). @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "convert.h" #include "target.h" +#include "c-pragma.h" /* C++ returns type information to the user in struct type_info objects. We also use type information to implement dynamic_cast and @@ -124,6 +125,19 @@ static bool typeinfo_in_lib_p (tree); static int doing_runtime = 0; +static void +push_abi_namespace (void) +{ + push_nested_namespace (abi_node); + push_visibility ("default"); +} + +static void +pop_abi_namespace (void) +{ + pop_visibility (); + pop_nested_namespace (abi_node); +} /* Declare language defined type_info type and a pointer to const type_info. This is incomplete here, and will be completed when @@ -669,10 +683,9 @@ build_dynamic_cast_1 (tree type, tree expr) { tree tmp; tree tinfo_ptr; - tree ns = abi_node; const char *name; - push_nested_namespace (ns); + push_abi_namespace (); tinfo_ptr = xref_tag (class_type, get_identifier ("__class_type_info"), /*tag_scope=*/ts_current, false); @@ -689,7 +702,7 @@ build_dynamic_cast_1 (tree type, tree expr) tmp = build_function_type (ptr_type_node, tmp); dcast_fn = build_library_fn_ptr (name, tmp); DECL_IS_PURE (dcast_fn) = 1; - pop_nested_namespace (ns); + pop_abi_namespace (); dynamic_cast_node = dcast_fn; } result = build_cxx_call (dcast_fn, 4, elems); @@ -848,10 +861,10 @@ tinfo_base_init (tinfo_s *ti, tree target) if (!vtable_ptr) { tree real_type; - push_nested_namespace (abi_node); + push_abi_namespace (); real_type = xref_tag (class_type, ti->name, /*tag_scope=*/ts_current, false); - pop_nested_namespace (abi_node); + pop_abi_namespace (); if (!COMPLETE_TYPE_P (real_type)) { @@ -1268,14 +1281,14 @@ get_pseudo_ti_index (tree type) TK_BASE_TYPE)->type, array_domain); - push_nested_namespace (abi_node); + push_abi_namespace (); create_pseudo_type_info (ix, "__vmi_class_type_info", build_decl (FIELD_DECL, NULL_TREE, integer_type_node), build_decl (FIELD_DECL, NULL_TREE, integer_type_node), build_decl (FIELD_DECL, NULL_TREE, base_array), NULL); - pop_nested_namespace (abi_node); + pop_abi_namespace (); break; } } @@ -1298,7 +1311,7 @@ create_tinfo_types (void) VEC_safe_grow (tinfo_s, gc, tinfo_descs, TK_FIXED); - push_nested_namespace (abi_node); + push_abi_namespace (); /* Create the internal type_info structure. This is used as a base for the other structures. */ @@ -1376,7 +1389,7 @@ create_tinfo_types (void) build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), NULL); - pop_nested_namespace (abi_node); + pop_abi_namespace (); } /* Emit the type_info descriptors which are guaranteed to be in the runtime @@ -1404,11 +1417,11 @@ emit_support_tinfos (void) int ix; tree bltn_type, dtor; - push_nested_namespace (abi_node); + push_abi_namespace (); bltn_type = xref_tag (class_type, get_identifier ("__fundamental_type_info"), /*tag_scope=*/ts_current, false); - pop_nested_namespace (abi_node); + pop_abi_namespace (); if (!COMPLETE_TYPE_P (bltn_type)) return; dtor = CLASSTYPE_DESTRUCTORS (bltn_type); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a33b2b07a46..5e9b7388ba1 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8333,7 +8333,7 @@ fold_unary (enum tree_code code, tree type, tree op0) if (TREE_CODE (arg0) == INTEGER_CST) return fold_not_const (arg0, type); else if (TREE_CODE (arg0) == BIT_NOT_EXPR) - return TREE_OPERAND (op0, 0); + return fold_convert (type, TREE_OPERAND (arg0, 0)); /* Convert ~ (-A) to A - 1. */ else if (INTEGRAL_TYPE_P (type) && TREE_CODE (arg0) == NEGATE_EXPR) return fold_build2 (MINUS_EXPR, type, @@ -9879,13 +9879,18 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) is a rotate of A by B bits. */ { enum tree_code code0, code1; + tree rtype; code0 = TREE_CODE (arg0); code1 = TREE_CODE (arg1); if (((code0 == RSHIFT_EXPR && code1 == LSHIFT_EXPR) || (code1 == RSHIFT_EXPR && code0 == LSHIFT_EXPR)) && operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), 0) - && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0)))) + && (rtype = TREE_TYPE (TREE_OPERAND (arg0, 0)), + TYPE_UNSIGNED (rtype)) + /* Only create rotates in complete modes. Other cases are not + expanded properly. */ + && TYPE_PRECISION (rtype) == GET_MODE_PRECISION (TYPE_MODE (rtype))) { tree tree01, tree11; enum tree_code code01, code11; @@ -11629,7 +11634,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST) { tree tem = build_int_cst (TREE_TYPE (arg1), - GET_MODE_BITSIZE (TYPE_MODE (type))); + TYPE_PRECISION (type)); tem = const_binop (MINUS_EXPR, tem, arg1, 0); return fold_build2 (RROTATE_EXPR, type, op0, tem); } @@ -11648,8 +11653,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) fold_build2 (code, type, TREE_OPERAND (arg0, 1), arg1)); - /* Two consecutive rotates adding up to the width of the mode can - be ignored. */ + /* Two consecutive rotates adding up to the precision of the + type can be ignored. */ if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) == RROTATE_EXPR && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST @@ -11657,7 +11662,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && TREE_INT_CST_HIGH (TREE_OPERAND (arg0, 1)) == 0 && ((TREE_INT_CST_LOW (arg1) + TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1))) - == (unsigned int) GET_MODE_BITSIZE (TYPE_MODE (type)))) + == (unsigned int) TYPE_PRECISION (type))) return TREE_OPERAND (arg0, 0); /* Fold (X & C2) << C1 into (X << C1) & (C2 << C1) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c23b81f5e30..7b1fd3f459d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2008-02-28 Uros Bizjak + + Backport from mainline: + 2008-02-25 Francois-Xavier Coudert + + PR target/25477 + * trans-expr.c (gfc_conv_power_op): Use BUILT_IN_CPOW{F,,L}. + * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_CPOW{F,,L}. + * trans.h (gfor_fndecl_math_cpow, gfor_fndecl_math_cpowf, + gfor_fndecl_math_cpowl10, gfor_fndecl_math_cpowl16): Remove. + * trans-decl.c: Likewise. + 2008-02-16 Francois-Xavier Coudert PR fortran/34952 diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index dcc64b9c38d..3056fdb5b5f 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -942,6 +942,12 @@ gfc_init_builtin_functions (void) BUILT_IN_POW, "pow", true); gfc_define_builtin ("__builtin_powf", mfunc_float[1], BUILT_IN_POWF, "powf", true); + gfc_define_builtin ("__builtin_cpowl", mfunc_clongdouble[1], + BUILT_IN_CPOWL, "cpowl", true); + gfc_define_builtin ("__builtin_cpow", mfunc_cdouble[1], + BUILT_IN_CPOW, "cpow", true); + gfc_define_builtin ("__builtin_cpowf", mfunc_cfloat[1], + BUILT_IN_CPOWF, "cpowf", true); gfc_define_builtin ("__builtin_powil", mfunc_longdouble[2], BUILT_IN_POWIL, "powil", true); gfc_define_builtin ("__builtin_powi", mfunc_double[2], diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 79a3e8b8c31..8ca4d430e98 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -99,10 +99,6 @@ tree gfor_fndecl_associated; trans-intrinsic.c. */ gfc_powdecl_list gfor_fndecl_math_powi[4][3]; -tree gfor_fndecl_math_cpowf; -tree gfor_fndecl_math_cpow; -tree gfor_fndecl_math_cpowl10; -tree gfor_fndecl_math_cpowl16; tree gfor_fndecl_math_ishftc4; tree gfor_fndecl_math_ishftc8; tree gfor_fndecl_math_ishftc16; @@ -2024,10 +2020,6 @@ gfc_build_intrinsic_function_decls (void) tree gfc_real8_type_node = gfc_get_real_type (8); tree gfc_real10_type_node = gfc_get_real_type (10); tree gfc_real16_type_node = gfc_get_real_type (16); - tree gfc_complex4_type_node = gfc_get_complex_type (4); - tree gfc_complex8_type_node = gfc_get_complex_type (8); - tree gfc_complex10_type_node = gfc_get_complex_type (10); - tree gfc_complex16_type_node = gfc_get_complex_type (16); /* String functions. */ gfor_fndecl_compare_string = @@ -2195,25 +2187,6 @@ gfc_build_intrinsic_function_decls (void) #undef NRKINDS } - gfor_fndecl_math_cpowf = - gfc_build_library_function_decl (get_identifier ("cpowf"), - gfc_complex4_type_node, - 1, gfc_complex4_type_node); - gfor_fndecl_math_cpow = - gfc_build_library_function_decl (get_identifier ("cpow"), - gfc_complex8_type_node, - 1, gfc_complex8_type_node); - if (gfc_complex10_type_node) - gfor_fndecl_math_cpowl10 = - gfc_build_library_function_decl (get_identifier ("cpowl"), - gfc_complex10_type_node, 1, - gfc_complex10_type_node); - if (gfc_complex16_type_node) - gfor_fndecl_math_cpowl16 = - gfc_build_library_function_decl (get_identifier ("cpowl"), - gfc_complex16_type_node, 1, - gfc_complex16_type_node); - gfor_fndecl_math_ishftc4 = gfc_build_library_function_decl (get_identifier (PREFIX("ishftc4")), gfc_int4_type_node, diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 4866d8c9658..962bb252616 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -935,16 +935,14 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) switch (kind) { case 4: - fndecl = gfor_fndecl_math_cpowf; + fndecl = built_in_decls[BUILT_IN_CPOWF]; break; case 8: - fndecl = gfor_fndecl_math_cpow; + fndecl = built_in_decls[BUILT_IN_CPOW]; break; case 10: - fndecl = gfor_fndecl_math_cpowl10; - break; case 16: - fndecl = gfor_fndecl_math_cpowl16; + fndecl = built_in_decls[BUILT_IN_CPOWL]; break; default: gcc_unreachable (); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 9ccf5713bee..72476888e6b 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -526,10 +526,6 @@ typedef struct gfc_powdecl_list GTY(()) gfc_powdecl_list; extern GTY(()) gfc_powdecl_list gfor_fndecl_math_powi[4][3]; -extern GTY(()) tree gfor_fndecl_math_cpowf; -extern GTY(()) tree gfor_fndecl_math_cpow; -extern GTY(()) tree gfor_fndecl_math_cpowl10; -extern GTY(()) tree gfor_fndecl_math_cpowl16; extern GTY(()) tree gfor_fndecl_math_ishftc4; extern GTY(()) tree gfor_fndecl_math_ishftc8; extern GTY(()) tree gfor_fndecl_math_ishftc16; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86defe11c01..0941adba437 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,73 @@ +2008-02-28 Uros Bizjak + + Backport from mainline: + 2008-02-25 Francois-Xavier Coudert + + PR libfortran/24685 + * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL on + powerpc*-apple-darwin*. + * gfortran.dg/large_real_kind_2.F90: Split testing of ERF and + ERFC into gfortran.dg/large_real_kind_3.F90. + * gfortran.dg/large_real_kind_3.F90: New test. + +2008-02-27 Richard Guenther + + Backport from mainline: + 2008-02-27 Richard Guenther + + PR middle-end/35390 + * gcc.c-torture/execute/pr35390.c: New testcase. + + PR middle-end/34971 + * gcc.c-torture/execute/pr34971.c: New testcase. + +2008-02-27 Jakub Jelinek + + PR c++/35368 + * g++.dg/ext/visibility/typeinfo2.C: New test. + * g++.dg/ext/visibility/typeinfo3.C: New test. + +2008-02-26 Joseph Myers + + * gcc.dg/bf-ms-attrib.c (main): Return 0. + +2008-02-26 Joseph Myers + + * gcc.target/i386/mmx-4.c (dump64_64): Use printf %I64 on MinGW. + * gcc.target/i386/sse-6.c (dump128_64): Likewise. + +2008-02-25 Joseph Myers + + * gcc.target/i386/pr25993.c: Skip on *-*-mingw*. + +2008-02-25 Joseph Myers + + * gcc.dg/debug/dwarf2/aranges-fnsec-1.c: Add -w to dg-options. + +2008-02-25 Joseph Myers + + * gcc.dg/builtins-config.h: Disable C99 runtime testing for + Windows. + +2008-02-25 Joseph Myers + + * lib/target-supports.exp (check_profiling_available): Report -p + unavailable on *-*-mingw*. + +2008-02-25 Joseph Myers + + * lib/target-supports.exp (check_effective_target_pthread_h): New. + * gcc.dg/pthread-init-1.c, gcc.dg/pthread-init-2.c: Use + dg-require-effective-target pthread_h. + +2008-02-22 Andrew Pinski + + PR C++/34715 + * g++.dg/ext/always_inline-1.C: New test. + * g++.dg/ext/always_inline-2.C: New test. + * g++.dg/ext/always_inline-3.C: New test. + * g++.dg/ext/always_inline-4.C: New test. + 2008-02-22 Hans-Peter Nilsson * gcc.target/cris/asm-b-1.c: New test. diff --git a/gcc/testsuite/g++.dg/ext/always_inline-1.C b/gcc/testsuite/g++.dg/ext/always_inline-1.C new file mode 100644 index 00000000000..284fd17a005 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/always_inline-1.C @@ -0,0 +1,26 @@ +// { dg-options "-O0" } +// { dg-do compile } +// PR C++/34715 + + +namespace X +{ + template + const T& min(const T& a, const T& b); + + template + inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b) + { + return a < b ? a : b; + } +} +template +inline __attribute__ ((always_inline)) T y(const T& a, const T& b) +{ + return X::min(a, b); +} +int main() +{ + int a = 0, b = 0; + return y(a, b); +} diff --git a/gcc/testsuite/g++.dg/ext/always_inline-2.C b/gcc/testsuite/g++.dg/ext/always_inline-2.C new file mode 100644 index 00000000000..31123c19229 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/always_inline-2.C @@ -0,0 +1,26 @@ +// { dg-options "-O0" } +// { dg-do compile } +// PR C++/34715 + + +namespace X +{ + template + const T& min123(const T& a, const T& b); +} + + +template +inline __attribute__ ((always_inline)) const T& X::min123(const T& a, const T& b) +{ + return a < b ? a : b; +} +int main() +{ + int a, b; + return X::min123(a, b); +} + + + +// { dg-final { scan-assembler-not "min123" } } diff --git a/gcc/testsuite/g++.dg/ext/always_inline-3.C b/gcc/testsuite/g++.dg/ext/always_inline-3.C new file mode 100644 index 00000000000..e008932bf2a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/always_inline-3.C @@ -0,0 +1,26 @@ +// { dg-options "-O0" } +// { dg-do compile } +// PR C++/34715 + + +namespace X +{ + template + inline __attribute__ ((always_inline)) const T& min123(const T& a, const T& b); +} + + +template +inline __attribute__ ((always_inline)) const T& X::min123(const T& a, const T& b) +{ + return a < b ? a : b; +} +int main() +{ + int a, b; + return X::min123(a, b); +} + + + +// { dg-final { scan-assembler-not "min123" } } diff --git a/gcc/testsuite/g++.dg/ext/always_inline-4.C b/gcc/testsuite/g++.dg/ext/always_inline-4.C new file mode 100644 index 00000000000..e9507619354 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/always_inline-4.C @@ -0,0 +1,20 @@ +// { dg-options "-O0" } +// { dg-do compile } +// PR C++/34715 + + template + const T& min123(const T& a, const T& b); +template +inline __attribute__ ((always_inline)) const T& +min123(const T& a, const T& b) +{ + return a < b ? a : b; +} +int main() +{ + int a, b; + return min123(a, b); +} + + +// { dg-final { scan-assembler-not "min123" } } diff --git a/gcc/testsuite/g++.dg/ext/visibility/typeinfo2.C b/gcc/testsuite/g++.dg/ext/visibility/typeinfo2.C new file mode 100644 index 00000000000..54f541d8500 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/visibility/typeinfo2.C @@ -0,0 +1,23 @@ +// PR c++/35368 +// { dg-require-visibility "" } + +#pragma GCC visibility push (hidden) + +struct A +{ + A(); + virtual ~A() { } +}; + +A::A() +{ +} + +void foo(A *a) +{ + delete a; +} + +// { dg-final { scan-not-hidden "_ZTVN10__cxxabiv117__class_type_infoE" } } +// { dg-final { scan-hidden "_ZTI1A" } } +// { dg-final { scan-hidden "_ZTV1A" } } diff --git a/gcc/testsuite/g++.dg/ext/visibility/typeinfo3.C b/gcc/testsuite/g++.dg/ext/visibility/typeinfo3.C new file mode 100644 index 00000000000..5102b649216 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/visibility/typeinfo3.C @@ -0,0 +1,24 @@ +// PR c++/35368 +// { dg-require-visibility "" } + +#pragma GCC visibility push (hidden) + +#include + +const std::type_info& info1 = typeid(int []); +const std::type_info& info2 = typeid(int); +enum E { e = 0 }; +const std::type_info& info3 = typeid(E); +struct S { S (); }; +const std::type_info& info4 = typeid(S); +const std::type_info& info5 = typeid(int *); + +// { dg-final { scan-not-hidden "_ZTVN10__cxxabiv117__array_type_infoE" } } +// { dg-final { scan-not-hidden "_ZTVN10__cxxabiv116__enum_type_infoE" } } +// { dg-final { scan-hidden "_ZTI1S" } } +// { dg-final { scan-hidden "_ZTS1S" } } +// { dg-final { scan-hidden "info1" } } +// { dg-final { scan-hidden "info2" } } +// { dg-final { scan-hidden "info3" } } +// { dg-final { scan-hidden "info4" } } +// { dg-final { scan-hidden "info5" } } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34971.c b/gcc/testsuite/gcc.c-torture/execute/pr34971.c new file mode 100644 index 00000000000..3299aee22c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34971.c @@ -0,0 +1,22 @@ +struct foo +{ + unsigned long long b:40; +} x; + +extern void abort (void); + +void test1(unsigned long long res) +{ + /* Build a rotate expression on a 40 bit argument. */ + if ((x.b<<8) + (x.b>>32) != res) + abort (); +} + +int main() +{ + x.b = 0x0100000001; + test1(0x0000000101); + x.b = 0x0100000000; + test1(0x0000000001); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35390.c b/gcc/testsuite/gcc.c-torture/execute/pr35390.c new file mode 100644 index 00000000000..7103a9b5414 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr35390.c @@ -0,0 +1,13 @@ +extern void abort (void); + +unsigned int foo (int n) +{ + return ~((unsigned int)~n); +} + +int main() +{ + if (foo(0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/bf-ms-attrib.c b/gcc/testsuite/gcc.dg/bf-ms-attrib.c index e3832d4b404..da4eb08d2da 100644 --- a/gcc/testsuite/gcc.dg/bf-ms-attrib.c +++ b/gcc/testsuite/gcc.dg/bf-ms-attrib.c @@ -36,4 +36,5 @@ main() abort(); if (sizeof(struct one_gcc) != 8) abort(); + return 0; } diff --git a/gcc/testsuite/gcc.dg/builtins-config.h b/gcc/testsuite/gcc.dg/builtins-config.h index 060db4ffc18..a6d280ac509 100644 --- a/gcc/testsuite/gcc.dg/builtins-config.h +++ b/gcc/testsuite/gcc.dg/builtins-config.h @@ -19,6 +19,8 @@ /* NetWare doesn't have the entire C99 runtime. */ #elif defined(__vxworks) /* VxWorks doesn't have a full C99 time. (cabs is missing, for example.) */ +#elif defined(_WIN32) && !defined(__CYGWIN__) +/* Windows doesn't have the entire C99 runtime. */ #elif (defined(__APPLE__) && defined(__ppc__) \ && ! defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)) /* MacOS versions before 10.3 don't have many C99 functions. diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c index c6aada4611c..8bd34b2fe29 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/aranges-fnsec-1.c @@ -2,7 +2,7 @@ section if nothing went in there. */ /* Origin: Joseph Myers */ /* { dg-do compile } */ -/* { dg-options "-gdwarf-2 -ffunction-sections" } */ +/* { dg-options "-gdwarf-2 -ffunction-sections -w" } */ /* { dg-final { scan-assembler-not "\\.Letext0-\\.Ltext0" } } */ int diff --git a/gcc/testsuite/gcc.dg/pthread-init-1.c b/gcc/testsuite/gcc.dg/pthread-init-1.c index 9cf4fa3d35b..2f78844fe1f 100644 --- a/gcc/testsuite/gcc.dg/pthread-init-1.c +++ b/gcc/testsuite/gcc.dg/pthread-init-1.c @@ -5,6 +5,7 @@ */ /* { dg-do compile } */ +/* { dg-require-effective-target pthread_h } */ /* { dg-options "-Wextra -Wall" } */ #include "pthread-init-common.h" diff --git a/gcc/testsuite/gcc.dg/pthread-init-2.c b/gcc/testsuite/gcc.dg/pthread-init-2.c index 6fc427fe2eb..2e1b93aecbf 100644 --- a/gcc/testsuite/gcc.dg/pthread-init-2.c +++ b/gcc/testsuite/gcc.dg/pthread-init-2.c @@ -5,6 +5,7 @@ */ /* { dg-do compile } */ +/* { dg-require-effective-target pthread_h } */ /* { dg-options "-Wextra -Wall -ansi" } */ /* { dg-options "-Wextra -Wall -ansi -D_POSIX_C_SOURCE=199506L" { target { *-*-hpux* *-*-solaris2.5.1 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/mmx-4.c b/gcc/testsuite/gcc.target/i386/mmx-4.c index 42c71f632d9..05d2b553b56 100644 --- a/gcc/testsuite/gcc.target/i386/mmx-4.c +++ b/gcc/testsuite/gcc.target/i386/mmx-4.c @@ -184,7 +184,11 @@ dump64_64 (char *buf, char *name, vecInWord x) sprintf (p, "%s ", name); p += strlen (p); +#if defined(_WIN32) && !defined(__CYGWIN__) + sprintf (p, "%16.16I64x\n", x.t); +#else sprintf (p, "%16.16llx\n", x.t); +#endif } int diff --git a/gcc/testsuite/gcc.target/i386/pr25993.c b/gcc/testsuite/gcc.target/i386/pr25993.c index ebdc903f87d..38d0e0f3585 100644 --- a/gcc/testsuite/gcc.target/i386/pr25993.c +++ b/gcc/testsuite/gcc.target/i386/pr25993.c @@ -1,5 +1,5 @@ /* { dg-do assemble } */ -/* { dg-skip-if "" { "*-*-darwin*" } { "*" } { "" } } */ +/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" } { "*" } { "" } } */ /* { dg-options "-std=c99 -x assembler-with-cpp" } */ #ifndef __ASSEMBLER__ diff --git a/gcc/testsuite/gcc.target/i386/sse-6.c b/gcc/testsuite/gcc.target/i386/sse-6.c index f07a8cbc99b..930b23f1f73 100644 --- a/gcc/testsuite/gcc.target/i386/sse-6.c +++ b/gcc/testsuite/gcc.target/i386/sse-6.c @@ -229,7 +229,11 @@ dump128_64 (char *buf, char *name, vecInLong x) for (i=0; i<2; i++) { +#if defined(_WIN32) && !defined(__CYGWIN__) + sprintf (p, "%16.16I64x ", x.u[i]); +#else sprintf (p, "%16.16llx ", x.u[i]); +#endif p += strlen (p); } strcat (p, "\n"); diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 index 7719cafed4d..2e3891b2ffd 100644 --- a/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 +++ b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 @@ -43,8 +43,6 @@ TEST_FUNCTION(log,0.00178914) TEST_FUNCTION(log10,123789.123) TEST_FUNCTION(sqrt,789.1356) - TEST_FUNCTION(erf,1.45123231) - TEST_FUNCTION(erfc,-0.123789) CTEST_FUNCTION(cos,(17.456,-1.123)) CTEST_FUNCTION(sin,(17.456,-7.6)) diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 new file mode 100644 index 00000000000..664be865f5b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 @@ -0,0 +1,24 @@ +! { dg-do run } +! { dg-require-effective-target fortran_large_real } +! { dg-xfail-if "" { "powerpc*-apple-darwin*" } { "*" } { "" } } + +! Testing erf and erfc library calls on large real kinds (larger than kind=8) + implicit none + + integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1) + real(8),parameter :: eps = 1e-8 + + real(kind=k) :: x + real(8) :: y + +#define TEST_FUNCTION(func,val) \ + x = val ;\ + y = x ;\ + x = func (x) ;\ + y = func (y) ;\ + if (abs((y - x) / y) > eps) call abort + + TEST_FUNCTION(erf,1.45123231) + TEST_FUNCTION(erfc,-0.123789) + +end diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 index b5751cece75..a72c7183785 100644 --- a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 +++ b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 @@ -1,4 +1,4 @@ -! { dg-do run { xfail powerpc*-*-linux* } } +! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } } ! Test XFAILed on these platforms because the system's printf() lacks ! proper support for denormalized long doubles. See PR24685 ! { dg-require-effective-target fortran_large_real } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 3f8cfaad753..424ca8cc493 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -410,6 +410,11 @@ proc check_profiling_available { test_what } { return 0 } + # MinGW does not support -p. + if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } { + return 0 + } + # At present, there is no profiling support on NetWare. if { [istarget *-*-netware*] } { return 0 @@ -2212,6 +2217,14 @@ proc check_effective_target_wchar { } { }] } +# Return 1 if the target has . + +proc check_effective_target_pthread_h { } { + return [check_no_compiler_messages pthread_h assembly { + #include + }] +} + # Add to FLAGS all the target-specific flags needed to access the c99 runtime. proc add_options_for_c99_runtime { flags } { -- cgit v1.2.3