diff options
226 files changed, 4541 insertions, 1575 deletions
diff --git a/ChangeLog b/ChangeLog index f0db954c5bc..f7d124a0721 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-11-27 Toon Moene <toon@moene.org> + + * MAINTAINERS: Change e-mail address. + +2008-11-27 Tristan Gingold <gingold@adacore.com> + + * configure.ac: Build gdb for i?86-*-darwin* + * configure: Regenerated. + +2008-11-24 Hariharan Sandanagobalane <hariharan@picochip.com> + + * MAINTAINERS: Added my full name. + 2008-11-14 Daniel Jacobowitz <dan@codesourcery.com> PR bootstrap/38014 diff --git a/ChangeLog.melt b/ChangeLog.melt index 96fe47d821f..b54ff549d54 100644 --- a/ChangeLog.melt +++ b/ChangeLog.melt @@ -1,3 +1,6 @@ +2008-11-28 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk r142527 + 2008-11-20 Basile Starynkevitch <basile@starynkevitch.net> MELT branch merged with trunk r142033 diff --git a/MAINTAINERS b/MAINTAINERS index 46ee6c49f65..a47c0e2d174 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -74,7 +74,7 @@ mmix port Hans-Peter Nilsson hp@bitrange.com mn10300 port Jeff Law law@redhat.com mn10300 port Alexandre Oliva aoliva@redhat.com pdp11 port Paul Koning ni1d@arrl.net -picochip port Hari Sandanagobalane hariharan@picochip.com +picochip port Hariharan Sandanagobalane hariharan@picochip.com picochip port Daniel Towner dant@picochip.com rs6000 port Geoff Keating geoffk@geoffk.org rs6000 port David Edelsohn edelsohn@gnu.org @@ -247,7 +247,7 @@ Fortran Tobias Burnus burnus@net-b.de Fortran Jerry DeLisle jvdelisle@gcc.gnu.org Fortran Erik Edelmann erik.edelmann@iki.fi Fortran Thomas König tkoenig@gcc.gnu.org -Fortran Toon Moene toon@moene.indiv.nluug.nl +Fortran Toon Moene toon@moene.org Fortran Brooks Moses brooks.moses@codesourcery.com Fortran Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de Fortran Paul Thomas pault@gcc.gnu.org diff --git a/config/ChangeLog b/config/ChangeLog index 84cb7ff7e00..e5dfc5185c5 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,8 @@ +2008-11-21 Kai Tietz <kai.tietz@onevision.com> + + Fix PR/25502 + * mh-mingw (BOOT_CFLAGS): Add -Wno-pedantic-ms-format switch. + 2008-11-12 Steve Ellcey <sje@cup.hp.com> PR target/27880 diff --git a/config/mh-mingw b/config/mh-mingw index 4c49d5d5917..d91323ef5fa 100644 --- a/config/mh-mingw +++ b/config/mh-mingw @@ -1,6 +1,6 @@ # Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows # Vista (see PR33281 for details). -BOOT_CFLAGS += -D__USE_MINGW_ACCESS +BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format CFLAGS += -D__USE_MINGW_ACCESS # Increase stack limit to same as Linux default. LDFLAGS += -Wl,--stack,8388608 diff --git a/configure b/configure index 76166f725ee..8bf9f059763 100755 --- a/configure +++ b/configure @@ -2210,10 +2210,14 @@ case "${target}" in *-*-chorusos) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; - powerpc-*-darwin* | i[3456789]86-*-darwin* | x86_64-*-darwin9*) + powerpc-*-darwin* | x86_64-*-darwin9*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" ;; + i[3456789]86-*-darwin*) + noconfigdirs="$noconfigdirs ld gas gprof" + noconfigdirs="$noconfigdirs sim target-rda" + ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" diff --git a/configure.ac b/configure.ac index e6626b459ee..1a95b1955e5 100644 --- a/configure.ac +++ b/configure.ac @@ -446,10 +446,14 @@ case "${target}" in *-*-chorusos) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; - powerpc-*-darwin* | i[[3456789]]86-*-darwin* | x86_64-*-darwin9*) + powerpc-*-darwin* | x86_64-*-darwin9*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" ;; + i[[3456789]]86-*-darwin*) + noconfigdirs="$noconfigdirs ld gas gprof" + noconfigdirs="$noconfigdirs sim target-rda" + ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog index f3a18025e94..2b4939b5b00 100644 --- a/contrib/regression/ChangeLog +++ b/contrib/regression/ChangeLog @@ -1,3 +1,7 @@ +2008-11-27 Geoff Keating <geoffk@geoffk.org> + + * mkindex.pl: New. + 2007-12-24 Geoff Keating <geoffk@geoffk.org> * objs-gcc.sh: Revert previous change. diff --git a/contrib/regression/mkindex.pl b/contrib/regression/mkindex.pl new file mode 100755 index 00000000000..46e11069f09 --- /dev/null +++ b/contrib/regression/mkindex.pl @@ -0,0 +1,107 @@ +#!/usr/bin/perl + +# Copy log files from a GCC build for HTTP access. +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# INPUT: +# mkindex.pl <srcdir> <destdir> <branchname> + +# This script copies log files from a GCC build directory, compresses +# and indexes them for web browser access. It's aimed at having an +# easy-to-access collection of files for analyzing regressions without +# needing to run the build yourself. Binary files (.o, executables) +# are intentionally not included since usually if they are needed it's +# better to just run a build, and because they take up a lot of space. + +# 'srcdir' is the root directory of a GCC build (was $objdir in the build). +# 'destdir' will be erased and replaced with the log files, and should be an +# absolute path. +# 'branchname' is used only to produce the title of the index page, +# which will be named 'index.html'. + +use warnings; +use strict; +use File::Path qw(mkpath rmtree); +use File::Find qw(find); + +if ($#ARGV != 2) { + print "usage: $0 <srcdir> <destdir> <branchname>\n"; + exit 1; +} + +my ($srcdir, $destdir, $branchname) = @ARGV; +die "destdir is not absolute" unless ($destdir =~ m,^/,); + +# Erase the destination. +rmtree $destdir; +mkdir $destdir or die "${destdir}: $!"; + +# Copy and compress the files into the destination, and keep a list in @files. +my @files = (); +sub my_wanted { + # Copy all files ending with .log or .sum. + if (/\.(log|sum)$/ && -f) { + + die unless (substr ($File::Find::dir,0,(length $srcdir)) eq $srcdir); + my $dir = substr $File::Find::dir,(length $srcdir); + $dir = substr $dir,1 unless ($dir eq ''); + my $name = $_; + $name = $dir . '/' . $_ if ($dir ne ''); + + mkpath $destdir . '/' . $dir; + # Compress the files. Use .gzip instead of .gz for the + # extension to avoid (broken) browser workarounds for broken + # web servers. + system ("gzip -c -q -9 $_ > $destdir/${name}.gzip") == 0 or exit 2; + + # Write the (compressed) size consistently in Kbytes. + my $size = -s $destdir .'/' . $name . '.gzip'; + my $printable_size = (sprintf "%.0fK",$size / 1024); + + push @files,[$name.'.gzip',$name,$printable_size]; + } +} +find ({wanted => \&my_wanted}, $srcdir); + +# Sort the list of files for the index. +@files = sort {$a->[1] cmp $b->[1]} @files; + +# Create the index. +open INDEX,'>',$destdir . '/index.html' or die "${destdir}/index.html: $!"; +# Use strict XHTML 1.0, and set charset to UTF-8. +print INDEX <<EOF or die "writing index: $!"; +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Log files for $branchname</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +</head> +<body> +<h1>Log files for $branchname</h1> +<table><tr><th>Name</th><th align='right'>Size</th></tr> +EOF +# The index will have two columns, filename (without .gzip) and +# compressed size. +foreach my $f (@files) { + printf INDEX "<tr><td><a href=\"%s\">%s</a></td><td align=\'right\'>%s</td></tr>\n", + $f->[0], $f->[1], $f->[2] or die "writing index: $!"; +} + +print INDEX "</table></body></html>\n" or die "writing index: $!"; +close INDEX or die "writing index: $!"; +exit 0; diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48757a5f155..615aad2f7c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,384 @@ +2008-11-28 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/37955 + PR tree-optimization/37742 + * tree-vect-transform.c (vectorizable_store): Remove assert for + compatible aliases. + (vectorizable_load): Likewise. + +2008-11-27 Richard Guenther <rguenther@suse.de> + + * tree-ssa-structalias.c (intra_create_variable_infos): Make + a constraint for the static chain parameter. + +2008-11-27 Bernd Schmidt <bernd.schmidt@analog.com> + + * config/bfin/bfin.opt (micplb): New option. + * config/bfin/linux.h (SUBTARGET_DRIVER_SELF_SPECS): Set it. + * config/bfin/bfin-protos.h (WA_INDIRECT_CALLS, + ENABLE_WA_INDIRECT_CALLS): New macros. + * config/bfin/bfin.c (bfin_cpus): Add WA_INDIRECT_CALLS to + all 54x CPUs. + (indirect_call_p): New function. + (workaround_speculation): Handle anomaly 05-00-0426 when + ENABLE_WA_INDIRECT_CALLS is true. + * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define + __WORKAROUND_INDIRECT_CALLS if ENABLE_WA_INDIRECT_CALLS. + * doc/invoke.texi (Blackfin Options): Document -micplb. + +2008-11-26 DJ Delorie <dj@redhat.com> + + * config/m32c/mov.md ("extendhipsi2"): New. + + * config/m32c/bitops.md (bset_qi): Add memsym_operand predicate. + + * config/m32c/bitops.md (andhi3_24, iorhi3_24): Don't prefer HL class. + * config/m32c/mov.md (zero_extendqihi2): Likewise. + +2008-11-26 Adam Nemet <anemet@caviumnetworks.com> + + * config/mips/mips.md (clear_hazard): Rename to + clear_hazard_<mode>. Use mode-specific addition. + (clear_cache): Rename gen_clear_hazard to gen_clear_hazard_si + or gen_clear_hazard_di depending on the size of Pmode. + +2008-11-26 DJ Delorie <dj@redhat.com> + + * configure.ac: Test m32c-elf-gas for .loc. + * configure: Likewise. + +2008-11-26 Janis Johnson <janis187@us.ibm.com> + + PR testsuite/28870 + * doc/sourcebuild.texi (Test Directives): Add dg-timeout and + dg-timeout-factor. + +2008-11-26 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/sync.md (memory_barrier_nosse): Disable also for + TARGET_64BIT. Remove special asm template for TARGET_64BIT case. + (memory_barrier): Do not generate memory_barrier_nosse instruction + for TARGET_64BIT. + * config/i386/sse.md (*sse2_mfence): Also enable for TARGET_64BIT. + +2008-11-26 Fredrik Unger <fred@tree.se> + + * config/soft-fp/floatuntisf.c (__floatuntisf): Correct + function name from __floatundisf. + * config/soft-fp/fixdfti.c (__fixdfti): Correct argument type to + DFtype. + +2008-11-25 Daniel Berlin <dberlin@dberlin.org> + Richard Guenther <rguenther@suse.de> + + PR tree-optimization/37869 + * tree-ssa-structalias.c (struct constraint_graph): Remove + pt_used and number_incoming members. + (build_pred_graph): Do not allocate them. + (condense_visit): Do not use them. + (label_visit): Likewise. + (free_var_substitution_info): Do not free them. + +2008-11-25 Vladimir Makarov <vmakarov@redhat.com> + + * doc/invoke.texi (ira-max-loops-num): Change semantics. + + * ira-int.h (struct ira_loop_tree_node): New member to_remove_p. + + * ira-color.c (allocno_spill_priority): New function. + (remove_allocno_from_bucket_and_push, push_allocno_to_spill): + Print more info about the spilled allocno. + (push_allocnos_to_stack): Use allocno_spill_priority. Add more + checks on bad spill. + + * ira-build.c (loop_node_to_be_removed_p): Remove. + (loop_compare_func, mark_loops_for_removal): New functions. + (remove_uneccesary_loop_nodes_from_loop_t): Use member + to_remove_p. + (remove_unnecessary_allocnos): Call mark_loops_for_removal. + + * ira.c (ira): Don't change flag_ira_algorithm. + + * params.def (ira-max-loops-num): Change the value. + +2008-11-25 Maxim Kuvyrkov <maxim@codesourcery.com> + + * config/m68k/m68k.md (extendsidi2, extendsidi2_mem): Merge, clean up. + Disable unsupported alternative for ColdFire, + add new alternative that ColdFire can handle. + +2008-11-25 Eric Botcazou <ebotcazou@adacore.com> + + * regrename.c (merge_overlapping_regs): Add registers artificially + defined at the top of the basic block to the set of live ones just + before the first insn. + +2008-11-25 H.J. Lu <hongjiu.lu@intel.com> + Joey Ye <joey.ye@intel.com> + + PR middle-end/37843 + * config/i386/i386.c (ix86_function_ok_for_sibcall): Return + false if we need to align the outgoing stack. + (ix86_update_stack_boundary): Check parm_stack_boundary. + +2008-11-25 Richard Guenther <rguenther@suse.de> + + PR middle-end/38151 + PR middle-end/38236 + * tree-ssa-alias.c (struct alias_info): Remove written_vars. + Remove dereferenced_ptrs_store and dereferenced_ptrs_load + in favor of dereferenced_ptrs. + (init_alias_info): Adjust. + (delete_alias_info): Likewise. + (compute_flow_insensitive_aliasing): Properly + include all aliased variables. + (update_alias_info_1): Use dereferenced_ptrs. + (setup_pointers_and_addressables): Likewise. + (get_smt_for): Honor ref-all pointers and pointers with known alias + set properly. + * config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers. + +2008-11-25 Uros Bizjak <ubizjak@gmail.com> + + PR target/38254 + * config/i386/sync.md (memory_barrier_nosse): New insn pattern. + (memory_barrier): Generate memory_barrier_nosse insn for !TARGET_SSE2. + +2008-11-24 Maxim Kuvyrkov <maxim@codesourcery.com> + + * config/m68k/m68k.md (cmpdi): Use (scratch) instead of pseudo. + +2008-11-24 Richard Sandiford <rdsandiford@googlemail.com> + + * config/mips/mips.h (ASM_OUTPUT_DEBUG_LABEL): Define. + +2008-11-24 Maxim Kuvyrkov <maxim@codesourcery.com> + + PR target/35018 + * config/m68k/m68k.md (ok_for_coldfire, enabled): New attributes. + (addsi_lshrsi_31): Add ColdFire-friendly alternatives. + +2008-11-24 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (UNSPECV_CMPXCHG): Rename from + UNSPECV_CMPXCHG_[12]. + * config/i386/sync.md: Use UNSPECV_CMPXCHG instead of + UNSPECV_CMPXCHG_[12]. + + PR target/36793 + * config/i386/sync.md (memory_barrier): New expander. + +2008-11-24 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/37135 + * dse.c (find_shift_sequence): Optimize extraction from a constant. + +2008-11-23 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * pa.c (function_arg): Revert 2008-10-26 change. + +2008-11-23 Helge Deller <deller@gmx.de> + + * pa/linux-atomic.c (EBUSY): Define if not _LP64. + (__kernel_cmpxchg): Return -EBUSY if the kernel LWS call + succeeded and lws_ret is not equal to oldval. + +2008-11-23 Kaz Kojima <kkojima@gcc.gnu.org> + + * config/sh/sh.md (consttable_4): Call mark_symbol_refs_as_used. + +2008-11-22 Andreas Schwab <schwab@suse.de> + + * varasm.c (default_file_start): Suppress ASM_APP_OFF also with + -dA and -dP. + +2008-11-22 Adam Nemet <anemet@caviumnetworks.com> + + * config/mips/mips.md (rdhwr): Rename to rdhwr_synci_step_<mode>. + Use constant 1 as the operand. + * config/mips/mips.c (mips_expand_synci_loop): Make INC Pmode. + Rename gen_rdhwr to gen_rdhwr_synci_step_si or + gen_rdhwr_synci_step_di depending on the size of Pmode. + +2008-11-22 Uros Bizjak <ubizjak@gmail.com> + + PR target/38222 + * config/i386/i386.md (SWI248): New mode iterator. + (SWI32): Remove mode iterator. + (popcount<mode>2): Rename from popcounthi2, popcountsi2 and + popcounthi2 insn patterns. Macroize pattern using SWI248 mode + iterator. Generate popcnt mnemonic without mode extensions + for Darwin x86 targets. + (*popcount<mode>2_cmp): Ditto. + (*popcountsi2_cmp_zext): Generate popcnt mnemonic without mode + extensions for Darwin x86 targets. + +2008-11-22 Eric Botcazou <ebotcazou@adacore.com> + + * config/sparc/sparc.c (TARGET_ASM_OUTPUT_DWARF_DTPREL): Define + only if HAVE_AS_SPARC_UA_PCREL is defined. + +2008-11-22 Richard Sandiford <rdsandiford@googlemail.com> + + * ira-costs.c (find_allocno_class_costs): Work out the maximum + allocno_costs value of the classees with the lowest total_costs + value. Use this to set ALLOCNO_COVER_CLASS_COST here... + (setup_allocno_cover_class_and_costs): ...rather than here. + Use the ALLOCNO_COVER_CLASS_COST for all registers in the + preferred class. + +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/37323 + * builtins.c (expand_builtin_apply_args): Emit sequence before + parm_birth_insn instead of after entry_of_function's first insn. + + PR middle-end/37316 + * function.c (assign_parm_remove_parallels): Pass + data->passed_type as third argument to emit_group_store. + + PR target/37170 + * final.c (mark_symbol_refs_as_used): New function. + * output.h (mark_symbol_refs_as_used): New prototype. + * config/s390/s390.c (s390_mark_symbol_ref_as_used): Removed. + (s390_output_pool_entry): Use mark_symbol_refs_as_used. + * config/arm/arm.md (consttable_4): Likewise. + + PR target/37880 + * doc/invoke.texi: Adjust wording of -mcmodel=medium description. + +2008-11-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/38200 + * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Only + propagate x = &a into *x = b if conversion from b to a's type is + useless. + +2008-11-21 Eric Botcazou <ebotcazou@adacore.com> + + * caller-save.c (insert_one_insn): Take into account REG_INC notes + for the liveness computation of the new insn. + +2008-11-21 DJ Delorie <dj@redhat.com> + + * config/stormy16/stormy16.md (movqi_internal, movhi_internal): + Moves to/from below100 space (W) can only use r0-r7. + +2008-11-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR other/38214 + * doc/invoke.texi (Optimization Options): Fix typo. + +2008-11-21 H.J. Lu <hongjiu.lu@intel.com> + Xuepeng Guo <xuepeng.guo@intel.com> + + * config.gcc (extra_headers): For x86 and x86-64, remove + gmmintrin.h, add immintrin.h and avxintrin.h. + + * config/i386/gmmintrin.h: Renamed to ... + * config/i386/avxintrin.h: This. Issue an error if + _IMMINTRIN_H_INCLUDED is undedined. + + * config/i386/immintrin.h: New. + +2008-11-21 Jakub Jelinek <jakub@redhat.com> + + PR target/38208 + * reload1.c (eliminate_regs_in_insn): For trunc_int_for_mode use + mode of PLUS, not mode of the eliminated register. + +2008-11-21 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/mmx.md (mmx_nand<mode>3): Rename to mmx_andnot<mode>3. + * config/i386/sse.md (avx_nand<mode>3): Rename to avx_andnot<mode>3. + (<sse>_nand<mode>3): Rename to <sse>_andnot<mode>3. + (sse2_nand<mode>3): Rename to sse2_andnot<mode>3. + (*sse_nand<mode>3): Rename to *sse_andnot<mode>3. + (*avx_nand<mode>3): Rename to *avx_andnot<mode>3. + (*nand<mode>3): Rename to *andnot<mode>3. + (*nandtf3): rename to *andnottf3. + * config/i386/i386.c (bdesc_args) [IX86_BUILTIN_PANDN]: + Use CODE_FOR_mmx_andnotv2si3. + [IX86_BUILTIN_ANDNPS]: Use CODE_FOR_sse_andnotv4sf3. + [IX86_BUILTIN_ANDNPD]: Use CODE_FOR_sse2_andnotv2df3. + [IX86_BUILTIN_PANDN128]: Use CODE_FOR_sse2_andnotv2di3. + [IX86_BUILTIN_ANDNPS256]: Use CODE_FOR_avx_andnotv8sf3. + [IX86_BUILTIN_ANDNPD256]: Use CODE_FOR_avx_andnotv4df3. + +2008-11-21 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/37908 + * config/ia64/ia64.c (ia64_expand_atomic_ope): Properly handle NAND + case by calculating ~(new_reg & val) instead of (~new_reg & val). + * config/ia64/sync.md (sync_nand<mode>): Change insn RTX + to (not:IMODE (and:IMODE (...))). + (sync_old_nand<mode>): Ditto. + (sync_new_nand<mode>): Ditto. + +2008-11-20 Joseph Myers <joseph@codesourcery.com> + + * config/arm/thumb2.md (thumb2_casesi_internal, + thumb2_casesi_internal_pic): Use earlyclobber for scratch operand 4. + +2008-11-20 Andreas Krebbel <krebbel1@de.ibm.com> + + * gcc/config/s390/s390.c (s390_expand_atomic): Adjust QI/HI atomic + nand to the changed 4.4 semantic. + +2008-11-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/29215 + * builtins.c (SLOW_UNALIGNED_ACCESS): Define if not defined. + (fold_builtin_memory_op): Handle even the case where just one + of src and dest is an address of a var decl component, using + TYPE_REF_CAN_ALIAS_ALL pointers. Remove is_gimple_min_invariant + and readonly_data_expr src check. + * tree-ssa-sccvn.c (DFS): Use clear_and_done_ssa_iter to shut + up warnings. + + PR rtl-optimization/36998 + * dwarf2out.c (stack_adjust_offset): Add cur_args_size and cur_offset + arguments. Handle sp = reg and (set (foo) (mem (pre_inc (reg sp)))). + (compute_barrier_args_size_1, dwarf2out_frame_debug_expr): Adjust + stack_adjust_offset callers. + (dwarf2out_stack_adjust): Likewise. Handle insns in annulled + branches properly. + (compute_barrier_args_size): Handle insns in annulled branches + properly. + +2008-11-20 Uros Bizjak <ubizjak@gmail.com> + + PR target/38151 + * config/i386/i386.c (classify_argument) [integer mode size <= 64bit]: + Handle cases when integer argument crosses argument register boundary. + +2008-11-20 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + PR bootstrap/33100 + * config.gcc (i[34567]86-*-solaris2*): Don't include + i386/t-crtstuff here. + Move extra_parts, i386/t-sol2 in tmake_file to libgcc/config.host. + * config/i386/t-sol2: Move to libgcc/config/i386. + +2008-11-20 Samuel Thibault <samuel.thibault@ens-lyon.org> + + PR driver/21706 + * tlink.c: Include "libiberty.h". + (initial_cwd): Change type into char *. + (tlink_init): Call getpwd instead of getcwd. + +2008-11-19 Zdenek Dvorak <ook@ucw.cz> + + PR rtl-optimization/32283 + * tree-ssa-loop-niter.c (scev_probably_wraps_p): Use type of the base + of the induction variable to decide whether it may wrap. + * tree-ssa-loop-ivopts.c (rewrite_use_compare): Emit the + initialization of the bound before the loop. + * simplify-rtx.c (simplify_binary_operation_1): Add two + simplifications regarding AND. + (simplify_plus_minus): Only fail if no simplification is possible. + * loop-iv.c (simple_rhs_p): Consider reg + reg and reg << cst simple. + 2008-11-20 Jakub Jelinek <jakub@redhat.com> PR c++/36631 @@ -37,8 +418,7 @@ PR bootstrap/37790 * ira-int.h (ira_copy_allocno_live_range_list, - ira_merge_allocno_live_ranges, - ira_allocno_live_ranges_intersect_p, + ira_merge_allocno_live_ranges, ira_allocno_live_ranges_intersect_p, ira_finish_allocno_live_range_list): New prototypes. (ira_allocno_live_ranges_intersect_p, ira_pseudo_live_ranges_intersect_p): Remove. @@ -46,8 +426,7 @@ * ira-conflicts.c (ira_allocno_live_ranges_intersect_p, ira_pseudo_live_ranges_intersect_p): Rename to allocnos_have_intersected_live_ranges_p and - pseudos_have_intersected_live_ranges_p. Move them from here to - ... + pseudos_have_intersected_live_ranges_p. Move them from here to ... * ira-color.c: ... here (coalesced_allocno_conflict_p): Use @@ -85,8 +464,7 @@ 2008-11-19 Richard Guenther <rguenther@suse.de> * tree.c (build2_stat): Allow non-POINTER_PLUS_EXPRs with - non-sizetype offsets if their precision matches that of - the pointer. + non-sizetype offsets if their precision matches that of the pointer. * expr.c (expand_expr_real_1): Always sign-extend the offset operand of a POINTER_PLUS_EXPR. @@ -107,12 +485,13 @@ 2008-11-19 Razya Ladelsky <razya@il.ibm.com> - PR target/38156 - * tree-parloops.c (loop_parallel_p): NULL vect_dump. + PR target/38156 + * tree-parloops.c (loop_parallel_p): NULL vect_dump. (separate_decls_in_region): Create shared struct even when there are only reductions. 2008-11-19 Hariharan Sandanagobalane <hariharan@picochip.com> + * config/picochip/picochip.c (headers): Remove an unnecessary header file. @@ -245,7 +624,7 @@ 2008-11-16 Eric Botcazou <ebotcazou@adacore.com> * config/sparc/sparc.c (function_arg_vector_value): Remove 'base_mode' - parameter. Use DImode for computing the number of registers. + parameter. Use DImode for computing the number of registers. (function_arg): Adjust for above change. (function_value): Likewise. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6f3acd5eda1..d2b51446232 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20081120 +20081128 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5596c1b5f82..b212a113655 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2008-11-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c: Fix various nits. + +2008-11-20 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/utils.c (init_gigi_decls): Fix type mismatch. + 2008-11-16 Eric Botcazou <ebotcazou@adacore.com> PR ada/38127 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index be30b85d764..14fcd634b61 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -76,7 +76,7 @@ support it and use FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN for this purpose. It is defined on targets where the circuitry is available, and indicates - whether the realignment is needed for 'main'. We use this to decide for + whether the realignment is needed for 'main'. We use this to decide for foreign subprograms as well. It is not defined on targets where the circuitry is not implemented, and @@ -181,7 +181,7 @@ gnat_to_gnu_type (Entity_Id gnat_entity) defining identifier. If GNAT_ENTITY is a variable or a constant declaration, GNU_EXPR gives its - initial value (in GCC tree form). This is optional for variables. + initial value (in GCC tree form). This is optional for variables. For renamed entities, GNU_EXPR gives the object being renamed. DEFINITION is nonzero if this call is intended for a definition. This is @@ -198,7 +198,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree gnu_entity_id; tree gnu_type = NULL_TREE; /* Contains the gnu XXXX_DECL tree node which is equivalent to the input - GNAT tree. This node will be associated with the GNAT node by calling + GNAT tree. This node will be associated with the GNAT node by calling the save_gnu_tree routine at the end of the `switch' statement. */ tree gnu_decl = NULL_TREE; /* true if we have already saved gnu_decl as a gnat association. */ @@ -231,7 +231,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) unsigned int align = 0; /* Since a use of an Itype is a definition, process it as such if it - is not in a with'ed unit. */ + is not in a with'ed unit. */ if (!definition && Is_Itype (gnat_entity) && !present_gnu_tree (gnat_entity) @@ -437,7 +437,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case E_Discriminant: case E_Component: { - /* The GNAT record where the component was defined. */ + /* The GNAT record where the component was defined. */ Entity_Id gnat_record = Underlying_Type (Scope (gnat_entity)); /* If the variable is an inherited record component (in the case of @@ -468,7 +468,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else if (Present (Corresponding_Discriminant (gnat_entity)) && Is_Tagged_Type (gnat_record)) { - /* A tagged record has no explicit stored discriminants. */ + /* A tagged record has no explicit stored discriminants. */ gcc_assert (First_Discriminant (gnat_record) == First_Stored_Discriminant (gnat_record)); @@ -488,8 +488,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) break; } - /* If the enclosing record has explicit stored discriminants, - then it is an untagged record. If the Corresponding_Discriminant + /* If the enclosing record has explicit stored discriminants, then + it is an untagged record. If the Corresponding_Discriminant is not empty then this must be a renamed discriminant and its Original_Record_Component must point to the corresponding explicit stored discriminant (i.e., we should have taken the first @@ -532,7 +532,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else /* Here we have no GCC type and this is a reference rather than a - definition. This should never happen. Most likely the cause is a + definition. This should never happen. Most likely the cause is reference before declaration in the gnat tree for gnat_entity. */ gcc_unreachable (); } @@ -597,7 +597,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = get_base_type (gnu_type); /* Reject non-renamed objects whose types are unconstrained arrays or - any object whose type is a dummy type or VOID_TYPE. */ + any object whose type is a dummy type or VOID_TYPE. */ if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE && No (Renamed_Object (gnat_entity))) @@ -624,8 +624,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } /* If we are defining the object, see if it has a Size value and - validate it if so. If we are not defining the object and a Size - clause applies, simply retrieve the value. We don't want to ignore + validate it if so. If we are not defining the object and a Size + clause applies, simply retrieve the value. We don't want to ignore the clause and it is expected to have been validated already. Then get the new type, if any. */ if (definition) @@ -762,7 +762,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) type and validate it. ??? Note that we ignore Has_Volatile_Components on objects; it's - not at all clear what to do in that case. */ + not at all clear what to do in that case. */ if (Has_Atomic_Components (gnat_entity)) { @@ -1410,16 +1410,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case E_Enumeration_Type: /* A special case, for the types Character and Wide_Character in - Standard, we do not list all the literals. So if the literals + Standard, we do not list all the literals. So if the literals are not specified, make this an unsigned type. */ if (No (First_Literal (gnat_entity))) { gnu_type = make_unsigned_type (esize); TYPE_NAME (gnu_type) = gnu_entity_id; - /* Set the TYPE_STRING_FLAG for Ada Character and - Wide_Character types. This is needed by the dwarf-2 debug writer to - distinguish between unsigned integer types and character types. */ + /* Set TYPE_STRING_FLAG for Ada Character and Wide_Character types. + This is needed by the DWARF-2 back-end to distinguish between + unsigned integer types and character types. */ TYPE_STRING_FLAG (gnu_type) = 1; break; } @@ -1563,7 +1563,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) unit and one of our bounds is non-static. We do this to ensure consistent naming in the case where several subtypes share the same bounds by always elaborating the first such subtype first, thus - using its name. */ + using its name. */ if (!definition && Present (Ancestor_Subtype (gnat_entity)) @@ -1917,7 +1917,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) build_range_type (gnu_ind_subtype, gnu_min, gnu_max), gnat_entity); - /* Update the maximum size of the array, in elements. */ + /* Update the maximum size of the array, in elements. */ gnu_max_size = size_binop (MULT_EXPR, gnu_max_size, size_binop (PLUS_EXPR, size_one_node, @@ -1954,7 +1954,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) check_ok_for_atomic (tem, gnat_entity, true); /* Get and validate any specified Component_Size, but if Packed, - ignore it since the front end will have taken care of it. */ + ignore it since the front end will have taken care of it. */ gnu_comp_size = validate_size (Component_Size (gnat_entity), tem, gnat_entity, @@ -2319,7 +2319,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = make_packable_type (gnu_type, false); /* Get and validate any specified Component_Size, but if Packed, - ignore it since the front end will have taken care of it. */ + ignore it since the front end will have taken care of it. */ gnu_comp_size = validate_size (Component_Size (gnat_entity), gnu_type, gnat_entity, @@ -2571,14 +2571,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } } - /* Abort if packed array with no packed array type field set. */ + /* Abort if packed array with no packed array type field set. */ else gcc_assert (!Is_Packed (gnat_entity)); break; case E_String_Literal_Subtype: - /* Create the type for a string literal. */ + /* Create the type for a string literal. */ { Entity_Id gnat_full_type = (IN (Ekind (Etype (gnat_entity)), Private_Kind) @@ -2637,7 +2637,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) Processing of a record type definition comprises starting the list of field declarations here from the discriminants and the calling the function components_to_record to add the rest of the fields from the - component list and return the gnu type node. The function + component list and return the gnu type node. The function components_to_record will call itself recursively as it traverses the tree. */ @@ -2870,14 +2870,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_BY_REFERENCE_P (gnu_type) = Is_By_Reference_Type (gnat_entity); /* If it is a tagged record force the type to BLKmode to insure - that these objects will always be placed in memory. Do the - same thing for limited record types. */ + that these objects will always be placed in memory. Do the + same thing for limited record types. */ if (Is_Tagged_Type (gnat_entity) || Is_Limited_Record (gnat_entity)) TYPE_MODE (gnu_type) = BLKmode; /* If this is a derived type, we must make the alias set of this type the same as that of the type we are derived from. We assume here - that the other type is already frozen. */ + that the other type is already frozen. */ if (Etype (gnat_entity) != gnat_entity && !(Is_Private_Type (Etype (gnat_entity)) && Full_View (Etype (gnat_entity)) == gnat_entity)) @@ -3305,7 +3305,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Nonzero if we make a dummy type here. */ bool got_fat_p = false; - /* Nonzero if the dummy is a fat pointer. */ + /* Nonzero if the dummy is a fat pointer. */ bool made_dummy = false; tree gnu_desig_type = NULL_TREE; enum machine_mode p_mode = mode_for_size (esize, MODE_INT, 0); @@ -3436,7 +3436,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) are to defer elaborating incomplete types. We do this since this access type may be the full view of some private type. Note that the unconstrained array case is - handled above. */ + handled above. */ || ((! in_main_unit || imported_p) && defer_incomplete_level != 0 && ! present_gnu_tree (gnat_desig_equiv) @@ -3450,7 +3450,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) when the declaration is processed. In both cases, the pointer eventually created below will be automatically adjusted when the Freeze_Node is processed. Note that the - unconstrained array case is handled above. */ + unconstrained array case is handled above. */ || (in_main_unit && is_from_limited_with && Present (Freeze_Node (gnat_desig_rep)))) { @@ -3499,7 +3499,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_QUALS (gnu_desig_type) | TYPE_QUAL_CONST); /* Some extra processing is required if we are building a - pointer to an incomplete type (in the GCC sense). We might + pointer to an incomplete type (in the GCC sense). We might have such a type if we just made a dummy, or directly out of the call to gnat_to_gnu_type above if we are processing an access type for a record component designating the @@ -3508,16 +3508,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { /* We must ensure that the pointer to variant we make will be processed by update_pointer_to when the initial type - is completed. Pretend we made a dummy and let further + is completed. Pretend we made a dummy and let further processing act as usual. */ made_dummy = true; /* We must ensure that update_pointer_to will not retrieve the dummy variant when building a properly qualified - version of the complete type. We take advantage of the + version of the complete type. We take advantage of the fact that get_qualified_type is requiring TYPE_NAMEs to match to influence build_qualified_type and then also - update_pointer_to here. */ + update_pointer_to here. */ TYPE_NAME (gnu_desig_type) = create_concat_name (gnat_desig_type, "INCOMPLETE_CST"); } @@ -3574,7 +3574,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) node as the one we got. Besides, variants of this non-dummy type might have been - created along the way. update_pointer_to is expected to + created along the way. update_pointer_to is expected to properly take care of those situations. */ else { @@ -3602,9 +3602,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_type = ptr_void_type_node; else { - /* The runtime representation is the equivalent type. */ + /* The runtime representation is the equivalent type. */ gnu_type = gnat_to_gnu_type (gnat_equiv_type); - maybe_present = 1; + maybe_present = true; } if (Is_Itype (Directly_Designated_Type (gnat_entity)) @@ -3622,12 +3622,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) meaningful only to the front end. The designated type must be elaborated as well, if it does - not have its own freeze node. Designated (sub)types created + not have its own freeze node. Designated (sub)types created for constrained components of records with discriminants are not frozen by the front end and thus not elaborated by gigi, because their use may appear before the base type is frozen, and because it is not clear that they are needed anywhere in - Gigi. With the current model, there is no correct place where + Gigi. With the current model, there is no correct place where they could be elaborated. */ gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); @@ -3669,7 +3669,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) First_Formal The first formal parameter. Is_Imported Indicates that the subprogram has appeared in - an INTERFACE or IMPORT pragma. For now we + an INTERFACE or IMPORT pragma. For now we assume that the external language is C. Is_Exported Likewise but for an EXPORT pragma. Is_Inlined True if the subprogram is to be inlined. @@ -3683,7 +3683,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) are copied in, if they are Ada In Out or Out parameters, their return value becomes part of a record which becomes the return type of the function (C function - note that this applies only to Ada procedures - so there is no Ada return type). Additional code to store back the + so there is no Ada return type). Additional code to store back the parameters will be generated on the caller side. This transformation is done here, not in the front-end. @@ -3716,7 +3716,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tree gnu_param_list = NULL_TREE; /* Likewise for the stub associated with an exported procedure. */ tree gnu_stub_param_list = NULL_TREE; - /* The type returned by a function. If the subprogram is a procedure + /* The type returned by a function. If the subprogram is a procedure this type should be void_type_node. */ tree gnu_return_type = void_type_node; /* List of fields in return type of procedure with copy-in copy-out @@ -3802,7 +3802,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* ??? What if we don't find the builtin node above ? warn ? err ? In the current state we neither warn nor err, and calls will just - be handled as for regular subprograms. */ + be handled as for regular subprograms. */ if (kind == E_Function || kind == E_Subprogram_Type) gnu_return_type = gnat_to_gnu_type (Etype (gnat_entity)); @@ -4071,7 +4071,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* A subprogram (something that doesn't return anything) shouldn't be considered const since there would be no reason for such a subprogram. Note that procedures with Out (or In Out) parameters - have already been converted into a function with a return type. */ + have already been converted into a function with a return type. */ if (TREE_CODE (gnu_return_type) == VOID_TYPE) const_flag = false; @@ -4537,7 +4537,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { /* In this mode the tag and the parent components are not generated by the front-end, so the sizes must be adjusted - explicitly now. */ + explicitly now. */ int size_offset, new_size; if (Is_Derived_Type (gnat_entity)) @@ -4571,7 +4571,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) DECL_IGNORED_P (gnu_decl) = 1; /* If we haven't already, associate the ..._DECL node that we just made with - the input GNAT entity node. */ + the input GNAT entity node. */ if (!saved) save_gnu_tree (gnat_entity, gnu_decl, false); @@ -5054,7 +5054,7 @@ elaborate_entity (Entity_Id gnat_entity) /* ??? Tests for avoiding static constraint error expression is needed until the front stops generating bogus conversions - on bounds of real types. */ + on bounds of real types. */ if (!Raises_Constraint_Error (gnat_lb)) elaborate_expression (gnat_lb, gnat_entity, get_identifier ("L"), @@ -5177,7 +5177,7 @@ copy_alias_set (tree gnu_new_type, tree gnu_old_type) /* Return a TREE_LIST describing the substitutions needed to reflect discriminant substitutions from GNAT_SUBTYPE to GNAT_TYPE and add them to GNU_LIST. If GNAT_TYPE is not specified, use the base type - of GNAT_SUBTYPE. The substitutions can be in any order. TREE_PURPOSE + of GNAT_SUBTYPE. The substitutions can be in any order. TREE_PURPOSE gives the tree for the discriminant and TREE_VALUES is the replacement value. They are in the form of operands to substitute_in_expr. DEFINITION is as in gnat_to_gnu_entity. */ @@ -5406,7 +5406,7 @@ elaborate_expression (Node_Id gnat_expr, Entity_Id gnat_entity, gnu_name, definition, need_debug); /* Save the expression in case we try to elaborate this entity again. Since - this is not a DECL, don't check it. Don't save if it's a discriminant. */ + it's not a DECL, don't check it. Don't save if it's a discriminant. */ if (!CONTAINS_PLACEHOLDER_P (gnu_expr)) save_gnu_tree (gnat_expr, gnu_expr, true); @@ -5869,7 +5869,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, /* Unless debugging information isn't being written for the input type, write a record that shows what we are a subtype of and also make a - variable that indicates our size, if still variable. */ + variable that indicates our size, if still variable. */ if (TYPE_NAME (record) && AGGREGATE_TYPE_P (type) && TREE_CODE (orig_size) != INTEGER_CST @@ -6012,7 +6012,9 @@ choices_to_gnu (tree operand, Node_Id choices) operand, high)); break; } + /* ... fall through ... */ + case N_Character_Literal: case N_Integer_Literal: single = gnat_to_gnu (choice); @@ -6445,7 +6447,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, } } - save_gnu_tree (gnat_field, gnu_field, false); + save_gnu_tree (gnat_field, gnu_field, false); } /* At the end of the component list there may be a variant part. */ @@ -6654,7 +6656,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, else if (gnu_our_rep_list) { /* Otherwise, sort the fields by bit position and put them into their - own record if we have any fields without rep clauses. */ + own record if we have any fields without rep clauses. */ tree gnu_rep_type = (gnu_field_list ? make_node (RECORD_TYPE) : gnu_record_type); int len = list_length (gnu_our_rep_list); @@ -7009,7 +7011,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, return NULL_TREE; /* Get the size as a tree. Give an error if a size was specified, but cannot - be represented as in sizetype. */ + be represented as in sizetype. */ size = UI_To_gnu (uint_size, bitsizetype); if (TREE_OVERFLOW (size)) { @@ -7391,7 +7393,7 @@ check_ok_for_atomic (tree object, Entity_Id gnat_entity, bool comp_p) /* Check if FTYPE1 and FTYPE2, two potentially different function type nodes, have compatible signatures so that a call using one type may be safely - issued if the actual target function type is the other. Return 1 if it is + issued if the actual target function type is the other. Return 1 if it is the case, 0 otherwise, and post errors on the incompatibilities. This is used when an Ada subprogram is mapped onto a GCC builtin, to ensure @@ -7688,9 +7690,9 @@ create_concat_name (Entity_Id gnat_entity, const char *suffix) Get_External_Name_With_Suffix (gnat_entity, fp); /* A variable using the Stdcall convention (meaning we are running - on a Windows box) live in a DLL. Here we adjust its name to use + on a Windows box) live in a DLL. Here we adjust its name to use the jump-table, the _imp__NAME contains the address for the NAME - variable. */ + variable. */ if ((kind == E_Variable || kind == E_Constant) && Has_Stdcall_Convention (gnat_entity)) { diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 21904d4cb14..131b2376ac7 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -577,6 +577,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) /* Build the special descriptor type and its null node if needed. */ if (TARGET_VTABLE_USES_DESCRIPTORS) { + tree null_node = fold_convert (ptr_void_ftype, null_pointer_node); tree field_list = NULL_TREE, null_list = NULL_TREE; int j; @@ -588,7 +589,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) fdesc_type_node, 0, 0, 0, 1); TREE_CHAIN (field) = field_list; field_list = field; - null_list = tree_cons (field, null_pointer_node, null_list); + null_list = tree_cons (field, null_node, null_list); } finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); diff --git a/gcc/builtins.c b/gcc/builtins.c index fd6d0b859e0..a6ee5a96729 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -51,6 +51,10 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "diagnostic.h" +#ifndef SLOW_UNALIGNED_ACCESS +#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT +#endif + #ifndef PAD_VARARGS_DOWN #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN #endif @@ -1432,7 +1436,7 @@ expand_builtin_apply_args (void) chain current, so the code is placed at the start of the function. */ push_topmost_sequence (); - emit_insn_before (seq, NEXT_INSN (entry_of_function ())); + emit_insn_before (seq, parm_birth_insn); pop_topmost_sequence (); return temp; } @@ -8824,10 +8828,12 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i else { tree srctype, desttype; + int src_align, dest_align; + if (endp == 3) { - int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); - int dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); /* Both DEST and SRC must be pointer types. ??? This is what old code did. Is the testing for pointer types @@ -8862,44 +8868,95 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i || !TYPE_SIZE_UNIT (srctype) || !TYPE_SIZE_UNIT (desttype) || TREE_CODE (TYPE_SIZE_UNIT (srctype)) != INTEGER_CST - || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST - || !tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len) - || !tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len)) + || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST) return NULL_TREE; - if (get_pointer_alignment (dest, BIGGEST_ALIGNMENT) - < (int) TYPE_ALIGN (desttype) - || (get_pointer_alignment (src, BIGGEST_ALIGNMENT) - < (int) TYPE_ALIGN (srctype))) + src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); + dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); + if (dest_align < (int) TYPE_ALIGN (desttype) + || src_align < (int) TYPE_ALIGN (srctype)) return NULL_TREE; if (!ignore) dest = builtin_save_expr (dest); - srcvar = build_fold_indirect_ref (src); - if (TREE_THIS_VOLATILE (srcvar)) - return NULL_TREE; - if (!tree_int_cst_equal (lang_hooks.expr_size (srcvar), len)) - return NULL_TREE; - /* With memcpy, it is possible to bypass aliasing rules, so without - this check i.e. execute/20060930-2.c would be misoptimized, because - it use conflicting alias set to hold argument for the memcpy call. - This check is probably unnecessary with -fno-strict-aliasing. - Similarly for destvar. See also PR29286. */ - if (!var_decl_component_p (srcvar) - /* Accept: memcpy (*char_var, "test", 1); that simplify - to char_var='t'; */ - || is_gimple_min_invariant (srcvar) - || readonly_data_expr (src)) + srcvar = NULL_TREE; + if (tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len)) + { + srcvar = build_fold_indirect_ref (src); + if (TREE_THIS_VOLATILE (srcvar)) + srcvar = NULL_TREE; + else if (!tree_int_cst_equal (lang_hooks.expr_size (srcvar), len)) + srcvar = NULL_TREE; + /* With memcpy, it is possible to bypass aliasing rules, so without + this check i.e. execute/20060930-2.c would be misoptimized, + because it use conflicting alias set to hold argument for the + memcpy call. This check is probably unnecessary with + -fno-strict-aliasing. Similarly for destvar. See also + PR29286. */ + else if (!var_decl_component_p (srcvar)) + srcvar = NULL_TREE; + } + + destvar = NULL_TREE; + if (tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len)) + { + destvar = build_fold_indirect_ref (dest); + if (TREE_THIS_VOLATILE (destvar)) + destvar = NULL_TREE; + else if (!tree_int_cst_equal (lang_hooks.expr_size (destvar), len)) + destvar = NULL_TREE; + else if (!var_decl_component_p (destvar)) + destvar = NULL_TREE; + } + + if (srcvar == NULL_TREE && destvar == NULL_TREE) return NULL_TREE; - destvar = build_fold_indirect_ref (dest); - if (TREE_THIS_VOLATILE (destvar)) - return NULL_TREE; - if (!tree_int_cst_equal (lang_hooks.expr_size (destvar), len)) - return NULL_TREE; - if (!var_decl_component_p (destvar)) - return NULL_TREE; + if (srcvar == NULL_TREE) + { + tree srcptype; + if (TREE_ADDRESSABLE (TREE_TYPE (destvar))) + return NULL_TREE; + + srctype = desttype; + if (src_align < (int) TYPE_ALIGN (srctype)) + { + if (AGGREGATE_TYPE_P (srctype) + || SLOW_UNALIGNED_ACCESS (TYPE_MODE (srctype), src_align)) + return NULL_TREE; + + srctype = build_variant_type_copy (srctype); + TYPE_ALIGN (srctype) = src_align; + TYPE_USER_ALIGN (srctype) = 1; + TYPE_PACKED (srctype) = 1; + } + srcptype = build_pointer_type_for_mode (srctype, ptr_mode, true); + src = fold_convert (srcptype, src); + srcvar = build_fold_indirect_ref (src); + } + else if (destvar == NULL_TREE) + { + tree destptype; + if (TREE_ADDRESSABLE (TREE_TYPE (srcvar))) + return NULL_TREE; + + desttype = srctype; + if (dest_align < (int) TYPE_ALIGN (desttype)) + { + if (AGGREGATE_TYPE_P (desttype) + || SLOW_UNALIGNED_ACCESS (TYPE_MODE (desttype), dest_align)) + return NULL_TREE; + + desttype = build_variant_type_copy (desttype); + TYPE_ALIGN (desttype) = dest_align; + TYPE_USER_ALIGN (desttype) = 1; + TYPE_PACKED (desttype) = 1; + } + destptype = build_pointer_type_for_mode (desttype, ptr_mode, true); + dest = fold_convert (destptype, dest); + destvar = build_fold_indirect_ref (dest); + } if (srctype == desttype || (gimple_in_ssa_p (cfun) diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 2d0925a4686..002f76054a1 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -1216,10 +1216,12 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) /* ??? It would be nice if we could exclude the already / still saved registers from the live sets. */ COPY_REG_SET (&new_chain->live_throughout, &chain->live_throughout); - /* Registers that die in CHAIN->INSN still live in the new insn. */ + /* Registers that die in CHAIN->INSN still live in the new insn. + Likewise for those which are autoincremented or autodecremented. */ for (link = REG_NOTES (chain->insn); link; link = XEXP (link, 1)) { - if (REG_NOTE_KIND (link) == REG_DEAD) + enum reg_note kind = REG_NOTE_KIND (link); + if (kind == REG_DEAD || kind == REG_INC) { rtx reg = XEXP (link, 0); int regno, i; diff --git a/gcc/calls.c b/gcc/calls.c index 096dde4948c..e2c4fcb8a65 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -132,7 +132,7 @@ static void store_unaligned_arguments_into_pseudos (struct arg_data *, int); static int finalize_must_preallocate (int, int, struct arg_data *, struct args_size *); static void precompute_arguments (int, struct arg_data *); -static int compute_argument_block_size (int, struct args_size *, tree, int); +static int compute_argument_block_size (int, struct args_size *, tree, tree, int); static void initialize_argument_information (int, struct arg_data *, struct args_size *, int, tree, tree, @@ -1205,6 +1205,7 @@ static int compute_argument_block_size (int reg_parm_stack_space, struct args_size *args_size, tree fndecl ATTRIBUTE_UNUSED, + tree fntype ATTRIBUTE_UNUSED, int preferred_stack_boundary ATTRIBUTE_UNUSED) { int unadjusted_args_size = args_size->constant; @@ -1242,7 +1243,7 @@ compute_argument_block_size (int reg_parm_stack_space, /* The area corresponding to register parameters is not to count in the size of the block we need. So make the adjustment. */ - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) args_size->var = size_binop (MINUS_EXPR, args_size->var, ssize_int (reg_parm_stack_space)); @@ -1263,7 +1264,7 @@ compute_argument_block_size (int reg_parm_stack_space, args_size->constant = MAX (args_size->constant, reg_parm_stack_space); - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) args_size->constant -= reg_parm_stack_space; } return unadjusted_args_size; @@ -2077,10 +2078,10 @@ expand_call (tree exp, rtx target, int ignore) } #ifdef REG_PARM_STACK_SPACE - reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl); + reg_parm_stack_space = REG_PARM_STACK_SPACE (!fndecl ? fntype : fndecl); #endif - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))) && reg_parm_stack_space > 0 && PUSH_ARGS) must_preallocate = 1; @@ -2404,7 +2405,7 @@ expand_call (tree exp, rtx target, int ignore) unadjusted_args_size = compute_argument_block_size (reg_parm_stack_space, &adjusted_args_size, - fndecl, + fndecl, fntype, (pass == 0 ? 0 : preferred_stack_boundary)); @@ -2480,7 +2481,7 @@ expand_call (tree exp, rtx target, int ignore) /* Since we will be writing into the entire argument area, the map must be allocated for its entire size, not just the part that is the responsibility of the caller. */ - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) needed += reg_parm_stack_space; #ifdef ARGS_GROW_DOWNWARD @@ -2579,7 +2580,7 @@ expand_call (tree exp, rtx target, int ignore) { rtx push_size = GEN_INT (adjusted_args_size.constant - + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL + + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))) ? 0 : reg_parm_stack_space)); if (old_stack_level == 0) @@ -2750,7 +2751,7 @@ expand_call (tree exp, rtx target, int ignore) /* If register arguments require space on the stack and stack space was not preallocated, allocate stack space here for arguments passed in registers. */ - if (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))) + if (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))) && !ACCUMULATE_OUTGOING_ARGS && must_preallocate == 0 && reg_parm_stack_space > 0) anti_adjust_stack (GEN_INT (reg_parm_stack_space)); @@ -3230,6 +3231,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, /* Todo, choose the correct decl type of orgfun. Sadly this information isn't present here, so we default to native calling abi here. */ tree fndecl ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */ + tree fntype ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */ int inc; int count; rtx argblock = 0; @@ -3487,7 +3489,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, args_size.constant = MAX (args_size.constant, reg_parm_stack_space); - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) args_size.constant -= reg_parm_stack_space; if (args_size.constant > crtl->outgoing_args_size) @@ -3512,7 +3514,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, /* Since we will be writing into the entire argument area, the map must be allocated for its entire size, not just the part that is the responsibility of the caller. */ - if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))) + if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))) needed += reg_parm_stack_space; #ifdef ARGS_GROW_DOWNWARD diff --git a/gcc/config.gcc b/gcc/config.gcc index ae60bcd9155..b0e9340bc78 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -298,7 +298,7 @@ i[34567]86-*-*) extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h nmmintrin.h bmmintrin.h mmintrin-common.h - wmmintrin.h gmmintrin.h cross-stdarg.h" + wmmintrin.h immintrin.h avxintrin.h cross-stdarg.h" ;; x86_64-*-*) cpu_type=i386 @@ -307,7 +307,7 @@ x86_64-*-*) extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h nmmintrin.h bmmintrin.h mmintrin-common.h - wmmintrin.h gmmintrin.h cross-stdarg.h" + wmmintrin.h immintrin.h avxintrin.h cross-stdarg.h" need_64bit_hwint=yes ;; ia64-*-*) @@ -1173,7 +1173,7 @@ i[34567]86-*-solaris2*) ;; esac tm_file="${tm_file} i386/sol2.h" - tmake_file="${tmake_file} t-sol2 i386/t-sol2 t-svr4" + tmake_file="${tmake_file} t-sol2 t-svr4" c_target_objs="${c_target_objs} sol2-c.o" cxx_target_objs="${cxx_target_objs} sol2-c.o" extra_objs="sol2.o" @@ -1192,7 +1192,10 @@ i[34567]86-*-solaris2*) *-*-solaris2.1[0-9]*) tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h" tm_defines="${tm_defines} TARGET_BI_ARCH=1" - tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10" + tmake_file="$tmake_file i386/t-sol2-10" + # i386/t-crtstuff only affects libgcc. Its inclusion + # depends on a runtime test and is thus performed in + # libgcc/configure.ac instead. need_64bit_hwint=yes case X"${with_cpu}" in Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) @@ -1208,12 +1211,6 @@ i[34567]86-*-solaris2*) exit 1 ;; esac - # Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as - # part of the base system. - extra_parts="gmon.o crtbegin.o crtend.o" - ;; - *) - extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" ;; esac case ${enable_threads}:${have_pthread_h}:${have_thread_h} in diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 071f622d08c..b60ba831d15 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -10836,6 +10836,7 @@ } default: assemble_integer (operands[0], 4, BITS_PER_WORD, 1); + mark_symbol_refs_as_used (operands[0]); break; } return \"\"; diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md index 3278b63f015..14b52d0af84 100644 --- a/gcc/config/arm/thumb2.md +++ b/gcc/config/arm/thumb2.md @@ -949,7 +949,7 @@ (label_ref (match_operand 2 "" "")))) (label_ref (match_operand 3 "" "")))) (clobber (reg:CC CC_REGNUM)) - (clobber (match_scratch:SI 4 "=r")) + (clobber (match_scratch:SI 4 "=&r")) (use (label_ref (match_dup 2)))])] "TARGET_THUMB2 && !flag_pic" "* return thumb2_output_casesi(operands);" @@ -966,7 +966,7 @@ (label_ref (match_operand 2 "" "")))) (label_ref (match_operand 3 "" "")))) (clobber (reg:CC CC_REGNUM)) - (clobber (match_scratch:SI 4 "=r")) + (clobber (match_scratch:SI 4 "=&r")) (clobber (match_scratch:SI 5 "=r")) (use (label_ref (match_dup 2)))])] "TARGET_THUMB2 && flag_pic" diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h index 523c673ba43..3e9ae4317c3 100644 --- a/gcc/config/bfin/bfin-protos.h +++ b/gcc/config/bfin/bfin-protos.h @@ -75,6 +75,11 @@ extern unsigned int bfin_workarounds; #define ENABLE_WA_RETS \ (bfin_workarounds & WA_RETS) +/* For the anomaly 05-00-0426 */ +#define WA_INDIRECT_CALLS 0x00000008 +#define ENABLE_WA_INDIRECT_CALLS \ + ((bfin_workarounds & WA_INDIRECT_CALLS) && !TARGET_ICPLB) + #define WA_05000257 0x00000040 #define ENABLE_WA_05000257 \ (bfin_workarounds & WA_05000257) diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index e9c6297513c..949ceaca015 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -254,39 +254,39 @@ struct bfin_cpu bfin_cpus[] = | WA_05000283 | WA_05000257 | WA_05000315}, {"bf542", BFIN_CPU_BF542, 0x0002, - WA_SPECULATIVE_LOADS}, + WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS}, {"bf542", BFIN_CPU_BF542, 0x0001, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf542", BFIN_CPU_BF542, 0x0000, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf544", BFIN_CPU_BF544, 0x0002, - WA_SPECULATIVE_LOADS}, + WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS}, {"bf544", BFIN_CPU_BF544, 0x0001, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf544", BFIN_CPU_BF544, 0x0000, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf547", BFIN_CPU_BF547, 0x0002, - WA_SPECULATIVE_LOADS}, + WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS}, {"bf547", BFIN_CPU_BF547, 0x0001, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf547", BFIN_CPU_BF547, 0x0000, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf548", BFIN_CPU_BF548, 0x0002, - WA_SPECULATIVE_LOADS}, + WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS}, {"bf548", BFIN_CPU_BF548, 0x0001, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf548", BFIN_CPU_BF548, 0x0000, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf549", BFIN_CPU_BF549, 0x0002, - WA_SPECULATIVE_LOADS}, + WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS}, {"bf549", BFIN_CPU_BF549, 0x0001, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf549", BFIN_CPU_BF549, 0x0000, - WA_SPECULATIVE_LOADS | WA_RETS}, + WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS}, {"bf561", BFIN_CPU_BF561, 0x0005, WA_RETS | WA_05000283 | WA_05000315}, @@ -4921,6 +4921,22 @@ find_load (rtx insn) return NULL_RTX; } +/* Determine whether PAT is an indirect call pattern. */ +static bool +indirect_call_p (rtx pat) +{ + if (GET_CODE (pat) == PARALLEL) + pat = XVECEXP (pat, 0, 0); + if (GET_CODE (pat) == SET) + pat = SET_SRC (pat); + gcc_assert (GET_CODE (pat) == CALL); + pat = XEXP (pat, 0); + gcc_assert (GET_CODE (pat) == MEM); + pat = XEXP (pat, 0); + + return REG_P (pat); +} + static void workaround_speculation (void) { @@ -4929,7 +4945,8 @@ workaround_speculation (void) int cycles_since_jump = INT_MAX; int delay_added = 0; - if (! ENABLE_WA_SPECULATIVE_LOADS && ! ENABLE_WA_SPECULATIVE_SYNCS) + if (! ENABLE_WA_SPECULATIVE_LOADS && ! ENABLE_WA_SPECULATIVE_SYNCS + && ! ENABLE_WA_INDIRECT_CALLS) return; /* First pass: find predicted-false branches; if something after them @@ -4962,6 +4979,15 @@ workaround_speculation (void) else cycles_since_jump = INT_MAX; } + else if (CALL_P (insn)) + { + if (cycles_since_jump < INT_MAX) + cycles_since_jump++; + if (indirect_call_p (pat) && ENABLE_WA_INDIRECT_CALLS) + { + delay_needed = 3; + } + } else if (INSN_P (insn)) { rtx load_insn = find_load (insn); diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index a5ab7f5a346..8193ff3a747 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -149,8 +149,10 @@ extern int target_flags; builtin_define ("__WORKAROUND_SPECULATIVE_LOADS"); \ if (ENABLE_WA_SPECULATIVE_SYNCS) \ builtin_define ("__WORKAROUND_SPECULATIVE_SYNCS"); \ + if (ENABLE_WA_INDIRECT_CALLS) \ + builtin_define ("__WORKAROUND_INDIRECT_CALLS"); \ if (ENABLE_WA_RETS) \ - builtin_define ("__WORKAROUND_RETS"); \ + builtin_define ("__WORKAROUND_RETS"); \ \ if (TARGET_FDPIC) \ { \ diff --git a/gcc/config/bfin/bfin.opt b/gcc/config/bfin/bfin.opt index 9df88432d54..633e13598bb 100644 --- a/gcc/config/bfin/bfin.opt +++ b/gcc/config/bfin/bfin.opt @@ -95,3 +95,7 @@ Build for Core B msdram Target Report Mask(SDRAM) Build for SDRAM + +micplb +Target Report Mask(ICPLB) +Assume ICPLBs are enabled at runtime. diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h index b5732011224..b786dcb6fff 100644 --- a/gcc/config/bfin/linux.h +++ b/gcc/config/bfin/linux.h @@ -1,6 +1,6 @@ #undef SUBTARGET_DRIVER_SELF_SPECS #define SUBTARGET_DRIVER_SELF_SPECS \ - "%{!mno-fdpic:-mfdpic}", + "%{!mno-fdpic:-mfdpic} -micplb", #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() diff --git a/gcc/config/i386/gmmintrin.h b/gcc/config/i386/avxintrin.h index 1c6bb18be83..7aea85d355d 100644 --- a/gcc/config/i386/gmmintrin.h +++ b/gcc/config/i386/avxintrin.h @@ -27,16 +27,9 @@ /* Implemented from the specification included in the Intel C++ Compiler User Guide and Reference, version 11.0. */ -#ifndef _GMMINTRIN_H_INCLUDED -#define _GMMINTRIN_H_INCLUDED - -#ifndef __AVX__ -# error "AVX instruction set not enabled" -#else - -/* We need definitions from the SSE4, SSSE3, SSE3, SSE2 and SSE header - files. */ -#include <smmintrin.h> +#ifndef _IMMINTRIN_H_INCLUDED +# error "Never use <avxintrin.h> directly; include <immintrin.h> instead." +#endif /* Internal data types for implementing the intrinsics. */ typedef double __v4df __attribute__ ((__vector_size__ (32))); @@ -1476,7 +1469,3 @@ _mm256_castsi128_si256 (__m128i __A) { return (__m256i) __builtin_ia32_si256_si ((__v4si)__A); } - -#endif /* __AVX__ */ - -#endif /* _GMMINTRIN_H_INCLUDED */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f84f326cef7..7f806d4dcc6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4112,6 +4112,11 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) && ix86_function_regparm (TREE_TYPE (decl), NULL) >= 3) return false; + /* If we need to align the outgoing stack, then sibcalling would + unalign the stack, which may break the called function. */ + if (ix86_incoming_stack_boundary < PREFERRED_STACK_BOUNDARY) + return false; + /* Otherwise okay. That also includes certain types of indirect calls. */ return true; } @@ -4547,9 +4552,11 @@ ix86_reg_parm_stack_space (const_tree fndecl) /* For libcalls it is possible that there is no fndecl at hand. Therefore assume for this case the default abi of the target. */ if (!fndecl) - call_abi = DEFAULT_ABI; - else + call_abi = (cfun ? cfun->machine->call_abi : DEFAULT_ABI); + else if (TREE_CODE (fndecl) == FUNCTION_DECL) call_abi = ix86_function_abi (fndecl); + else + call_abi = ix86_function_type_abi (fndecl); if (call_abi == 1) return 32; return 0; @@ -5029,11 +5036,33 @@ classify_argument (enum machine_mode mode, const_tree type, case CSImode: case CHImode: case CQImode: - if (bit_offset + GET_MODE_BITSIZE (mode) <= 32) - classes[0] = X86_64_INTEGERSI_CLASS; - else - classes[0] = X86_64_INTEGER_CLASS; - return 1; + { + int size = (bit_offset % 64)+ (int) GET_MODE_BITSIZE (mode); + + if (size <= 32) + { + classes[0] = X86_64_INTEGERSI_CLASS; + return 1; + } + else if (size <= 64) + { + classes[0] = X86_64_INTEGER_CLASS; + return 1; + } + else if (size <= 64+32) + { + classes[0] = X86_64_INTEGER_CLASS; + classes[1] = X86_64_INTEGERSI_CLASS; + return 2; + } + else if (size <= 64+64) + { + classes[0] = classes[1] = X86_64_INTEGER_CLASS; + return 2; + } + else + gcc_unreachable (); + } case CDImode: case TImode: classes[0] = classes[1] = X86_64_INTEGER_CLASS; @@ -6731,6 +6760,8 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, enum machine_mode mode = GET_MODE (reg); tree piece_type = lang_hooks.types.type_for_mode (mode, 1); tree addr_type = build_pointer_type (piece_type); + tree daddr_type = build_pointer_type_for_mode (piece_type, + ptr_mode, true); tree src_addr, src; int src_offset; tree dest_addr, dest; @@ -6750,8 +6781,8 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, size_int (src_offset)); src = build_va_arg_indirect_ref (src_addr); - dest_addr = fold_convert (addr_type, addr); - dest_addr = fold_build2 (POINTER_PLUS_EXPR, addr_type, dest_addr, + dest_addr = fold_convert (daddr_type, addr); + dest_addr = fold_build2 (POINTER_PLUS_EXPR, daddr_type, dest_addr, size_int (INTVAL (XEXP (slot, 1)))); dest = build_va_arg_indirect_ref (dest_addr); @@ -7746,6 +7777,11 @@ ix86_update_stack_boundary (void) TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) ix86_incoming_stack_boundary = MIN_STACK_BOUNDARY; + /* The incoming stack frame has to be aligned at least at + parm_stack_boundary. */ + if (ix86_incoming_stack_boundary < crtl->parm_stack_boundary) + ix86_incoming_stack_boundary = crtl->parm_stack_boundary; + /* Stack at entrance of main is aligned by runtime. We use the smallest incoming stack boundary. */ if (ix86_incoming_stack_boundary > MAIN_STACK_BOUNDARY @@ -20297,7 +20333,7 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_smulv4hi3_highpart, "__builtin_ia32_pmulhw", IX86_BUILTIN_PMULHW, UNKNOWN, (int) V4HI_FTYPE_V4HI_V4HI }, { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_andv2si3, "__builtin_ia32_pand", IX86_BUILTIN_PAND, UNKNOWN, (int) V2SI_FTYPE_V2SI_V2SI }, - { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_nandv2si3, "__builtin_ia32_pandn", IX86_BUILTIN_PANDN, UNKNOWN, (int) V2SI_FTYPE_V2SI_V2SI }, + { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_andnotv2si3, "__builtin_ia32_pandn", IX86_BUILTIN_PANDN, UNKNOWN, (int) V2SI_FTYPE_V2SI_V2SI }, { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_iorv2si3, "__builtin_ia32_por", IX86_BUILTIN_POR, UNKNOWN, (int) V2SI_FTYPE_V2SI_V2SI }, { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_xorv2si3, "__builtin_ia32_pxor", IX86_BUILTIN_PXOR, UNKNOWN, (int) V2SI_FTYPE_V2SI_V2SI }, @@ -20424,7 +20460,7 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_SSE, CODE_FOR_sse_vmsmaxv4sf3, "__builtin_ia32_maxss", IX86_BUILTIN_MAXSS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, { OPTION_MASK_ISA_SSE, CODE_FOR_andv4sf3, "__builtin_ia32_andps", IX86_BUILTIN_ANDPS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, - { OPTION_MASK_ISA_SSE, CODE_FOR_sse_nandv4sf3, "__builtin_ia32_andnps", IX86_BUILTIN_ANDNPS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, + { OPTION_MASK_ISA_SSE, CODE_FOR_sse_andnotv4sf3, "__builtin_ia32_andnps", IX86_BUILTIN_ANDNPS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, { OPTION_MASK_ISA_SSE, CODE_FOR_iorv4sf3, "__builtin_ia32_orps", IX86_BUILTIN_ORPS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, { OPTION_MASK_ISA_SSE, CODE_FOR_xorv4sf3, "__builtin_ia32_xorps", IX86_BUILTIN_XORPS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF }, @@ -20521,7 +20557,7 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_vmsmaxv2df3, "__builtin_ia32_maxsd", IX86_BUILTIN_MAXSD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, { OPTION_MASK_ISA_SSE2, CODE_FOR_andv2df3, "__builtin_ia32_andpd", IX86_BUILTIN_ANDPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, - { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_nandv2df3, "__builtin_ia32_andnpd", IX86_BUILTIN_ANDNPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, + { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_andnotv2df3, "__builtin_ia32_andnpd", IX86_BUILTIN_ANDNPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, { OPTION_MASK_ISA_SSE2, CODE_FOR_iorv2df3, "__builtin_ia32_orpd", IX86_BUILTIN_ORPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, { OPTION_MASK_ISA_SSE2, CODE_FOR_xorv2df3, "__builtin_ia32_xorpd", IX86_BUILTIN_XORPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF }, @@ -20553,7 +20589,7 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_SSE2, CODE_FOR_smulv8hi3_highpart, "__builtin_ia32_pmulhw128", IX86_BUILTIN_PMULHW128, UNKNOWN,(int) V8HI_FTYPE_V8HI_V8HI }, { OPTION_MASK_ISA_SSE2, CODE_FOR_andv2di3, "__builtin_ia32_pand128", IX86_BUILTIN_PAND128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI }, - { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_nandv2di3, "__builtin_ia32_pandn128", IX86_BUILTIN_PANDN128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI }, + { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_andnotv2di3, "__builtin_ia32_pandn128", IX86_BUILTIN_PANDN128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI }, { OPTION_MASK_ISA_SSE2, CODE_FOR_iorv2di3, "__builtin_ia32_por128", IX86_BUILTIN_POR128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI }, { OPTION_MASK_ISA_SSE2, CODE_FOR_xorv2di3, "__builtin_ia32_pxor128", IX86_BUILTIN_PXOR128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI }, @@ -20763,8 +20799,8 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_AVX, CODE_FOR_avx_addsubv8sf3, "__builtin_ia32_addsubps256", IX86_BUILTIN_ADDSUBPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF }, { OPTION_MASK_ISA_AVX, CODE_FOR_andv4df3, "__builtin_ia32_andpd256", IX86_BUILTIN_ANDPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF }, { OPTION_MASK_ISA_AVX, CODE_FOR_andv8sf3, "__builtin_ia32_andps256", IX86_BUILTIN_ANDPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF }, - { OPTION_MASK_ISA_AVX, CODE_FOR_avx_nandv4df3, "__builtin_ia32_andnpd256", IX86_BUILTIN_ANDNPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF }, - { OPTION_MASK_ISA_AVX, CODE_FOR_avx_nandv8sf3, "__builtin_ia32_andnps256", IX86_BUILTIN_ANDNPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF }, + { OPTION_MASK_ISA_AVX, CODE_FOR_avx_andnotv4df3, "__builtin_ia32_andnpd256", IX86_BUILTIN_ANDNPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF }, + { OPTION_MASK_ISA_AVX, CODE_FOR_avx_andnotv8sf3, "__builtin_ia32_andnps256", IX86_BUILTIN_ANDNPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF }, { OPTION_MASK_ISA_AVX, CODE_FOR_divv4df3, "__builtin_ia32_divpd256", IX86_BUILTIN_DIVPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF }, { OPTION_MASK_ISA_AVX, CODE_FOR_avx_divv8sf3, "__builtin_ia32_divps256", IX86_BUILTIN_DIVPS256, UNKNOWN, (int) V8SF_FTYPE_V8SF_V8SF }, { OPTION_MASK_ISA_AVX, CODE_FOR_avx_haddv4df3, "__builtin_ia32_haddpd256", IX86_BUILTIN_HADDPD256, UNKNOWN, (int) V4DF_FTYPE_V4DF_V4DF }, diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index d49e49a3eb4..068738d2296 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -219,8 +219,7 @@ (UNSPECV_ALIGN 7) (UNSPECV_MONITOR 8) (UNSPECV_MWAIT 9) - (UNSPECV_CMPXCHG_1 10) - (UNSPECV_CMPXCHG_2 11) + (UNSPECV_CMPXCHG 10) (UNSPECV_XCHG 12) (UNSPECV_LOCK 13) (UNSPECV_PROLOGUE_USE 14) @@ -652,8 +651,8 @@ ;; All single word integer modes. (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")]) -;; Single word integer modes up to SImode. -(define_mode_iterator SWI32 [QI HI SI]) +;; Single word integer modes without QImode. +(define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")]) ;; Instruction suffix for integer modes. (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")]) @@ -15493,28 +15492,42 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "SI")]) -(define_insn "popcountsi2" - [(set (match_operand:SI 0 "register_operand" "=r") - (popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) +(define_insn "popcount<mode>2" + [(set (match_operand:SWI248 0 "register_operand" "=r") + (popcount:SWI248 + (match_operand:SWI248 1 "nonimmediate_operand" "rm"))) (clobber (reg:CC FLAGS_REG))] "TARGET_POPCNT" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") - (set_attr "mode" "SI")]) + (set_attr "mode" "<MODE>")]) -(define_insn "*popcountsi2_cmp" +(define_insn "*popcount<mode>2_cmp" [(set (reg FLAGS_REG) (compare - (popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm")) + (popcount:SWI248 + (match_operand:SWI248 1 "nonimmediate_operand" "rm")) (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (popcount:SI (match_dup 1)))] + (set (match_operand:SWI248 0 "register_operand" "=r") + (popcount:SWI248 (match_dup 1)))] "TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") - (set_attr "mode" "SI")]) + (set_attr "mode" "<MODE>")]) (define_insn "*popcountsi2_cmp_zext" [(set (reg FLAGS_REG) @@ -15524,7 +15537,13 @@ (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI(popcount:SI (match_dup 1))))] "TARGET_64BIT && TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") (set_attr "mode" "SI")]) @@ -15620,29 +15639,6 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "DI")]) -(define_insn "popcountdi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (popcount:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && TARGET_POPCNT" - "popcnt{q}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "DI")]) - -(define_insn "*popcountdi2_cmp" - [(set (reg FLAGS_REG) - (compare - (popcount:DI (match_operand:DI 1 "nonimmediate_operand" "rm")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (popcount:DI (match_dup 1)))] - "TARGET_64BIT && TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{q}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "DI")]) - (define_expand "clzhi2" [(parallel [(set (match_operand:HI 0 "register_operand" "") @@ -15681,29 +15677,6 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "HI")]) -(define_insn "popcounthi2" - [(set (match_operand:HI 0 "register_operand" "=r") - (popcount:HI (match_operand:HI 1 "nonimmediate_operand" "rm"))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_POPCNT" - "popcnt{w}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "HI")]) - -(define_insn "*popcounthi2_cmp" - [(set (reg FLAGS_REG) - (compare - (popcount:HI (match_operand:HI 1 "nonimmediate_operand" "rm")) - (const_int 0))) - (set (match_operand:HI 0 "register_operand" "=r") - (popcount:HI (match_dup 1)))] - "TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{w}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "HI")]) - (define_expand "paritydi2" [(set (match_operand:DI 0 "register_operand" "") (parity:DI (match_operand:DI 1 "register_operand" "")))] diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h new file mode 100644 index 00000000000..2902edfe566 --- /dev/null +++ b/gcc/config/i386/immintrin.h @@ -0,0 +1,62 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +#ifndef _IMMINTRIN_H_INCLUDED +#define _IMMINTRIN_H_INCLUDED + +#ifdef __MMX__ +#include <mmintrin.h> +#endif + +#ifdef __SSE__ +#include <xmmintrin.h> +#endif + +#ifdef __SSE2__ +#include <emmintrin.h> +#endif + +#ifdef __SSE3__ +#include <pmmintrin.h> +#endif + +#ifdef __SSSE3__ +#include <tmmintrin.h> +#endif + +#if defined (__SSE4_2__) || defined (__SSE4_1__) +#include <smmintrin.h> +#endif + +#if defined (__AES__) || defined (__PCLMUL__) +#include <wmmintrin.h> +#endif + +#ifdef __AVX__ +#include <avxintrin.h> +#endif + +#endif /* _IMMINTRIN_H_INCLUDED */ diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 16aaf2c0793..870fc8855e7 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -1027,7 +1027,7 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define_insn "mmx_nand<mode>3" +(define_insn "mmx_andnot<mode>3" [(set (match_operand:MMXMODEI 0 "register_operand" "=y") (and:MMXMODEI (not:MMXMODEI (match_operand:MMXMODEI 1 "register_operand" "0")) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index e35d8573869..997edc598ae 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1482,7 +1482,7 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define_insn "avx_nand<mode>3" +(define_insn "avx_andnot<mode>3" [(set (match_operand:AVXMODEF2P 0 "register_operand" "=x") (and:AVXMODEF2P (not:AVXMODEF2P @@ -1494,7 +1494,7 @@ (set_attr "prefix" "vex") (set_attr "mode" "<avxvecmode>")]) -(define_insn "<sse>_nand<mode>3" +(define_insn "<sse>_andnot<mode>3" [(set (match_operand:SSEMODEF2P 0 "register_operand" "=x") (and:SSEMODEF2P (not:SSEMODEF2P @@ -1549,7 +1549,7 @@ ;; allocation lossage. These patterns do not allow memory operands ;; because the native instructions read the full 128-bits. -(define_insn "*avx_nand<mode>3" +(define_insn "*avx_andnot<mode>3" [(set (match_operand:MODEF 0 "register_operand" "=x") (and:MODEF (not:MODEF @@ -1561,7 +1561,7 @@ (set_attr "prefix" "vex") (set_attr "mode" "<ssevecmode>")]) -(define_insn "*nand<mode>3" +(define_insn "*andnot<mode>3" [(set (match_operand:MODEF 0 "register_operand" "=x") (and:MODEF (not:MODEF @@ -5866,7 +5866,7 @@ operands[2] = force_reg (<MODE>mode, gen_rtx_CONST_VECTOR (<MODE>mode, v)); }) -(define_insn "*avx_nand<mode>3" +(define_insn "*avx_andnot<mode>3" [(set (match_operand:AVX256MODEI 0 "register_operand" "=x") (and:AVX256MODEI (not:AVX256MODEI (match_operand:AVX256MODEI 1 "register_operand" "x")) @@ -5877,7 +5877,7 @@ (set_attr "prefix" "vex") (set_attr "mode" "<avxvecpsmode>")]) -(define_insn "*sse_nand<mode>3" +(define_insn "*sse_andnot<mode>3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (and:SSEMODEI (not:SSEMODEI (match_operand:SSEMODEI 1 "register_operand" "0")) @@ -5887,7 +5887,7 @@ [(set_attr "type" "sselog") (set_attr "mode" "V4SF")]) -(define_insn "*avx_nand<mode>3" +(define_insn "*avx_andnot<mode>3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (and:SSEMODEI (not:SSEMODEI (match_operand:SSEMODEI 1 "register_operand" "x")) @@ -5898,7 +5898,7 @@ (set_attr "prefix" "vex") (set_attr "mode" "TI")]) -(define_insn "sse2_nand<mode>3" +(define_insn "sse2_andnot<mode>3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (and:SSEMODEI (not:SSEMODEI (match_operand:SSEMODEI 1 "register_operand" "0")) @@ -5909,7 +5909,7 @@ (set_attr "prefix_data16" "1") (set_attr "mode" "TI")]) -(define_insn "*nandtf3" +(define_insn "*andnottf3" [(set (match_operand:TF 0 "register_operand" "=x") (and:TF (not:TF (match_operand:TF 1 "register_operand" "0")) @@ -7719,7 +7719,7 @@ (define_insn "*sse2_mfence" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))] - "TARGET_SSE2" + "TARGET_64BIT || TARGET_SSE2" "mfence" [(set_attr "type" "sse") (set_attr "memory" "unknown")]) diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index a4f6d38456c..4b36d452c4a 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -31,6 +31,29 @@ (define_mode_attr doublemodesuffix [(DI "8") (TI "16")]) (define_mode_attr DCASHMODE [(DI "SI") (TI "DI")]) +(define_expand "memory_barrier" + [(set (match_dup 0) + (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))] + "" +{ + operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); + MEM_VOLATILE_P (operands[0]) = 1; + + if (!(TARGET_64BIT || TARGET_SSE2)) + { + emit_insn (gen_memory_barrier_nosse (operands[0])); + DONE; + } +}) + +(define_insn "memory_barrier_nosse" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE)) + (clobber (reg:CC FLAGS_REG))] + "!(TARGET_64BIT || TARGET_SSE2)" + "lock{%;| }or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}" + [(set_attr "memory" "unknown")]) + ;; ??? It would be possible to use cmpxchg8b on pentium for DImode ;; changes. It's complicated because the insn uses ecx:ebx as the ;; new value; note that the registers are reversed from the order @@ -46,7 +69,7 @@ [(match_dup 1) (match_operand:CASMODE 2 "register_operand" "") (match_operand:CASMODE 3 "register_operand" "")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (clobber (reg:CC FLAGS_REG))])] "TARGET_CMPXCHG" { @@ -78,10 +101,10 @@ [(match_dup 1) (match_operand:IMODE 2 "register_operand" "a") (match_operand:IMODE 3 "register_operand" "<modeconstraint>")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (clobber (reg:CC FLAGS_REG))] "TARGET_CMPXCHG" - "lock{%;| } cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}") + "lock{%;| }cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}") (define_insn "sync_double_compare_and_swap<mode>" [(set (match_operand:DCASMODE 0 "register_operand" "=A") @@ -92,7 +115,7 @@ (match_operand:DCASMODE 2 "register_operand" "A") (match_operand:<DCASHMODE> 3 "register_operand" "b") (match_operand:<DCASHMODE> 4 "register_operand" "c")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (clobber (reg:CC FLAGS_REG))] "" "lock{%;| }cmpxchg<doublemodesuffix>b\t%1") @@ -115,7 +138,7 @@ (match_operand:DI 2 "register_operand" "A") (match_operand:SI 3 "register_operand" "SD") (match_operand:SI 4 "register_operand" "c")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (clobber (reg:CC FLAGS_REG))] "!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic" "xchg{l}\t%%ebx, %3\;lock{%;| }cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3") @@ -129,11 +152,11 @@ [(match_dup 1) (match_operand:CASMODE 2 "register_operand" "") (match_operand:CASMODE 3 "register_operand" "")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (set (match_dup 4) (compare:CCZ (unspec_volatile:CASMODE - [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG_2) + [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG) (match_dup 2)))])] "TARGET_CMPXCHG" { @@ -169,11 +192,11 @@ [(match_dup 1) (match_operand:IMODE 2 "register_operand" "a") (match_operand:IMODE 3 "register_operand" "<modeconstraint>")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (set (reg:CCZ FLAGS_REG) (compare:CCZ (unspec_volatile:IMODE - [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG_2) + [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG) (match_dup 2)))] "TARGET_CMPXCHG" "lock{%;| }cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}") @@ -187,12 +210,12 @@ (match_operand:DCASMODE 2 "register_operand" "A") (match_operand:<DCASHMODE> 3 "register_operand" "b") (match_operand:<DCASHMODE> 4 "register_operand" "c")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (set (reg:CCZ FLAGS_REG) (compare:CCZ (unspec_volatile:DCASMODE [(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)] - UNSPECV_CMPXCHG_2) + UNSPECV_CMPXCHG) (match_dup 2)))] "" "lock{%;| }cmpxchg<doublemodesuffix>b\t%1") @@ -208,12 +231,12 @@ (match_operand:DI 2 "register_operand" "A") (match_operand:SI 3 "register_operand" "SD") (match_operand:SI 4 "register_operand" "c")] - UNSPECV_CMPXCHG_1)) + UNSPECV_CMPXCHG)) (set (reg:CCZ FLAGS_REG) (compare:CCZ (unspec_volatile:DI [(match_dup 1) (match_dup 2) (match_dup 3) (match_dup 4)] - UNSPECV_CMPXCHG_2) + UNSPECV_CMPXCHG) (match_dup 2)))] "!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic" "xchg{l}\t%%ebx, %3\;lock{%;| }cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3") diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 34a37d200e7..ae77a98dec1 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -2141,11 +2141,13 @@ ia64_expand_atomic_op (enum rtx_code code, rtx mem, rtx val, new_reg = cmp_reg; if (code == NOT) { - new_reg = expand_simple_unop (DImode, NOT, new_reg, NULL_RTX, true); - code = AND; + new_reg = expand_simple_binop (DImode, AND, new_reg, val, NULL_RTX, + true, OPTAB_DIRECT); + new_reg = expand_simple_unop (DImode, code, new_reg, NULL_RTX, true); } - new_reg = expand_simple_binop (DImode, code, new_reg, val, NULL_RTX, - true, OPTAB_DIRECT); + else + new_reg = expand_simple_binop (DImode, code, new_reg, val, NULL_RTX, + true, OPTAB_DIRECT); if (mode != DImode) new_reg = gen_lowpart (mode, new_reg); diff --git a/gcc/config/ia64/sync.md b/gcc/config/ia64/sync.md index c467b0db097..69b5d08274b 100644 --- a/gcc/config/ia64/sync.md +++ b/gcc/config/ia64/sync.md @@ -57,8 +57,9 @@ (define_expand "sync_nand<mode>" [(set (match_operand:IMODE 0 "memory_operand" "") - (and:IMODE (not:IMODE (match_dup 0)) - (match_operand:IMODE 1 "general_operand" "")))] + (not:IMODE + (and:IMODE (match_dup 0) + (match_operand:IMODE 1 "general_operand" ""))))] "" { ia64_expand_atomic_op (NOT, operands[0], operands[1], NULL, NULL); @@ -78,9 +79,9 @@ (define_expand "sync_old_nand<mode>" [(set (match_operand:IMODE 0 "gr_register_operand" "") - (and:IMODE - (not:IMODE (match_operand:IMODE 1 "memory_operand" "")) - (match_operand:IMODE 2 "general_operand" "")))] + (not:IMODE + (and:IMODE (match_operand:IMODE 1 "memory_operand" "") + (match_operand:IMODE 2 "general_operand" ""))))] "" { ia64_expand_atomic_op (NOT, operands[1], operands[2], operands[0], NULL); @@ -100,9 +101,9 @@ (define_expand "sync_new_nand<mode>" [(set (match_operand:IMODE 0 "gr_register_operand" "") - (and:IMODE - (not:IMODE (match_operand:IMODE 1 "memory_operand" "")) - (match_operand:IMODE 2 "general_operand" "")))] + (not:IMODE + (and:IMODE (match_operand:IMODE 1 "memory_operand" "") + (match_operand:IMODE 2 "general_operand" ""))))] "" { ia64_expand_atomic_op (NOT, operands[1], operands[2], NULL, operands[0]); diff --git a/gcc/config/m32c/bitops.md b/gcc/config/m32c/bitops.md index d92494ac3ef..e123d057dcd 100644 --- a/gcc/config/m32c/bitops.md +++ b/gcc/config/m32c/bitops.md @@ -43,7 +43,7 @@ [(set (match_operand:QI 0 "memsym_operand" "+Si") (ior:QI (subreg:QI (ashift:HI (const_int 1) (subreg:QI (match_operand:HI 1 "a_qi_operand" "Raa") 0)) 0) - (match_operand:QI 2 "" "0")))] + (match_operand:QI 2 "memsym_operand" "0")))] "TARGET_A16" "bset\t%0[%1]" [(set_attr "flags" "n")] @@ -190,7 +190,7 @@ ) (define_insn "andhi3_24" - [(set (match_operand:HI 0 "mra_operand" "=Sd,Sd,Rqi,Rqi,RhiSd,??Rmm,RhiSd,??Rmm") + [(set (match_operand:HI 0 "mra_operand" "=Sd,Sd,?Rhl,?Rhl,RhiSd,??Rmm,RhiSd,??Rmm") (and:HI (match_operand:HI 1 "mra_operand" "%0,0,0,0,0,0,0,0") (match_operand:HI 2 "mrai_operand" "ImB,Imw,ImB,Imw,iRhiSd,?Rmm,?Rmm,iRhiSd")))] "TARGET_A24" @@ -223,7 +223,7 @@ ) (define_insn "iorhi3_24" - [(set (match_operand:HI 0 "mra_operand" "=Sd,Sd,Rqi,Rqi,RhiSd,RhiSd,??Rmm,??Rmm") + [(set (match_operand:HI 0 "mra_operand" "=Sd,Sd,?Rhl,?Rhl,RhiSd,RhiSd,??Rmm,??Rmm") (ior:HI (match_operand:HI 1 "mra_operand" "%0,0,0,0,0,0,0,0") (match_operand:HI 2 "mrai_operand" "Ilb,Ilw,Ilb,Ilw,iRhiSd,?Rmm,iRhiSd,?Rmm")))] "TARGET_A24" diff --git a/gcc/config/m32c/mov.md b/gcc/config/m32c/mov.md index 717d8fdfacb..1482a2f87df 100644 --- a/gcc/config/m32c/mov.md +++ b/gcc/config/m32c/mov.md @@ -338,6 +338,16 @@ [(set_attr "flags" "x")] ) +(define_insn "extendhipsi2" + [(set (match_operand:PSI 0 "register_operand" "=R03") + (sign_extend:PSI (match_operand:HI 1 "register_operand" "0")))] + "" + "* + if (REGNO(operands[0]) == 0) return \"exts.w\t%1\"; + else return \"mov.w r1,r3 | sha.w #-8,r3 | sha.w #-7,r3\";" + [(set_attr "flags" "x")] + ) + (define_insn "extendpsisi2" [(set (match_operand:SI 0 "mr_operand" "=R03Sd*Rmm") (sign_extend:SI (match_operand:PSI 1 "mr_operand" "0")))] @@ -371,7 +381,7 @@ ) (define_insn "zero_extendqihi2" - [(set (match_operand:HI 0 "m32c_nonimmediate_operand" "=Rhl,RhiSd*Rmm") + [(set (match_operand:HI 0 "m32c_nonimmediate_operand" "=?Rhl,RhiSd*Rmm") (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,0")))] "" "@ diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 75f36dcc896..782c7ccd7fe 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -244,6 +244,15 @@ (define_attr "size" "1,2,3" (symbol_ref "m68k_sched_attr_size (insn)")) +;; Alternative is OK for ColdFire. +(define_attr "ok_for_coldfire" "yes,no" (const_string "yes")) + +;; Define 'enabled' attribute. +(define_attr "enabled" "" + (cond [(and (ne (symbol_ref "TARGET_COLDFIRE") (const_int 0)) + (eq_attr "ok_for_coldfire" "no")) + (const_int 0)] + (const_int 1))) ;; Mode macros for floating point operations. ;; Valid floating point modes @@ -423,15 +432,15 @@ [(set (cc0) (compare (match_operand:DI 0 "nonimmediate_operand" "") (match_operand:DI 1 "general_operand" ""))) - (clobber (match_dup 2))])] + (clobber (match_scratch:DI 2 ""))])] "" - "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);") + "m68k_last_compare_had_fp_operands = 0;") (define_insn "" [(set (cc0) (compare (match_operand:DI 1 "nonimmediate_operand" "0,d") (match_operand:DI 2 "general_operand" "d,0"))) - (clobber (match_operand:DI 0 "register_operand" "=d,d"))] + (clobber (match_scratch:DI 0 "=d,d"))] "" { if (rtx_equal_p (operands[0], operands[1])) @@ -1694,32 +1703,35 @@ }) (define_insn "extendsidi2" - [(set (match_operand:DI 0 "register_operand" "=d") - (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm")))] + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o,o,<") + (sign_extend:DI + (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm,r<Q>,rm"))) + (clobber (match_scratch:SI 2 "=X,d,d,d"))] "" { CC_STATUS_INIT; - if (TARGET_68020 || TARGET_COLDFIRE) - return "move%.l %1,%R0\;smi %0\;extb%.l %0"; - else - return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0"; -}) -(define_insn "*extendsidi2_mem" - [(set (match_operand:DI 0 "memory_operand" "=o,<") - (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm"))) - (clobber (match_scratch:SI 2 "=d,d"))] - "" -{ - CC_STATUS_INIT; + if (which_alternative == 0) + /* Handle alternative 0. */ + { + if (TARGET_68020 || TARGET_COLDFIRE) + return "move%.l %1,%R0\;smi %0\;extb%.l %0"; + else + return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0"; + } + + /* Handle alternatives 1, 2 and 3. We don't need to adjust address by 4 + in alternative 3 because autodecrement will do that for us. */ operands[3] = adjust_address (operands[0], SImode, - which_alternative == 0 ? 4 : 0); + which_alternative == 3 ? 0 : 4); operands[0] = adjust_address (operands[0], SImode, 0); + if (TARGET_68020 || TARGET_COLDFIRE) return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0"; else return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0"; -}) +} + [(set_attr "ok_for_coldfire" "yes,no,yes,yes")]) ;; Special case when one can avoid register clobbering, copy and test ;; Maybe there is a way to make that the general case, by forcing the @@ -2281,8 +2293,8 @@ }) (define_insn "addsi_lshrsi_31" - [(set (match_operand:SI 0 "nonimmediate_operand" "=dm") - (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm") + [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,dm,d<Q>") + (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm,r<Q>,rm") (const_int 31)) (match_dup 1)))] "" @@ -2302,7 +2314,8 @@ (*targetm.asm_out.internal_label) (asm_out_file, "L", CODE_LABEL_NUMBER (operands[3])); return ""; -}) +} + [(set_attr "ok_for_coldfire" "no,yes,yes")]) (define_expand "addsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index c868b10a107..c7b3c064b8f 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6401,8 +6401,10 @@ mips_expand_synci_loop (rtx begin, rtx end) rtx inc, label, cmp, cmp_result; /* Load INC with the cache line size (rdhwr INC,$1). */ - inc = gen_reg_rtx (SImode); - emit_insn (gen_rdhwr (inc, const1_rtx)); + inc = gen_reg_rtx (Pmode); + emit_insn (Pmode == SImode + ? gen_rdhwr_synci_step_si (inc) + : gen_rdhwr_synci_step_di (inc)); /* Loop back to here. */ label = gen_label_rtx (); diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 562c0533379..6f98cd0290e 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2845,6 +2845,32 @@ while (0) #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ sprintf ((LABEL), "*%s%s%ld", (LOCAL_LABEL_PREFIX), (PREFIX), (long)(NUM)) +/* Print debug labels as "foo = ." rather than "foo:" because they should + represent a byte pointer rather than an ISA-encoded address. This is + particularly important for code like: + + $LFBxxx = . + .cfi_startproc + ... + .section .gcc_except_table,... + ... + .uleb128 foo-$LFBxxx + + The .uleb128 requies $LFBxxx to match the FDE start address, which is + likewise a byte pointer rather than an ISA-encoded address. + + At the time of writing, this hook is not used for the function end + label: + + $LFExxx: + .end foo + + But this doesn't matter, because GAS doesn't treat a pre-.end label + as a MIPS16 one anyway. */ + +#define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \ + fprintf (FILE, "%s%s%d = .\n", LOCAL_LABEL_PREFIX, PREFIX, NUM) + /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 22fcc8875cb..21b76c54475 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -4703,7 +4703,9 @@ { mips_expand_synci_loop (operands[0], operands[1]); emit_insn (gen_sync ()); - emit_insn (gen_clear_hazard ()); + emit_insn (Pmode == SImode + ? gen_clear_hazard_si () + : gen_clear_hazard_di ()); } else if (mips_cache_flush_func && mips_cache_flush_func[0]) { @@ -4725,21 +4727,21 @@ "ISA_HAS_SYNCI" "synci\t0(%0)") -(define_insn "rdhwr" - [(set (match_operand:SI 0 "register_operand" "=d") - (unspec_volatile [(match_operand:SI 1 "const_int_operand" "n")] +(define_insn "rdhwr_synci_step_<mode>" + [(set (match_operand:P 0 "register_operand" "=d") + (unspec_volatile [(const_int 1)] UNSPEC_RDHWR))] "ISA_HAS_SYNCI" - "rdhwr\t%0,$%1") + "rdhwr\t%0,$1") -(define_insn "clear_hazard" +(define_insn "clear_hazard_<mode>" [(unspec_volatile [(const_int 0)] UNSPEC_CLEAR_HAZARD) - (clobber (reg:SI 31))] + (clobber (reg:P 31))] "ISA_HAS_SYNCI" { return "%(%<bal\t1f\n" "\tnop\n" - "1:\taddiu\t$31,$31,12\n" + "1:\t<d>addiu\t$31,$31,12\n" "\tjr.hb\t$31\n" "\tnop%>%)"; } diff --git a/gcc/config/pa/linux-atomic.c b/gcc/config/pa/linux-atomic.c index 4f9780feaa9..ca33ea6d9d6 100644 --- a/gcc/config/pa/linux-atomic.c +++ b/gcc/config/pa/linux-atomic.c @@ -33,8 +33,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #ifndef _LP64 #include <errno.h> #else +#define EFAULT 14 +#define EBUSY 16 #define ENOSYS 251 -#define EFAULT 14 #endif /* All PA-RISC implementations supported by linux have strongly @@ -74,6 +75,13 @@ __kernel_cmpxchg (int oldval, int newval, int *mem) ); if (__builtin_expect (lws_errno == -EFAULT || lws_errno == -ENOSYS, 0)) ABORT_INSTRUCTION; + + /* If the kernel LWS call succeeded (lws_errno == 0), lws_ret contains + the old value from memory. If this value is equal to OLDVAL, the + new value was written to memory. If not, return -EBUSY. */ + if (!lws_errno && lws_ret != oldval) + lws_errno = -EBUSY; + return lws_errno; } diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index e06a2ec4809..21820869d5c 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -9281,7 +9281,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, offset += 8; } - return gen_rtx_PARALLEL (BLKmode, gen_rtvec_v (ub, loc)); + return gen_rtx_PARALLEL (mode, gen_rtvec_v (ub, loc)); } } else diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index e64b58ca904..b6c2089f0ba 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -4681,10 +4681,10 @@ s390_expand_atomic (enum machine_mode mode, enum rtx_code code, NULL_RTX, 1, OPTAB_DIRECT); break; case MULT: /* NAND */ - new_rtx = expand_simple_binop (SImode, XOR, new_rtx, ac.modemask, - NULL_RTX, 1, OPTAB_DIRECT); new_rtx = expand_simple_binop (SImode, AND, new_rtx, val, NULL_RTX, 1, OPTAB_DIRECT); + new_rtx = expand_simple_binop (SImode, XOR, new_rtx, ac.modemask, + NULL_RTX, 1, OPTAB_DIRECT); break; default: gcc_unreachable (); @@ -6664,25 +6664,6 @@ s390_chunkify_cancel (struct constant_pool *pool_list) } } -/* Helper rtx-iteration-function for s390_output_pool_entry. Marks - SYMBOL_REFs as referenced through use of assemble_external. */ - -static int -s390_mark_symbol_ref_as_used (rtx *x, void *dummy ATTRIBUTE_UNUSED) -{ - /* If we have a used symbol, we may have to emit assembly - annotations corresponding to whether the symbol is external, weak - or has non-default visibility. */ - if (GET_CODE (*x) == SYMBOL_REF) - { - tree t = SYMBOL_REF_DECL (*x); - if (t) - assemble_external (t); - return -1; - } - return 0; -} - /* Output the constant pool entry EXP in mode MODE with alignment ALIGN. */ void @@ -6702,7 +6683,7 @@ s390_output_pool_entry (rtx exp, enum machine_mode mode, unsigned int align) case MODE_INT: assemble_integer (exp, GET_MODE_SIZE (mode), align, 1); - for_each_rtx (&exp, s390_mark_symbol_ref_as_used, NULL); + mark_symbol_refs_as_used (exp); break; default: diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 68bb197c070..024407ced58 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -10237,7 +10237,10 @@ mov.l\\t1f,r0\\n\\ "* { if (operands[1] != const0_rtx) - assemble_integer (operands[0], 4, BITS_PER_UNIT * 4, 1); + { + assemble_integer (operands[0], 4, BITS_PER_UNIT * 4, 1); + mark_symbol_refs_as_used (operands[0]); + } return \"\"; }" [(set_attr "length" "4") diff --git a/gcc/config/soft-fp/fixdfti.c b/gcc/config/soft-fp/fixdfti.c index 6d06514e22e..378f727b8b1 100644 --- a/gcc/config/soft-fp/fixdfti.c +++ b/gcc/config/soft-fp/fixdfti.c @@ -31,7 +31,7 @@ #include "soft-fp.h" #include "double.h" -TItype __fixdfti(TFtype a) +TItype __fixdfti(DFtype a) { FP_DECL_EX; FP_DECL_D(A); diff --git a/gcc/config/soft-fp/floatuntisf.c b/gcc/config/soft-fp/floatuntisf.c index 11ad6430e25..60971d61c17 100644 --- a/gcc/config/soft-fp/floatuntisf.c +++ b/gcc/config/soft-fp/floatuntisf.c @@ -31,7 +31,7 @@ #include "soft-fp.h" #include "single.h" -SFtype __floatundisf(UTItype i) +SFtype __floatuntisf(UTItype i) { FP_DECL_EX; FP_DECL_S(A); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index d3d1af0479e..3b659ac50dc 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -575,7 +575,7 @@ static bool fpu_option_set = false; #undef TARGET_HANDLE_OPTION #define TARGET_HANDLE_OPTION sparc_handle_option -#if TARGET_GNU_TLS +#if TARGET_GNU_TLS && defined(HAVE_AS_SPARC_UA_PCREL) #undef TARGET_ASM_OUTPUT_DWARF_DTPREL #define TARGET_ASM_OUTPUT_DWARF_DTPREL sparc_output_dwarf_dtprel #endif diff --git a/gcc/config/stormy16/stormy16.md b/gcc/config/stormy16/stormy16.md index 0c754364e74..99bed261725 100644 --- a/gcc/config/stormy16/stormy16.md +++ b/gcc/config/stormy16/stormy16.md @@ -132,8 +132,8 @@ "{ xstormy16_expand_move (QImode, operands[0], operands[1]); DONE; }") (define_insn "movqi_internal" - [(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,r") - (match_operand:QI 1 "general_operand" "r,e,m,i,i,i,i,ir,W"))] + [(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e") + (match_operand:QI 1 "general_operand" "r,e,m,i,i,i,i,ie,W"))] "" "@ mov %0,%1 @@ -184,7 +184,7 @@ "{ xstormy16_expand_move (HImode, operands[0], operands[1]); DONE; }") (define_insn "movhi_internal" - [(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,r") + [(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e") (match_operand:HI 1 "xs_hi_general_operand" "r,e,m,L,L,i,i,ie,W"))] "" "@ diff --git a/gcc/configure b/gcc/configure index dabb2840974..7a5d7056781 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24172,7 +24172,7 @@ case "$target" in i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \ | x86_64*-*-* | hppa*-*-* | arm*-*-* \ | xstormy16*-*-* | cris-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \ - | spu-*-* | fido*-*-*) + | spu-*-* | fido*-*-* | m32c-*-*) insn="nop" ;; ia64*-*-* | s390*-*-*) diff --git a/gcc/configure.ac b/gcc/configure.ac index cbfd6a298da..39761c44e2d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3473,7 +3473,7 @@ case "$target" in i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \ | x86_64*-*-* | hppa*-*-* | arm*-*-* \ | xstormy16*-*-* | cris-*-* | xtensa*-*-* | bfin-*-* | score*-*-* \ - | spu-*-* | fido*-*-*) + | spu-*-* | fido*-*-* | m32c-*-*) insn="nop" ;; ia64*-*-* | s390*-*-*) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fe2eab6fd74..e128fe1f382 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2008-11-25 Jason Merrill <jason@redhat.com> + + PR c++/28743 + * decl2.c (check_classfn): Error rather than abort on parameter + list mismatch. + +2008-11-20 Jason Merrill <jason@redhat.com> + + PR c++/28513 + * parser.c (cp_parser_class_name): Call maybe_note_name_used_in_class. + + PR c++/37540 + * call.c (build_over_call): Take the address of the function even + in a template. + (build_new_method_call): Remember the type of the called function + in a template. + 2008-11-19 Dodji Seketeli <dodji@redhat.com> PR c++/37142 @@ -8,7 +25,7 @@ PR c++/35405 * pt.c (lookup_template_class): Check pointers before dereferencing - Them. + them. * error.c (dump_template_decl): Likewise. 2008-11-19 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/call.c b/gcc/cp/call.c index af3fd991f61..bbd6a222d90 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5103,7 +5103,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) tree expr; tree return_type; return_type = TREE_TYPE (TREE_TYPE (fn)); - expr = build_call_list (return_type, fn, args); + expr = build_call_list (return_type, build_addr_func (fn), args); if (TREE_THIS_VOLATILE (fn) && cfun) current_function_returns_abnormally = 1; if (!VOID_TYPE_P (return_type)) @@ -5964,10 +5964,16 @@ build_new_method_call (tree instance, tree fns, tree args, } if (processing_template_decl && call != error_mark_node) - call = (build_min_non_dep_call_list - (call, - build_min_nt (COMPONENT_REF, orig_instance, orig_fns, NULL_TREE), - orig_args)); + { + if (TREE_CODE (call) == INDIRECT_REF) + call = TREE_OPERAND (call, 0); + call = (build_min_non_dep_call_list + (call, + build_min (COMPONENT_REF, TREE_TYPE (CALL_EXPR_FN (call)), + orig_instance, orig_fns, NULL_TREE), + orig_args)); + call = convert_from_reference (call); + } /* Free all the conversions we allocated. */ obstack_free (&conversion_obstack, p); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a0ae6e4f7be..da9201e8890 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -572,9 +572,14 @@ check_classfn (tree ctype, tree function, tree template_parms) either were not passed, or they are the same of DECL_TEMPLATE_PARMS. */ if (TREE_CODE (function) == TEMPLATE_DECL) { - gcc_assert (!template_parms - || comp_template_parms (template_parms, - DECL_TEMPLATE_PARMS (function))); + if (template_parms + && !comp_template_parms (template_parms, + DECL_TEMPLATE_PARMS (function))) + { + error ("template parameter lists provided don't match the " + "template parameters of %qD", function); + return error_mark_node; + } template_parms = DECL_TEMPLATE_PARMS (function); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2bf0e66cd03..8fdd58c868a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14767,6 +14767,9 @@ cp_parser_class_name (cp_parser *parser, } return error_mark_node; } + else if (decl != error_mark_node + && !parser->scope) + maybe_note_name_used_in_class (identifier, decl); } } else diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c0789cabf34..aa684197178 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -335,7 +335,7 @@ Objective-C and Objective-C++ Dialects}. -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol --finline-small-functions -fipa-cp -fipa-cp-clone -fipa-marix-reorg -fipa-pta @gol +-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol -fipa-pure-const -fipa-reference -fipa-struct-reorg @gol -fipa-type-escape -fira -fira-algorithm=@var{algorithm} @gol -fira-coalesce -fno-ira-share-save-slots @gol @@ -469,7 +469,8 @@ Objective-C and Objective-C++ Dialects}. -mno-id-shared-library -mshared-library-id=@var{n} @gol -mleaf-id-shared-library -mno-leaf-id-shared-library @gol -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol --mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram} +-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol +-micplb} @emph{CRIS Options} @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol @@ -7608,10 +7609,10 @@ be disabled. The default maximum SCC size is 10000. @item ira-max-loops-num IRA uses a regional register allocation by default. If a function -contains loops more than number given by the parameter, non-regional -register allocator will be used even when option -@option{-fira-algorithm} is given. The default value of the parameter -is 20. +contains loops more than number given by the parameter, only at most +given number of the most frequently executed loops will form regions +for the regional register allocation. The default value of the +parameter is 100. @end table @end table @@ -9317,6 +9318,12 @@ Build standalone application for SDRAM. Proper start files and link scripts will be used to put the application into SDRAM. Loader should initialize SDRAM before loading the application into SDRAM. This option defines @code{__BFIN_SDRAM}. + +@item -micplb +@opindex micplb +Assume that ICPLBs are enabled at runtime. This has an effect on certain +anomaly workarounds. For Linux targets, the default is to assume ICPLBs +are enabled; for standalone applications the default is off. @end table @node CRIS Options @@ -11298,7 +11305,7 @@ This model has to be used for Linux kernel code. @item -mcmodel=medium @opindex mcmodel=medium Generate code for the medium model: The program is linked in the lower 2 -GB of the address space and symbols with small size as well. Symbols +GB of the address space. Small symbols are also placed there. Symbols with sizes larger than @option{-mlarge-data-threshold} are put into large data or bss sections and can be located above 2GB. Programs can be statically or dynamically linked. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index c7a5d4f63d2..672f6d178a3 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -990,6 +990,26 @@ The target's C99 runtime (both headers and libraries). and only then in certain modes. @end table +@item @{ dg-timeout @var{n} [@{target @var{selector} @}] @} +Set the time limit for the compilation and for the execution of the test +to the specified number of seconds. + +@item @{ dg-timeout-factor @var{x} [@{ target @var{selector} @}] @} +Multiply the normal time limit for compilation and execution of the test +by the specified floating-point factor. The normal timeout limit, in +seconds, is found by searching the following in order: + +@itemize @bullet +@item the value defined by an earlier @code{dg-timeout} directive in +the test + +@item variable @var{tool_timeout} defined by the set of tests + +@item @var{gcc,,timeout} set in the target board + +@item 300 +@end itemize + @item @{ dg-skip-if @var{comment} @{ @var{selector} @} @{ @var{include-opts} @} @{ @var{exclude-opts} @} @} Skip the test if the test system is included in @var{selector} and if each of the options in @var{include-opts} is in the set of options with diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 880884f5f52..7dfb46b3a0d 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3817,6 +3817,8 @@ registers. The value of this macro is the size, in bytes, of the area reserved for arguments passed in registers for the function represented by @var{fndecl}, which can be zero if GCC is calling a library function. +The argument @var{fndecl} can be the FUNCTION_DECL, or the type itself +of the function. This space can be allocated by the caller, or be a part of the machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says diff --git a/gcc/dse.c b/gcc/dse.c index 0a3ebb40ffa..d7fb2d8aa20 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1447,6 +1447,29 @@ find_shift_sequence (int access_size, rtx target, new_reg, shift_seq, insn, new_lhs; int cost; + /* If a constant was stored into memory, try to simplify it here, + otherwise the cost of the shift might preclude this optimization + e.g. at -Os, even when no actual shift will be needed. */ + if (CONSTANT_P (store_info->rhs)) + { + unsigned int byte = subreg_lowpart_offset (new_mode, store_mode); + rtx ret = simplify_subreg (new_mode, store_info->rhs, store_mode, + byte); + if (ret && CONSTANT_P (ret)) + { + ret = simplify_const_binary_operation (LSHIFTRT, new_mode, + ret, GEN_INT (shift)); + if (ret && CONSTANT_P (ret)) + { + byte = subreg_lowpart_offset (read_mode, new_mode); + ret = simplify_subreg (read_mode, ret, new_mode, byte); + if (ret && CONSTANT_P (ret) + && rtx_cost (ret, SET, speed) <= COSTS_N_INSNS (1)) + return ret; + } + } + } + /* Try a wider mode if truncating the store mode to NEW_MODE requires a real instruction. */ if (GET_MODE_BITSIZE (new_mode) < GET_MODE_BITSIZE (store_mode) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 337c22e119c..68d0ee8da3b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -411,7 +411,8 @@ static void reg_save (const char *, unsigned, unsigned, HOST_WIDE_INT); #ifdef DWARF2_UNWIND_INFO static void initial_return_save (rtx); #endif -static HOST_WIDE_INT stack_adjust_offset (const_rtx); +static HOST_WIDE_INT stack_adjust_offset (const_rtx, HOST_WIDE_INT, + HOST_WIDE_INT); static void output_cfi (dw_cfi_ref, dw_fde_ref, int); static void output_cfi_directive (dw_cfi_ref); static void output_call_frame_info (int); @@ -1110,7 +1111,8 @@ initial_return_save (rtx rtl) contains. */ static HOST_WIDE_INT -stack_adjust_offset (const_rtx pattern) +stack_adjust_offset (const_rtx pattern, HOST_WIDE_INT cur_args_size, + HOST_WIDE_INT cur_offset) { const_rtx src = SET_SRC (pattern); const_rtx dest = SET_DEST (pattern); @@ -1119,18 +1121,34 @@ stack_adjust_offset (const_rtx pattern) if (dest == stack_pointer_rtx) { - /* (set (reg sp) (plus (reg sp) (const_int))) */ code = GET_CODE (src); + + /* Assume (set (reg sp) (reg whatever)) sets args_size + level to 0. */ + if (code == REG && src != stack_pointer_rtx) + { + offset = -cur_args_size; +#ifndef STACK_GROWS_DOWNWARD + offset = -offset; +#endif + return offset - cur_offset; + } + if (! (code == PLUS || code == MINUS) || XEXP (src, 0) != stack_pointer_rtx || GET_CODE (XEXP (src, 1)) != CONST_INT) return 0; + /* (set (reg sp) (plus (reg sp) (const_int))) */ offset = INTVAL (XEXP (src, 1)); if (code == PLUS) offset = -offset; + return offset; } - else if (MEM_P (dest)) + + if (MEM_P (src) && !MEM_P (dest)) + dest = src; + if (MEM_P (dest)) { /* (set (mem (pre_dec (reg sp))) (foo)) */ src = XEXP (dest, 0); @@ -1199,7 +1217,7 @@ compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size, || sibcall_epilogue_contains (insn)) /* Nothing */; else if (GET_CODE (PATTERN (insn)) == SET) - offset = stack_adjust_offset (PATTERN (insn)); + offset = stack_adjust_offset (PATTERN (insn), cur_args_size, 0); else if (GET_CODE (PATTERN (insn)) == PARALLEL || GET_CODE (PATTERN (insn)) == SEQUENCE) { @@ -1207,7 +1225,8 @@ compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size, for them. */ for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--) if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET) - offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i)); + offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i), + cur_args_size, offset); } } else @@ -1224,7 +1243,7 @@ compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size, rtx elem = XVECEXP (expr, 0, i); if (GET_CODE (elem) == SET && !RTX_FRAME_RELATED_P (elem)) - offset += stack_adjust_offset (elem); + offset += stack_adjust_offset (elem, cur_args_size, offset); } } } @@ -1312,13 +1331,25 @@ compute_barrier_args_size (void) body = PATTERN (insn); if (GET_CODE (body) == SEQUENCE) { + HOST_WIDE_INT dest_args_size = cur_args_size; for (i = 1; i < XVECLEN (body, 0); i++) + if (INSN_ANNULLED_BRANCH_P (XVECEXP (body, 0, 0)) + && INSN_FROM_TARGET_P (XVECEXP (body, 0, i))) + dest_args_size + = compute_barrier_args_size_1 (XVECEXP (body, 0, i), + dest_args_size, &next); + else + cur_args_size + = compute_barrier_args_size_1 (XVECEXP (body, 0, i), + cur_args_size, &next); + + if (INSN_ANNULLED_BRANCH_P (XVECEXP (body, 0, 0))) + compute_barrier_args_size_1 (XVECEXP (body, 0, 0), + dest_args_size, &next); + else cur_args_size - = compute_barrier_args_size_1 (XVECEXP (body, 0, i), + = compute_barrier_args_size_1 (XVECEXP (body, 0, 0), cur_args_size, &next); - cur_args_size - = compute_barrier_args_size_1 (XVECEXP (body, 0, 0), - cur_args_size, &next); } else cur_args_size @@ -1359,6 +1390,14 @@ dwarf2out_stack_adjust (rtx insn, bool after_p) if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn)) return; + /* If INSN is an instruction from target of an annulled branch, the + effects are for the target only and so current argument size + shouldn't change at all. */ + if (final_sequence + && INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)) + && INSN_FROM_TARGET_P (insn)) + return; + /* If only calls can throw, and we have a frame pointer, save up adjustments until we see the CALL_INSN. */ if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM) @@ -1404,7 +1443,7 @@ dwarf2out_stack_adjust (rtx insn, bool after_p) #endif } else if (GET_CODE (PATTERN (insn)) == SET) - offset = stack_adjust_offset (PATTERN (insn)); + offset = stack_adjust_offset (PATTERN (insn), args_size, 0); else if (GET_CODE (PATTERN (insn)) == PARALLEL || GET_CODE (PATTERN (insn)) == SEQUENCE) { @@ -1412,7 +1451,8 @@ dwarf2out_stack_adjust (rtx insn, bool after_p) for them. */ for (offset = 0, i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--) if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET) - offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i)); + offset += stack_adjust_offset (XVECEXP (PATTERN (insn), 0, i), + args_size, offset); } else return; @@ -1871,7 +1911,7 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label) { /* Stack adjustment combining might combine some post-prologue stack adjustment into a prologue stack adjustment. */ - HOST_WIDE_INT offset = stack_adjust_offset (elem); + HOST_WIDE_INT offset = stack_adjust_offset (elem, args_size, 0); if (offset != 0) dwarf2out_args_size_adjust (offset, label); diff --git a/gcc/final.c b/gcc/final.c index d00790797dd..aceeb7cfb13 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3349,8 +3349,9 @@ output_asm_label (rtx x) assemble_name (asm_out_file, buf); } -/* Helper rtx-iteration-function for output_operand. Marks - SYMBOL_REFs as referenced through use of assemble_external. */ +/* Helper rtx-iteration-function for mark_symbol_refs_as_used and + output_operand. Marks SYMBOL_REFs as referenced through use of + assemble_external. */ static int mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED) @@ -3374,6 +3375,14 @@ mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED) return 0; } +/* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */ + +void +mark_symbol_refs_as_used (rtx x) +{ + for_each_rtx (&x, mark_symbol_ref_as_used, NULL); +} + /* Print operand X using machine-dependent assembler syntax. The macro PRINT_OPERAND is defined just to control this function. CODE is a non-digit that preceded the operand-number in the % spec, diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1329354bb39..a01ae8fb0fe 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,117 @@ +2008-11-25 H.J. Lu <hongjiu.lu@intel.com> + + * module.c (gfc_dump_module): Report error on unlink only if + errno != ENOENT. + +2008-11-25 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/36463 + * expr.c (replace_symbol): Don't replace the symtree + if the expresion is an intrinsic function. Don't create + non-existent symtrees. Use symbol's name instead of symtree's, + different in case of module procedure dummy arguments. + +2008-11-25 Jan Kratochvil <jan.kratochvil@redhat.com> + + PR fortran/38248 + * module.c (gfc_dump_module): Check rename/unlink syscalls errors. + +2008-11-25 Eric Botcazou <ebotcazou@adacore.com> + + PR fortran/37319 + * parse.c (match_deferred_characteristics): Make sure 'name' is + initialized before reading it. + +2008-11-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/37803 + * arith.c (gfc_check_real_range): Add mpfr_check_range. + * simplify.c (gfc_simplify_nearest): Add mpfr_check_range. + +2008-11-24 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/38184 + * simplify.c (is_constant_array_expr): Return true instead of false + if the array constructor is empty. + +2008-11-24 Daniel Kraft <d@domob.eu> + + PR fortran/37779 + * resolve.c (resolve_procedure_expression): New method. + (resolve_variable): Call it. + (resolve_actual_arglist): Call gfc_resolve_expr for procedure arguments. + +2008-11-24 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/34820 + * trans-expr.c (gfc_conv_function_call): Remove all code to + deallocate intent out derived types with allocatable + components. + (gfc_trans_assignment_1): An assignment from a scalar to an + array of derived types with allocatable components, requires + a deep copy to each array element and deallocation of the + converted rhs expression afterwards. + * trans-array.c : Minor whitespace. + * trans-decl.c (init_intent_out_dt): Add code to deallocate + allocatable components of derived types with intent out. + (generate_local_decl): If these types are unused, set them + referenced anyway but allow the uninitialized warning. + + PR fortran/34143 + * trans-expr.c (gfc_trans_subcomponent_assign): If a conversion + expression has a null data pointer argument, nullify the + allocatable component. + + PR fortran/32795 + * trans-expr.c (gfc_trans_subcomponent_assign): Only nullify + the data pointer if the source is not a variable. + +2008-11-23 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/37735 + * trans-array.c (structure_alloc_comps): Do not duplicate the + descriptor if this is a descriptorless array! + +2008-11-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/38160 + * trans-types.c (gfc_validate_c_kind): Remove function. + * decl.c (gfc_match_kind_spec): Add C kind parameter check. + (verify_bind_c_derived_type): Remove gfc_validate_c_kind call. + (verify_c_interop_param): Update call. + * gfortran.h (verify_bind_c_derived_type): Update prototype. + (gfc_validate_c_kind): Remove. + * symbol.c (verify_bind_c_derived_type): Update verify_c_interop call. + * resolve.c (gfc_iso_c_func_interface): Ditto. + +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/37839 + * trans-io.c (gfc_build_io_library_fndecls): Decrease pad size back + to 16 pointers plus 32 integers. Don't use max integer kind + alignment, only gfc_intio_kind's alignment. + (gfc_trans_inquire): Only set flags2 if mask2 is non-zero. + * ioparm.def: Fix order, bitmasks and types of inquire round, sign + and pending fields. Move u in dt before id. + * io.c (gfc_free_inquire): Free decimal and size exprs. + (match_inquire_element): Match size instead of matching blank twice. + (gfc_resolve_inquire): Resolve size. + +2008-11-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/29215 + * trans-array.c (trans_array_constructor_value, + gfc_build_constant_array_constructor): Fill in TREE_PURPOSE. + + * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Use + gfc_index_one_node. + (gfc_conv_intrinsic_size): Use gfc_index_{zero,one}_node. + + PR fortran/38181 + * trans-intrinsic.c (gfc_conv_intrinsic_size): Inline 2 argument + size if the second argument is not optional and one argument size + for rank 1 arrays. + 2008-11-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38171 diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index c56be036e2f..7440be3a230 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -379,6 +379,7 @@ gfc_check_real_range (mpfr_t p, int kind) en = gfc_real_kinds[i].min_exponent - gfc_real_kinds[i].digits + 1; mpfr_set_emin ((mp_exp_t) en); mpfr_set_emax ((mp_exp_t) gfc_real_kinds[i].max_exponent); + mpfr_check_range (q, 0, GFC_RND_MODE); mpfr_subnormalize (q, 0, GFC_RND_MODE); /* Reset emin and emax. */ diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index fe044c7c698..dabbafa68c6 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -918,7 +918,7 @@ verify_c_interop_param (gfc_symbol *sym) if (sym->ns->proc_name->attr.is_bind_c == 1) { is_c_interop = - (verify_c_interop (&(sym->ts), sym->name, &(sym->declared_at)) + (verify_c_interop (&(sym->ts)) == SUCCESS ? 1 : 0); if (is_c_interop != 1) @@ -1982,6 +1982,17 @@ kind_expr: return MATCH_ERROR; } + /* Warn if, e.g., c_int is used for a REAL variable, but not + if, e.g., c_double is used for COMPLEX as the standard + explicitly says that the kind type parameter for complex and real + variable is the same, i.e. c_float == c_float_complex. */ + if (ts->f90_type != BT_UNKNOWN && ts->f90_type != ts->type + && !((ts->f90_type == BT_REAL && ts->type == BT_COMPLEX) + || (ts->f90_type == BT_COMPLEX && ts->type == BT_REAL))) + gfc_error_now ("C kind type parameter is for type %s but type at %L " + "is %s", gfc_basic_typename (ts->f90_type), &where, + gfc_basic_typename (ts->type)); + gfc_gobble_whitespace (); if ((c = gfc_next_ascii_char ()) != ')' && (ts->type != BT_CHARACTER || c != ',')) @@ -3299,29 +3310,8 @@ set_com_block_bind_c (gfc_common_head *com_block, int is_bind_c) /* Verify that the given gfc_typespec is for a C interoperable type. */ gfc_try -verify_c_interop (gfc_typespec *ts, const char *name, locus *where) +verify_c_interop (gfc_typespec *ts) { - gfc_try t; - - /* Make sure the kind used is appropriate for the type. - The f90_type is unknown if an integer constant was - used (e.g., real(4), bind(c) :: myFloat). */ - if (ts->f90_type != BT_UNKNOWN) - { - t = gfc_validate_c_kind (ts); - if (t != SUCCESS) - { - /* Print an error, but continue parsing line. */ - gfc_error_now ("C kind parameter is for type %s but " - "symbol '%s' at %L is of type %s", - gfc_basic_typename (ts->f90_type), - name, where, - gfc_basic_typename (ts->type)); - } - } - - /* Make sure the kind is C interoperable. This does not care about the - possible error above. */ if (ts->type == BT_DERIVED && ts->derived != NULL) return (ts->derived->ts.is_c_interop ? SUCCESS : FAILURE); else if (ts->is_c_interop != 1) @@ -3396,8 +3386,7 @@ verify_bind_c_sym (gfc_symbol *tmp_sym, gfc_typespec *ts, the given ts (current_ts), so look in both. */ if (tmp_sym->ts.type != BT_UNKNOWN || ts->type != BT_UNKNOWN) { - if (verify_c_interop (&(tmp_sym->ts), tmp_sym->name, - &(tmp_sym->declared_at)) != SUCCESS) + if (verify_c_interop (&(tmp_sym->ts)) != SUCCESS) { /* See if we're dealing with a sym in a common block or not. */ if (is_in_common == 1) diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index ea766537a50..4017cf91f33 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3510,11 +3510,18 @@ gfc_expr_check_typed (gfc_expr* e, gfc_namespace* ns, bool strict) static bool replace_symbol (gfc_expr *expr, gfc_symbol *sym, int *i ATTRIBUTE_UNUSED) { - if ((expr->expr_type == EXPR_VARIABLE || expr->expr_type == EXPR_FUNCTION) + if ((expr->expr_type == EXPR_VARIABLE + || (expr->expr_type == EXPR_FUNCTION + && !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where))) && expr->symtree->n.sym->ns == sym->ts.interface->formal_ns) { gfc_symtree *stree; - gfc_get_sym_tree (expr->symtree->name, sym->formal_ns, &stree); + gfc_namespace *ns = sym->formal_ns; + /* Don't use gfc_get_symtree as we prefer to fail badly if we don't find + the symtree rather than create a new one (and probably fail later). */ + stree = gfc_find_symtree (ns ? ns->sym_root : gfc_current_ns->sym_root, + expr->symtree->n.sym->name); + gcc_assert (stree); stree->n.sym->attr = expr->symtree->n.sym->attr; expr->symtree = stree; } diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index ac68a52dd3d..d5d28f24fbc 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2215,7 +2215,6 @@ arith gfc_check_integer_range (mpz_t p, int kind); bool gfc_check_character_range (gfc_char_t, int); /* trans-types.c */ -gfc_try gfc_validate_c_kind (gfc_typespec *); gfc_try gfc_check_any_c_kind (gfc_typespec *); int gfc_validate_kind (bt, int, bool); extern int gfc_index_integer_kind; @@ -2319,7 +2318,7 @@ gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *); int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **); int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **); int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **); -gfc_try verify_c_interop (gfc_typespec *, const char *name, locus *where); +gfc_try verify_c_interop (gfc_typespec *); gfc_try verify_c_interop_param (gfc_symbol *); gfc_try verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *); gfc_try verify_bind_c_derived_type (gfc_symbol *); diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 1c42a96d714..85b712f5977 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3540,9 +3540,11 @@ gfc_free_inquire (gfc_inquire *inquire) gfc_free_expr (inquire->convert); gfc_free_expr (inquire->strm_pos); gfc_free_expr (inquire->asynchronous); + gfc_free_expr (inquire->decimal); gfc_free_expr (inquire->pending); gfc_free_expr (inquire->id); gfc_free_expr (inquire->sign); + gfc_free_expr (inquire->size); gfc_free_expr (inquire->round); gfc_free (inquire); } @@ -3584,7 +3586,7 @@ match_inquire_element (gfc_inquire *inquire) RETM m = match_vtag (&tag_s_async, &inquire->asynchronous); RETM m = match_vtag (&tag_s_delim, &inquire->delim); RETM m = match_vtag (&tag_s_decimal, &inquire->decimal); - RETM m = match_vtag (&tag_s_blank, &inquire->blank); + RETM m = match_vtag (&tag_size, &inquire->size); RETM m = match_vtag (&tag_s_encoding, &inquire->encoding); RETM m = match_vtag (&tag_s_round, &inquire->round); RETM m = match_vtag (&tag_s_sign, &inquire->sign); @@ -3761,6 +3763,7 @@ gfc_resolve_inquire (gfc_inquire *inquire) RESOLVE_TAG (&tag_s_sign, inquire->sign); RESOLVE_TAG (&tag_s_round, inquire->round); RESOLVE_TAG (&tag_pending, inquire->pending); + RESOLVE_TAG (&tag_size, inquire->size); RESOLVE_TAG (&tag_id, inquire->id); if (gfc_reference_st_label (inquire->err, ST_LABEL_TARGET) == FAILURE) diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index deb1b98389c..eba719f0a91 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -63,9 +63,9 @@ IOPARM (inquire, flags2, 1 << 31, int4) IOPARM (inquire, asynchronous, 1 << 0, char1) IOPARM (inquire, decimal, 1 << 1, char2) IOPARM (inquire, encoding, 1 << 2, char1) -IOPARM (inquire, pending, 1 << 3, pint4) -IOPARM (inquire, round, 1 << 4, char1) -IOPARM (inquire, sign, 1 << 5, char2) +IOPARM (inquire, round, 1 << 3, char2) +IOPARM (inquire, sign, 1 << 4, char1) +IOPARM (inquire, pending, 1 << 5, pint4) IOPARM (inquire, size, 1 << 6, pint4) IOPARM (inquire, id, 1 << 7, pint4) IOPARM (wait, common, 0, common) @@ -83,6 +83,7 @@ IOPARM (dt, format, 1 << 12, char1) IOPARM (dt, advance, 1 << 13, char2) IOPARM (dt, internal_unit, 1 << 14, char1) IOPARM (dt, namelist_name, 1 << 15, char2) +IOPARM (dt, u, 0, pad) IOPARM (dt, id, 1 << 16, pint4) IOPARM (dt, pos, 1 << 17, intio) IOPARM (dt, asynchronous, 1 << 18, char1) @@ -92,4 +93,3 @@ IOPARM (dt, delim, 1 << 21, char2) IOPARM (dt, pad, 1 << 22, char1) IOPARM (dt, round, 1 << 23, char2) IOPARM (dt, sign, 1 << 24, char1) -IOPARM (dt, u, 0, pad) diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 35f5ce5176d..1b32ee2755d 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4850,11 +4850,19 @@ gfc_dump_module (const char *name, int dump_flag) || memcmp (md5_old, md5_new, sizeof (md5_old)) != 0) { /* Module file have changed, replace the old one. */ - unlink (filename); - rename (filename_tmp, filename); + if (unlink (filename) && errno != ENOENT) + gfc_fatal_error ("Can't delete module file '%s': %s", filename, + strerror (errno)); + if (rename (filename_tmp, filename)) + gfc_fatal_error ("Can't rename module file '%s' to '%s': %s", + filename_tmp, filename, strerror (errno)); } else - unlink (filename_tmp); + { + if (unlink (filename_tmp)) + gfc_fatal_error ("Can't delete temporary module file '%s': %s", + filename_tmp, strerror (errno)); + } } diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 954a22f0926..7eb00278053 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -2265,8 +2265,9 @@ match_deferred_characteristics (gfc_typespec * ts) /* Set the function locus correctly. If we have not found the function name, there is an error. */ - gfc_match ("function% %n", name); - if (m == MATCH_YES && strcmp (name, gfc_current_block ()->name) == 0) + if (m == MATCH_YES + && gfc_match ("function% %n", name) == MATCH_YES + && strcmp (name, gfc_current_block ()->name) == 0) { gfc_current_block ()->declared_at = gfc_current_locus; gfc_commit_symbols (); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e4766d6de56..f1c27e62b59 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1072,6 +1072,33 @@ count_specific_procs (gfc_expr *e) return n; } + +/* Resolve a procedure expression, like passing it to a called procedure or as + RHS for a procedure pointer assignment. */ + +static gfc_try +resolve_procedure_expression (gfc_expr* expr) +{ + gfc_symbol* sym; + + if (expr->ts.type != BT_PROCEDURE || expr->expr_type != EXPR_VARIABLE) + return SUCCESS; + gcc_assert (expr->symtree); + sym = expr->symtree->n.sym; + gcc_assert (sym->attr.flavor == FL_PROCEDURE); + + /* A non-RECURSIVE procedure that is used as procedure expression within its + own body is in danger of being called recursively. */ + if (!sym->attr.recursive && sym == gfc_current_ns->proc_name + && !gfc_option.flag_recursive) + gfc_warning ("Non-RECURSIVE procedure '%s' at %L is possibly calling" + " itself recursively. Declare it RECURSIVE or use" + " -frecursive", sym->name, &expr->where); + + return SUCCESS; +} + + /* Resolve an actual argument list. Most of the time, this is just resolving the expressions in the list. The exception is that we sometimes have to decide whether arguments @@ -1180,8 +1207,8 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype, && sym->ns == gfc_current_ns && !sym->ns->entries->sym->attr.recursive) { - gfc_error ("Reference to ENTRY '%s' at %L is recursive, but procedure " - "'%s' is not declared as RECURSIVE", + gfc_error ("Reference to ENTRY '%s' at %L is recursive, but" + " procedure '%s' is not declared as RECURSIVE", sym->name, &e->where, sym->ns->entries->sym->name); } @@ -1211,6 +1238,9 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype, sym->attr.intrinsic = 1; sym->attr.function = 1; } + + if (gfc_resolve_expr (e) == FAILURE) + return FAILURE; goto argument_list; } @@ -1235,6 +1265,8 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype, || sym->attr.intrinsic || sym->attr.external) { + if (gfc_resolve_expr (e) == FAILURE) + return FAILURE; goto argument_list; } @@ -2073,10 +2105,7 @@ gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args, } /* See if we have interoperable type and type param. */ - if (verify_c_interop (arg_ts, - (parent_ref ? parent_ref->u.c.component->name - : args_sym->name), - &(args->expr->where)) == SUCCESS + if (verify_c_interop (arg_ts) == SUCCESS || gfc_check_any_c_kind (arg_ts) == SUCCESS) { if (args_sym->attr.target == 1) @@ -4158,7 +4187,7 @@ resolve_variable (gfc_expr *e) if (sym->attr.flavor == FL_PROCEDURE && !sym->attr.function) { e->ts.type = BT_PROCEDURE; - return SUCCESS; + goto resolve_procedure; } if (sym->ts.type != BT_UNKNOWN) @@ -4240,6 +4269,10 @@ resolve_variable (gfc_expr *e) sym->entry_id = current_entry_id + 1; } +resolve_procedure: + if (t == SUCCESS && resolve_procedure_expression (e) == FAILURE) + t = FAILURE; + return t; } diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 34105bc4d35..6904960eb94 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -2993,6 +2993,7 @@ gfc_simplify_nearest (gfc_expr *x, gfc_expr *s) mpfr_set_emin ((mp_exp_t) gfc_real_kinds[kind].min_exponent - mpfr_get_prec(result->value.real) + 1); mpfr_set_emax ((mp_exp_t) gfc_real_kinds[kind].max_exponent - 1); + mpfr_check_range (result->value.real, 0, GMP_RNDU); if (mpfr_sgn (s->value.real) > 0) { @@ -3410,9 +3411,6 @@ is_constant_array_expr (gfc_expr *e) if (e->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (e)) return false; - if (e->value.constructor == NULL) - return false; - for (c = e->value.constructor; c; c = c->next) if (c->expr->expr_type != EXPR_CONSTANT) return false; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index ac953bde6bb..4e81b89e2b0 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -3395,8 +3395,7 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym) else { /* Grab the typespec for the given component and test the kind. */ - is_c_interop = verify_c_interop (&(curr_comp->ts), curr_comp->name, - &(curr_comp->loc)); + is_c_interop = verify_c_interop (&(curr_comp->ts)); if (is_c_interop != SUCCESS) { diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 9c48c421465..06d2e3d0ca5 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1235,6 +1235,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, tree init; tree bound; tree tmptype; + HOST_WIDE_INT idx = 0; p = c; list = NULL_TREE; @@ -1253,7 +1254,8 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, (gfc_get_pchar_type (p->expr->ts.kind), se.expr); - list = tree_cons (NULL_TREE, se.expr, list); + list = tree_cons (build_int_cst (gfc_array_index_type, + idx++), se.expr, list); c = p; p = p->next; } @@ -1619,7 +1621,8 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type) if (c->expr->ts.type == BT_CHARACTER && POINTER_TYPE_P (type)) se.expr = gfc_build_addr_expr (gfc_get_pchar_type (c->expr->ts.kind), se.expr); - list = tree_cons (NULL_TREE, se.expr, list); + list = tree_cons (build_int_cst (gfc_array_index_type, nelem), + se.expr, list); c = c->next; nelem++; } @@ -5273,7 +5276,6 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77, gfc_conv_expr_descriptor (se, expr, ss); } - /* Deallocate the allocatable components of structures that are not variable. */ if (expr->ts.type == BT_DERIVED @@ -5543,10 +5545,12 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, if (purpose == COPY_ALLOC_COMP) { - tmp = gfc_duplicate_allocatable (dest, decl, TREE_TYPE(decl), rank); - gfc_add_expr_to_block (&fnblock, tmp); - - tmp = build_fold_indirect_ref (gfc_conv_descriptor_data_get (dest)); + if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest))) + { + tmp = gfc_duplicate_allocatable (dest, decl, TREE_TYPE(decl), rank); + gfc_add_expr_to_block (&fnblock, tmp); + } + tmp = build_fold_indirect_ref (gfc_conv_array_data (dest)); dref = gfc_build_array_ref (tmp, index, NULL); tmp = structure_alloc_comps (der_type, vref, dref, rank, purpose); } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 1b47f2673e6..91db5df5840 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2781,20 +2781,34 @@ gfc_init_default_dt (gfc_symbol * sym, tree body) } -/* Initialize INTENT(OUT) derived type dummies. */ +/* Initialize INTENT(OUT) derived type dummies. As well as giving + them their default initializer, if they do not have allocatable + components, they have their allocatable components deallocated. */ + static tree init_intent_out_dt (gfc_symbol * proc_sym, tree body) { stmtblock_t fnblock; gfc_formal_arglist *f; + tree tmp; gfc_init_block (&fnblock); for (f = proc_sym->formal; f; f = f->next) if (f->sym && f->sym->attr.intent == INTENT_OUT - && f->sym->ts.type == BT_DERIVED - && !f->sym->ts.derived->attr.alloc_comp - && f->sym->value) - body = gfc_init_default_dt (f->sym, body); + && f->sym->ts.type == BT_DERIVED) + { + if (f->sym->ts.derived->attr.alloc_comp) + { + tmp = gfc_deallocate_alloc_comp (f->sym->ts.derived, + f->sym->backend_decl, + f->sym->as ? f->sym->as->rank : 0); + gfc_add_expr_to_block (&fnblock, tmp); + } + + if (!f->sym->ts.derived->attr.alloc_comp + && f->sym->value) + body = gfc_init_default_dt (f->sym, body); + } gfc_add_expr_to_block (&fnblock, body); return gfc_finish_block (&fnblock); @@ -3482,10 +3496,10 @@ generate_local_decl (gfc_symbol * sym) if (sym->attr.flavor == FL_VARIABLE) { if (!sym->attr.dummy && !sym->ns->proc_name->attr.entry_master) - generate_dependency_declarations (sym); + generate_dependency_declarations (sym); if (sym->attr.referenced) - gfc_get_symbol_decl (sym); + gfc_get_symbol_decl (sym); /* INTENT(out) dummy arguments are likely meant to be set. */ else if (warn_unused_variable && sym->attr.dummy @@ -3502,20 +3516,34 @@ generate_local_decl (gfc_symbol * sym) && !(sym->attr.in_common || sym->attr.use_assoc || sym->mark)) gfc_warning ("Unused variable '%s' declared at %L", sym->name, &sym->declared_at); + /* For variable length CHARACTER parameters, the PARM_DECL already references the length variable, so force gfc_get_symbol_decl even when not referenced. If optimize > 0, it will be optimized away anyway. But do this only after emitting -Wunused-parameter warning if requested. */ - if (sym->attr.dummy && ! sym->attr.referenced - && sym->ts.type == BT_CHARACTER - && sym->ts.cl->backend_decl != NULL - && TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL) + if (sym->attr.dummy && !sym->attr.referenced + && sym->ts.type == BT_CHARACTER + && sym->ts.cl->backend_decl != NULL + && TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL) { sym->attr.referenced = 1; gfc_get_symbol_decl (sym); } + /* INTENT(out) dummy arguments with allocatable components are reset + by default and need to be set referenced to generate the code for + automatic lengths. */ + if (sym->attr.dummy && !sym->attr.referenced + && sym->ts.type == BT_DERIVED + && sym->ts.derived->attr.alloc_comp + && sym->attr.intent == INTENT_OUT) + { + sym->attr.referenced = 1; + gfc_get_symbol_decl (sym); + } + + /* Check for dependencies in the array specification and string length, adding the necessary declarations to the function. We mark the symbol now, as well as in traverse_ns, to prevent diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index e096021259b..5d3894c825d 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2742,14 +2742,11 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, gfc_add_block_to_block (&post, &parmse.post); /* Allocated allocatable components of derived types must be - deallocated for INTENT(OUT) dummy arguments and non-variable - scalars. Non-variable arrays are dealt with in trans-array.c - (gfc_conv_array_parameter). */ + deallocated for non-variable scalars. Non-variable arrays are + dealt with in trans-array.c(gfc_conv_array_parameter). */ if (e && e->ts.type == BT_DERIVED && e->ts.derived->attr.alloc_comp - && ((formal && formal->sym->attr.intent == INTENT_OUT) - || - (e->expr_type != EXPR_VARIABLE && !e->rank))) + && (e->expr_type != EXPR_VARIABLE && !e->rank)) { int parm_rank; tmp = build_fold_indirect_ref (parmse.expr); @@ -2764,24 +2761,10 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, case (SCALAR_POINTER): tmp = build_fold_indirect_ref (tmp); break; - case (ARRAY): - tmp = parmse.expr; - break; } - tmp = gfc_deallocate_alloc_comp (e->ts.derived, tmp, parm_rank); - if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.optional) - tmp = build3_v (COND_EXPR, gfc_conv_expr_present (e->symtree->n.sym), - tmp, build_empty_stmt ()); - - if (e->expr_type != EXPR_VARIABLE) - /* Don't deallocate non-variables until they have been used. */ - gfc_add_expr_to_block (&se->post, tmp); - else - { - gcc_assert (formal && formal->sym->attr.intent == INTENT_OUT); - gfc_add_expr_to_block (&se->pre, tmp); - } + tmp = gfc_deallocate_alloc_comp (e->ts.derived, tmp, parm_rank); + gfc_add_expr_to_block (&se->post, tmp); } /* Character strings are passed as two parameters, a length and a @@ -3610,9 +3593,10 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) cm->as->rank); gfc_add_expr_to_block (&block, tmp); - gfc_add_block_to_block (&block, &se.post); - gfc_conv_descriptor_data_set (&block, se.expr, null_pointer_node); + + if (expr->expr_type != EXPR_VARIABLE) + gfc_conv_descriptor_data_set (&block, se.expr, null_pointer_node); /* Shift the lbound and ubound of temporaries to being unity, rather than zero, based. Calculate the offset for all cases. */ @@ -3644,6 +3628,35 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp2); gfc_add_modify (&block, offset, tmp); } + + if (expr->expr_type == EXPR_FUNCTION + && expr->value.function.isym + && expr->value.function.isym->conversion + && expr->value.function.actual->expr + && expr->value.function.actual->expr->expr_type + == EXPR_VARIABLE) + { + /* If a conversion expression has a null data pointer + argument, nullify the allocatable component. */ + gfc_symbol *s; + tree non_null_expr; + tree null_expr; + s = expr->value.function.actual->expr->symtree->n.sym; + if (s->attr.allocatable || s->attr.pointer) + { + non_null_expr = gfc_finish_block (&block); + gfc_start_block (&block); + gfc_conv_descriptor_data_set (&block, dest, + null_pointer_node); + null_expr = gfc_finish_block (&block); + tmp = gfc_conv_descriptor_data_get (s->backend_decl); + tmp = build2 (EQ_EXPR, boolean_type_node, tmp, + fold_convert (TREE_TYPE (tmp), + null_pointer_node)); + return build3_v (COND_EXPR, tmp, null_expr, + non_null_expr); + } + } } else { @@ -4533,6 +4546,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag) stmtblock_t block; stmtblock_t body; bool l_is_temp; + bool scalar_to_array; /* Assignment of the form lhs = rhs. */ gfc_start_block (&block); @@ -4616,9 +4630,24 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag) else gfc_conv_expr (&lse, expr1); + /* Assignments of scalar derived types with allocatable components + to arrays must be done with a deep copy and the rhs temporary + must have its components deallocated afterwards. */ + scalar_to_array = (expr2->ts.type == BT_DERIVED + && expr2->ts.derived->attr.alloc_comp + && expr2->expr_type != EXPR_VARIABLE + && !gfc_is_constant_expr (expr2) + && expr1->rank && !expr2->rank); + if (scalar_to_array) + { + tmp = gfc_deallocate_alloc_comp (expr2->ts.derived, rse.expr, 0); + gfc_add_expr_to_block (&loop.post, tmp); + } + tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts, l_is_temp || init_flag, - expr2->expr_type == EXPR_VARIABLE); + (expr2->expr_type == EXPR_VARIABLE) + || scalar_to_array); gfc_add_expr_to_block (&body, tmp); if (lss == gfc_ss_terminator) diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index b8d9f3ed43a..629ec0afb03 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2209,7 +2209,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, gfc_index_one_node, loop.from[0]); else - tmp = build_int_cst (gfc_array_index_type, 1); + tmp = gfc_index_one_node; gfc_add_modify (&block, offset, tmp); @@ -3397,10 +3397,6 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) gfc_array_index_type); gfc_add_block_to_block (&se->pre, &argse.pre); - /* Build the call to size1. */ - fncall1 = build_call_expr (gfor_fndecl_size1, 2, - arg1, argse.expr); - /* Unusually, for an intrinsic, size does not exclude an optional arg2, so we must test for it. */ if (actual->expr->expr_type == EXPR_VARIABLE @@ -3408,6 +3404,10 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) && actual->expr->symtree->n.sym->attr.optional) { tree tmp; + /* Build the call to size1. */ + fncall1 = build_call_expr (gfor_fndecl_size1, 2, + arg1, argse.expr); + gfc_init_se (&argse, NULL); argse.want_pointer = 1; argse.data_not_needed = 1; @@ -3420,11 +3420,35 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr) tmp, fncall1, fncall0); } else - se->expr = fncall1; + { + se->expr = NULL_TREE; + argse.expr = fold_build2 (MINUS_EXPR, gfc_array_index_type, + argse.expr, gfc_index_one_node); + } + } + else if (expr->value.function.actual->expr->rank == 1) + { + argse.expr = gfc_index_zero_node; + se->expr = NULL_TREE; } else se->expr = fncall0; + if (se->expr == NULL_TREE) + { + tree ubound, lbound; + + arg1 = build_fold_indirect_ref (arg1); + ubound = gfc_conv_descriptor_ubound (arg1, argse.expr); + lbound = gfc_conv_descriptor_lbound (arg1, argse.expr); + se->expr = fold_build2 (MINUS_EXPR, gfc_array_index_type, + ubound, lbound); + se->expr = fold_build2 (PLUS_EXPR, gfc_array_index_type, se->expr, + gfc_index_one_node); + se->expr = fold_build2 (MAX_EXPR, gfc_array_index_type, se->expr, + gfc_index_zero_node); + } + type = gfc_typenode_for_spec (&expr->ts); se->expr = convert (type, se->expr); } diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index af46ea2d65a..b5749ec89ac 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -291,9 +291,9 @@ gfc_build_io_library_fndecls (void) = build_pointer_type (gfc_intio_type_node); types[IOPARM_type_parray] = pchar_type_node; types[IOPARM_type_pchar] = pchar_type_node; - pad_size = 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); + pad_size = 16 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); pad_size += 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (integer_type_node)); - pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size)); + pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size - 1)); types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx); /* pad actually contains pointers and integers so it needs to have an @@ -301,7 +301,7 @@ gfc_build_io_library_fndecls (void) types. See the st_parameter_dt structure in libgfortran/io/io.h for what really goes into this space. */ TYPE_ALIGN (types[IOPARM_type_pad]) = MAX (TYPE_ALIGN (pchar_type_node), - TYPE_ALIGN (gfc_get_int_type (gfc_max_integer_kind))); + TYPE_ALIGN (gfc_get_int_type (gfc_intio_kind))); for (ptype = IOPARM_ptype_common; ptype < IOPARM_ptype_num; ptype++) gfc_build_st_parameter (ptype, types); @@ -1315,10 +1315,8 @@ gfc_trans_inquire (gfc_code * code) mask2 |= set_parameter_ref (&block, &post_block,var, IOPARM_inquire_id, p->id); - set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2); - if (mask2) - mask |= IOPARM_inquire_flags2; + mask |= set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2); set_parameter_const (&block, var, IOPARM_common_flags, mask); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index c4c83143777..de629646ec8 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -117,20 +117,6 @@ int gfc_numeric_storage_size; int gfc_character_storage_size; -/* Validate that the f90_type of the given gfc_typespec is valid for - the type it represents. The f90_type represents the Fortran types - this C kind can be used with. For example, c_int has a f90_type of - BT_INTEGER and c_float has a f90_type of BT_REAL. Returns FAILURE - if a mismatch occurs between ts->f90_type and ts->type; SUCCESS if - they match. */ - -gfc_try -gfc_validate_c_kind (gfc_typespec *ts) -{ - return ((ts->type == ts->f90_type) ? SUCCESS : FAILURE); -} - - gfc_try gfc_check_any_c_kind (gfc_typespec *ts) { diff --git a/gcc/function.c b/gcc/function.c index 233ff6d09b5..832079004f8 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2436,7 +2436,7 @@ assign_parm_remove_parallels (struct assign_parm_data_one *data) if (GET_CODE (entry_parm) == PARALLEL && GET_MODE (entry_parm) != BLKmode) { rtx parmreg = gen_reg_rtx (GET_MODE (entry_parm)); - emit_group_store (parmreg, entry_parm, NULL_TREE, + emit_group_store (parmreg, entry_parm, data->passed_type, GET_MODE_SIZE (GET_MODE (entry_parm))); entry_parm = parmreg; } diff --git a/gcc/ira-build.c b/gcc/ira-build.c index e4ed60141fa..65e4ad76dbb 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -1677,20 +1677,81 @@ low_pressure_loop_node_p (ira_loop_tree_node_t node) return true; } -/* Return TRUE if NODE represents a loop with should be removed from - regional allocation. We remove a loop with low register pressure - inside another loop with register pressure. In this case a - separate allocation of the loop hardly helps (for irregular - register file architecture it could help by choosing a better hard - register in the loop but we prefer faster allocation even in this - case). */ -static bool -loop_node_to_be_removed_p (ira_loop_tree_node_t node) +/* Sort loops for marking them for removal. We put already marked + loops first, then less frequent loops next, and then outer loops + next. */ +static int +loop_compare_func (const void *v1p, const void *v2p) +{ + int diff; + ira_loop_tree_node_t l1 = *(const ira_loop_tree_node_t *) v1p; + ira_loop_tree_node_t l2 = *(const ira_loop_tree_node_t *) v2p; + + ira_assert (l1->parent != NULL && l2->parent != NULL); + if (l1->to_remove_p && ! l2->to_remove_p) + return -1; + if (! l1->to_remove_p && l2->to_remove_p) + return 1; + if ((diff = l1->loop->header->frequency - l2->loop->header->frequency) != 0) + return diff; + if ((diff = (int) loop_depth (l1->loop) - (int) loop_depth (l2->loop)) != 0) + return diff; + /* Make sorting stable. */ + return l1->loop->num - l2->loop->num; +} + + +/* Mark loops which should be removed from regional allocation. We + remove a loop with low register pressure inside another loop with + register pressure. In this case a separate allocation of the loop + hardly helps (for irregular register file architecture it could + help by choosing a better hard register in the loop but we prefer + faster allocation even in this case). We also remove cheap loops + if there are more than IRA_MAX_LOOPS_NUM of them. */ +static void +mark_loops_for_removal (void) { - return (node->parent != NULL && low_pressure_loop_node_p (node->parent) - && low_pressure_loop_node_p (node)); + int i, n; + ira_loop_tree_node_t *sorted_loops; + loop_p loop; + + sorted_loops + = (ira_loop_tree_node_t *) ira_allocate (sizeof (ira_loop_tree_node_t) + * VEC_length (loop_p, + ira_loops.larray)); + for (n = i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++) + if (ira_loop_nodes[i].regno_allocno_map != NULL) + { + if (ira_loop_nodes[i].parent == NULL) + { + /* Don't remove the root. */ + ira_loop_nodes[i].to_remove_p = false; + continue; + } + sorted_loops[n++] = &ira_loop_nodes[i]; + ira_loop_nodes[i].to_remove_p + = (low_pressure_loop_node_p (ira_loop_nodes[i].parent) + && low_pressure_loop_node_p (&ira_loop_nodes[i])); + } + qsort (sorted_loops, n, sizeof (ira_loop_tree_node_t), loop_compare_func); + for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++) + { + sorted_loops[i]->to_remove_p = true; + if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL) + fprintf + (ira_dump_file, + " Mark loop %d (header %d, freq %d, depth %d) for removal (%s)\n", + sorted_loops[i]->loop->num, sorted_loops[i]->loop->header->index, + sorted_loops[i]->loop->header->frequency, + loop_depth (sorted_loops[i]->loop), + low_pressure_loop_node_p (sorted_loops[i]->parent) + && low_pressure_loop_node_p (sorted_loops[i]) + ? "low pressure" : "cheap loop"); + } + ira_free (sorted_loops); } + /* Definition of vector of loop tree nodes. */ DEF_VEC_P(ira_loop_tree_node_t); DEF_VEC_ALLOC_P(ira_loop_tree_node_t, heap); @@ -1710,7 +1771,7 @@ remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_node_t node) bool remove_p; ira_loop_tree_node_t subnode; - remove_p = loop_node_to_be_removed_p (node); + remove_p = node->to_remove_p; if (! remove_p) VEC_safe_push (ira_loop_tree_node_t, heap, children_vec, node); start = VEC_length (ira_loop_tree_node_t, children_vec); @@ -1759,13 +1820,13 @@ remove_unnecessary_allocnos (void) { next_a = ALLOCNO_NEXT_REGNO_ALLOCNO (a); a_node = ALLOCNO_LOOP_TREE_NODE (a); - if (! loop_node_to_be_removed_p (a_node)) + if (! a_node->to_remove_p) prev_a = a; else { for (parent = a_node->parent; (parent_a = parent->regno_allocno_map[regno]) == NULL - && loop_node_to_be_removed_p (parent); + && parent->to_remove_p; parent = parent->parent) ; if (parent_a == NULL) @@ -1843,6 +1904,7 @@ remove_unnecessary_allocnos (void) static void remove_unnecessary_regions (void) { + mark_loops_for_removal (); children_vec = VEC_alloc (ira_loop_tree_node_t, heap, last_basic_block + VEC_length (loop_p, ira_loops.larray)); diff --git a/gcc/ira-color.c b/gcc/ira-color.c index c3b63cc3d5d..4b9909194d6 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -655,6 +655,17 @@ static ira_allocno_t uncolorable_allocno_bucket; of given *cover* class in the uncolorable_bucket. */ static int uncolorable_allocnos_num[N_REG_CLASSES]; +/* Return the current spill priority of allocno A. The less the + number, the more preferable the allocno for spilling. */ +static int +allocno_spill_priority (ira_allocno_t a) +{ + return (ALLOCNO_TEMP (a) + / (ALLOCNO_LEFT_CONFLICTS_NUM (a) + * ira_reg_class_nregs[ALLOCNO_COVER_CLASS (a)][ALLOCNO_MODE (a)] + + 1)); +} + /* Add ALLOCNO to bucket *BUCKET_PTR. ALLOCNO should be not in a bucket before the call. */ static void @@ -925,7 +936,12 @@ remove_allocno_from_bucket_and_push (ira_allocno_t allocno, bool colorable_p) { fprintf (ira_dump_file, " Pushing"); print_coalesced_allocno (allocno); - fprintf (ira_dump_file, "%s\n", colorable_p ? "" : "(potential spill)"); + if (colorable_p) + fprintf (ira_dump_file, "\n"); + else + fprintf (ira_dump_file, "(potential spill: %spri=%d, cost=%d)\n", + ALLOCNO_BAD_SPILL_P (allocno) ? "bad spill, " : "", + allocno_spill_priority (allocno), ALLOCNO_TEMP (allocno)); } cover_class = ALLOCNO_COVER_CLASS (allocno); ira_assert ((colorable_p @@ -959,7 +975,7 @@ push_allocno_to_spill (ira_allocno_t allocno) delete_allocno_from_bucket (allocno, &uncolorable_allocno_bucket); ALLOCNO_MAY_BE_SPILLED_P (allocno) = true; if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL) - fprintf (ira_dump_file, " Pushing p%d(%d) (potential spill)\n", + fprintf (ira_dump_file, " Pushing p%d(%d) (spill for NO_REGS)\n", ALLOCNO_NUM (allocno), ALLOCNO_REGNO (allocno)); push_allocno_to_stack (allocno); } @@ -1224,21 +1240,18 @@ push_allocnos_to_stack (void) i++; ira_assert (ALLOCNO_TEMP (i_allocno) != INT_MAX); i_allocno_cost = ALLOCNO_TEMP (i_allocno); - i_allocno_pri - = (i_allocno_cost - / (ALLOCNO_LEFT_CONFLICTS_NUM (i_allocno) - * ira_reg_class_nregs[ALLOCNO_COVER_CLASS - (i_allocno)] - [ALLOCNO_MODE (i_allocno)] + 1)); + i_allocno_pri = allocno_spill_priority (i_allocno); if (allocno == NULL || (! ALLOCNO_BAD_SPILL_P (i_allocno) && ALLOCNO_BAD_SPILL_P (allocno)) - || allocno_pri > i_allocno_pri - || (allocno_pri == i_allocno_pri - && (allocno_cost > i_allocno_cost - || (allocno_cost == i_allocno_cost - && (ALLOCNO_NUM (allocno) - > ALLOCNO_NUM (i_allocno)))))) + || (! (ALLOCNO_BAD_SPILL_P (i_allocno) + && ! ALLOCNO_BAD_SPILL_P (allocno)) + && (allocno_pri > i_allocno_pri + || (allocno_pri == i_allocno_pri + && (allocno_cost > i_allocno_cost + || (allocno_cost == i_allocno_cost + && (ALLOCNO_NUM (allocno) + > ALLOCNO_NUM (i_allocno)))))))) { allocno = i_allocno; allocno_cost = i_allocno_cost; diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 280cbb51c9e..3daeb075d34 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1172,7 +1172,7 @@ find_allocno_class_costs (void) ira_allocno_t a, parent_a; int rclass, a_num, parent_a_num; ira_loop_tree_node_t parent; - int best_cost; + int best_cost, allocno_cost; enum reg_class best, alt_class, common_class; #ifdef FORBIDDEN_INC_DEC_CLASSES int inc_dec_p = false; @@ -1278,6 +1278,7 @@ find_allocno_class_costs (void) /* Finding best class which is subset of the common class. */ best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1; + allocno_cost = best_cost; best = ALL_REGS; for (k = 0; k < cost_classes_num; k++) { @@ -1302,12 +1303,21 @@ find_allocno_class_costs (void) { best_cost = COSTS_OF_ALLOCNO (total_costs, a_num)->cost[k]; + allocno_cost + = COSTS_OF_ALLOCNO (allocno_costs, a_num)->cost[k]; best = (enum reg_class) rclass; } else if (COSTS_OF_ALLOCNO (total_costs, a_num)->cost[k] == best_cost) - best = ira_reg_class_union[best][rclass]; + { + best = ira_reg_class_union[best][rclass]; + allocno_cost + = MAX (allocno_cost, + COSTS_OF_ALLOCNO (allocno_costs, + a_num)->cost[k]); + } } + ALLOCNO_COVER_CLASS_COST (a) = allocno_cost; } if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL && (pass == 0 || allocno_pref[a_num] != best)) @@ -1421,6 +1431,7 @@ setup_allocno_cover_class_and_costs (void) int *reg_costs; enum reg_class cover_class, rclass; enum machine_mode mode; + HARD_REG_SET *pref; ira_allocno_t a; ira_allocno_iterator ai; @@ -1435,10 +1446,7 @@ setup_allocno_cover_class_and_costs (void) if (cover_class == NO_REGS) continue; ALLOCNO_AVAILABLE_REGS_NUM (a) = ira_available_class_regs[cover_class]; - num = cost_class_nums[allocno_pref[i]]; - ira_assert (num >= 0); - ALLOCNO_COVER_CLASS_COST (a) - = COSTS_OF_ALLOCNO (allocno_costs, i)->cost[num]; + pref = ®_class_contents[allocno_pref[i]]; if (optimize && ALLOCNO_COVER_CLASS (a) != allocno_pref[i]) { n = ira_class_hard_regs_num[cover_class]; @@ -1447,17 +1455,23 @@ setup_allocno_cover_class_and_costs (void) for (j = n - 1; j >= 0; j--) { regno = ira_class_hard_regs[cover_class][j]; - rclass = REGNO_REG_CLASS (regno); - num = cost_class_nums[rclass]; - if (num < 0) + if (TEST_HARD_REG_BIT (*pref, regno)) + reg_costs[j] = ALLOCNO_COVER_CLASS_COST (a); + else { - /* The hard register class is not a cover class or a - class not fully inside in a cover class -- use - the allocno cover class. */ - ira_assert (ira_hard_regno_cover_class[regno] == cover_class); - num = cost_class_nums[cover_class]; + rclass = REGNO_REG_CLASS (regno); + num = cost_class_nums[rclass]; + if (num < 0) + { + /* The hard register class is not a cover class or a + class not fully inside in a cover class -- use + the allocno cover class. */ + ira_assert (ira_hard_regno_cover_class[regno] + == cover_class); + num = cost_class_nums[cover_class]; + } + reg_costs[j] = COSTS_OF_ALLOCNO (allocno_costs, i)->cost[num]; } - reg_costs[j] = COSTS_OF_ALLOCNO (allocno_costs, i)->cost[num]; } } } diff --git a/gcc/ira-int.h b/gcc/ira-int.h index 659c1eeb2ab..5c6b355ecc8 100644 --- a/gcc/ira-int.h +++ b/gcc/ira-int.h @@ -98,6 +98,10 @@ struct ira_loop_tree_node /* All the following members are defined only for nodes representing loops. */ + /* True if the loop was marked for removal from the register + allocation. */ + bool to_remove_p; + /* Allocnos in the loop corresponding to their regnos. If it is NULL the loop does not form a separate register allocation region (e.g. because it has abnormal enter/exit edges and we can not put diff --git a/gcc/ira.c b/gcc/ira.c index d7f4e3d0dab..4b6854272f1 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -1725,7 +1725,6 @@ ira (FILE *f) bool loops_p; int max_regno_before_ira, ira_max_point_before_emit; int rebuild_p; - int saved_flag_ira_algorithm; int saved_flag_ira_share_spill_slots; basic_block bb; @@ -1801,9 +1800,6 @@ ira (FILE *f) ira_assert (current_loops == NULL); flow_loops_find (&ira_loops); current_loops = &ira_loops; - saved_flag_ira_algorithm = flag_ira_algorithm; - if (optimize && number_of_loops () > (unsigned) IRA_MAX_LOOPS_NUM) - flag_ira_algorithm = IRA_ALGORITHM_CB; if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL) fprintf (ira_dump_file, "Building IRA IR\n"); @@ -1935,8 +1931,6 @@ ira (FILE *f) bb->loop_father = NULL; current_loops = NULL; - flag_ira_algorithm = saved_flag_ira_algorithm; - regstat_free_ri (); regstat_free_n_sets_and_refs (); diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 2523963f36d..3723dbd463a 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -1337,13 +1337,26 @@ simple_rhs_p (rtx rhs) case MINUS: op0 = XEXP (rhs, 0); op1 = XEXP (rhs, 1); - /* Allow reg + const sets only. */ - if (REG_P (op0) && !HARD_REGISTER_P (op0) && CONSTANT_P (op1)) - return true; - if (REG_P (op1) && !HARD_REGISTER_P (op1) && CONSTANT_P (op0)) - return true; + /* Allow reg + const and reg + reg. */ + if (!(REG_P (op0) && !HARD_REGISTER_P (op0)) + && !CONSTANT_P (op0)) + return false; + if (!(REG_P (op1) && !HARD_REGISTER_P (op1)) + && !CONSTANT_P (op1)) + return false; - return false; + return true; + + case ASHIFT: + op0 = XEXP (rhs, 0); + op1 = XEXP (rhs, 1); + /* Allow reg << const. */ + if (!(REG_P (op0) && !HARD_REGISTER_P (op0))) + return false; + if (!CONSTANT_P (op1)) + return false; + + return true; default: return false; diff --git a/gcc/output.h b/gcc/output.h index 51adcd22648..79b628fd338 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -1,7 +1,7 @@ /* Declarations for insn-output.c. These functions are defined in recog.c, final.c, and varasm.c. Copyright (C) 1987, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -97,6 +97,9 @@ extern int label_to_alignment (rtx); /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */ extern void output_asm_label (rtx); +/* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */ +extern void mark_symbol_refs_as_used (rtx); + /* Print a memory reference operand for address X using machine-dependent assembler syntax. */ extern void output_address (rtx); diff --git a/gcc/params.def b/gcc/params.def index 7414d60a09b..066f20523dc 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -770,7 +770,7 @@ DEFPARAM (PARAM_DF_DOUBLE_QUEUE_THRESHOLD_FACTOR, DEFPARAM (PARAM_IRA_MAX_LOOPS_NUM, "ira-max-loops-num", "max loops number for regional RA", - 50, 0, 0) + 100, 0, 0) /* Switch initialization conversion will refuse to create arrays that are bigger than this parameter times the number of switch branches. */ diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 34ef83fdaac..149a1cfe4a5 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2008-11-23 Joseph S. Myers <joseph@codesourcery.com> + + * ru.po: Update. + 2008-11-18 Joseph S. Myers <joseph@codesourcery.com> * gcc.pot: Regenerate. diff --git a/gcc/po/ru.po b/gcc/po/ru.po index b4eeefd0a92..11871a1bc7f 100644 --- a/gcc/po/ru.po +++ b/gcc/po/ru.po @@ -2,15 +2,15 @@ # Copyright (C) 2006 Free Software Foundation, Inc. # This file is distributed under the same license as the gcc package. # Nadezhda Vyukova <niva@niisi.msk.ru>, 2006. -# Pavel Maryanov <acid_jack@ukr.net>, 2006, 2008. # Nickolay V. Shmyrev <nshmyrev@yandex.ru>, 2008. +# Pavel Maryanov <acid_jack@ukr.net>, 2006, 2008. # msgid "" msgstr "" "Project-Id-Version: gcc 4.3.0\n" "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" "POT-Creation-Date: 2008-03-05 17:23+0100\n" -"PO-Revision-Date: 2008-11-10 15:23+0200\n" +"PO-Revision-Date: 2008-11-19 17:55+0200\n" "Last-Translator: Pavel Maryanov <acid_jack@ukr.net>\n" "Language-Team: Russian <gnu@mx.ru>\n" "MIME-Version: 1.0\n" @@ -219,7 +219,7 @@ msgstr "флаг '^' в формате strfmon" #: c-format.c:487 msgid "the '+' strfmon flag" -msgstr "флаг '+' в формате STRFMON" +msgstr "флаг '+' в формате strfmon" #: c-format.c:488 msgid "'(' flag" @@ -429,7 +429,7 @@ msgstr "Ð¿Ð¾Ð²Ñ‚Ð¾Ñ€Ð½Ð°Ñ Ð¸Ð½Ð¸Ñ†Ð¸Ð°Ð»Ð¸Ð·Ð°Ñ†Ð¸Ñ Ð¿Ð¾Ð»Ñ Ñ Ð¿Ð¾Ð±Ð¾Ñ‡Ð½Ñ‹ #: c-typeck.c:5851 c-typeck.c:5874 c-typeck.c:6348 msgid "initialized field overwritten" -msgstr "инициализированное поле перепиÑано" +msgstr "инициализированное поле перезапиÑано" #: c-typeck.c:6556 msgid "excess elements in char array initializer" @@ -543,7 +543,7 @@ msgstr "не удалоÑÑŒ получить ÑоÑтоÑние программ #: collect2.c:1587 #, c-format msgid "could not open response file %s" -msgstr "не удалоÑÑŒ найти отзыва %s" +msgstr "не удалоÑÑŒ найти файл отзыва %s" #: collect2.c:1592 #, c-format @@ -607,7 +607,7 @@ msgstr "в объекте %s найдена Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ fini" #: collect2.c:2302 #, c-format msgid "can't open ldd output" -msgstr "не удалоÑÑŒ открыть входной файл ldd" +msgstr "не удалоÑÑŒ открыть выходной файл ldd" #: collect2.c:2305 #, c-format @@ -661,7 +661,7 @@ msgstr "%s:%d: невозможно воÑÑтановление поÑле пр #: diagnostic.c:235 #, c-format msgid "compilation terminated due to -Wfatal-errors.\n" -msgstr "компилÑÑ†Ð¸Ñ Ð¿Ñ€ÐµÑ€Ð²Ð°Ð½Ð° из за ошибок -Wfatal.\n" +msgstr "компилÑÑ†Ð¸Ñ Ð¿Ñ€ÐµÑ€Ð²Ð°Ð½Ð° из за ошибок -Wfatal-errors.\n" #: diagnostic.c:244 #, c-format @@ -736,7 +736,7 @@ msgstr "операнд '%%l' не ÑвлÑетÑÑ Ð¼ÐµÑ‚ÐºÐ¾Ð¹" #: config/pdp11/pdp11.c:1704 #, c-format msgid "floating constant misused" -msgstr "некорректное употребление плавающей конÑтанты" +msgstr "некорректное иÑпользование плавающей конÑтанты" #: final.c:3507 vmsdbgout.c:544 config/i386/i386.c:8279 #: config/pdp11/pdp11.c:1751 @@ -844,7 +844,7 @@ msgstr "" #: gcc.c:3013 msgid "failed to get exit status" -msgstr "не удалоÑÑŒ получить ÑоÑтоÑние завершениÑ" +msgstr "не удалоÑÑŒ получить код возврата" #: gcc.c:3019 msgid "failed to get process times" @@ -1023,11 +1023,11 @@ msgstr " -V <верÑиÑ> ИÑпользовать <верÑию> #: gcc.c:3246 msgid " -v Display the programs invoked by the compiler\n" -msgstr " -v Отображать запуÑкаемые командные Ñтроки компилÑции\n" +msgstr " -v Отображать команды, запуÑкаемые компилÑтором\n" #: gcc.c:3247 msgid " -### Like -v but options quoted and commands not executed\n" -msgstr " -### Как -v, но команды не запуÑкаютÑÑ\n" +msgstr " -### Как -v, но параметры берутÑÑ Ð² кавычки и команды не запуÑкаютÑÑ\n" #: gcc.c:3248 msgid " -E Preprocess only; do not compile, assemble or link\n" @@ -1199,7 +1199,7 @@ msgstr "Обработка Ñпецификации %c%s%c, Ñ‚.е. '%s'\n" #: gcc.c:5459 #, c-format msgid "unknown spec function '%s'" -msgstr "Ð½ÐµÐ¾Ð¿Ð¾Ð·Ð½Ð°Ð½Ð½Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ '%s' в Ñпецификации" +msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ '%s' в Ñпецификации" #: gcc.c:5478 #, c-format @@ -1276,7 +1276,7 @@ msgstr "Параметры конфигурации: %s\n" #: gcc.c:6519 #, c-format msgid "Thread model: %s\n" -msgstr "Модель многопотоковоÑти: %s\n" +msgstr "Модель многопоточноÑти: %s\n" #: gcc.c:6530 #, c-format @@ -1301,7 +1301,7 @@ msgstr "Ð½ÐµÐ»ÑŒÐ·Ñ Ð¸Ñпользовать -o Ñ -c или -S и неÑкол #: gcc.c:6623 #, c-format msgid "spec '%s' is invalid" -msgstr "параметр '%s' инициализирован" +msgstr "недопуÑтимый параметр '%s'" #: gcc.c:6759 #, c-format @@ -1368,7 +1368,7 @@ msgstr "Ñлишком много аргументов в %%:version-compare" #: gcc.c:7931 #, c-format msgid "unknown operator '%s' in %%:version-compare" -msgstr "некорректный оператор '%s' в %%:version-compare" +msgstr "ÐеизвеÑтный оператор '%s' в %%:version-compare" #: gcc.c:7965 #, c-format @@ -1411,17 +1411,17 @@ msgstr "" #: gcov.c:402 #, c-format msgid " -h, --help Print this help, then exit\n" -msgstr " -h, --help Ðапечатать Ñтот текÑÑ‚ и выйти\n" +msgstr " -h, --help Показать Ñту Ñправку и выйти\n" #: gcov.c:403 #, c-format msgid " -v, --version Print version number, then exit\n" -msgstr " -v, --version Ðапечатать номер верÑии и выйти\n" +msgstr " -v, --version Показать номер верÑии и выйти\n" #: gcov.c:404 #, c-format msgid " -a, --all-blocks Show information for every basic block\n" -msgstr " -a, --all-blocks Выдать информацию Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ блока\n" +msgstr " -a, --all-blocks Показать ÑÐ²ÐµÐ´ÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð²Ñех блоков\n" #: gcov.c:405 #, c-format @@ -1435,7 +1435,7 @@ msgid "" " rather than percentages\n" msgstr "" " -c, --branch-counts При Ñчётчиках переходов, заданных\n" -" в абÑолютных, а не процентных значениÑÑ…\n" +" в абÑолютных, а не в процентных значениÑÑ…\n" #: gcov.c:408 #, c-format @@ -1466,7 +1466,7 @@ msgstr "" #: gcov.c:413 #, c-format msgid " -p, --preserve-paths Preserve all pathname components\n" -msgstr " -p, --preserve-paths Сохранить маршрутные имена\n" +msgstr " -p, --preserve-paths Сохранить вÑе компоненты полного имени\n" #: gcov.c:414 #, c-format @@ -1699,11 +1699,11 @@ msgstr "%s:ошибка Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð¸Ñходного файла\n" #: gcse.c:679 msgid "GCSE disabled" -msgstr "Ð³Ð»Ð¾Ð±Ð°Ð»ÑŒÐ½Ð°Ñ ÑÐºÐ¾Ð½Ð¾Ð¼Ð¸Ñ Ð¾Ð±Ñ‰Ð¸Ñ… подвыражений (GCSE) не выполнÑлаÑÑŒ" +msgstr "Ð³Ð»Ð¾Ð±Ð°Ð»ÑŒÐ½Ð°Ñ ÑÐºÐ¾Ð½Ð¾Ð¼Ð¸Ñ Ð¾Ð±Ñ‰Ð¸Ñ… подвыражений (GCSE) отключена" #: gcse.c:6584 msgid "jump bypassing disabled" -msgstr "Ð¾Ð¿Ñ‚Ð¸Ð¼Ð¸Ð·Ð°Ñ†Ð¸Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð° переходов не выполнÑлаÑÑŒ" +msgstr "Ð¾Ð¿Ñ‚Ð¸Ð¼Ð¸Ð·Ð°Ñ†Ð¸Ñ Ð¾Ð±Ñ…Ð¾Ð´Ð° переходов отключена" #. Opening quotation mark. #: intl.c:57 @@ -1734,7 +1734,7 @@ msgstr "доÑтигнут предел, уÑтановленный параме #: ipa-inline.c:435 msgid "--param max-inline-insns-auto limit reached" -msgstr "доÑтигнут предел, уÑтановленный параметром max-inline-insns-single" +msgstr "доÑтигнут предел, уÑтановленный параметром max-inline-insns-auto" #: ipa-inline.c:461 ipa-inline.c:914 ipa-inline.c:1105 ipa-inline.c:1225 msgid "recursive inlining" @@ -1906,7 +1906,7 @@ msgstr "%s: некорректное Ð¸Ð¼Ñ Ñ„Ð°Ð¹Ð»Ð°: %s\n" #: protoize.c:1281 #, c-format msgid "%s: %s: can't get status: %s\n" -msgstr "%s: %s: ошибка Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ stat: %s\n" +msgstr "%s: %s: не удалоÑÑŒ получить ÑтатуÑ: %s\n" #: protoize.c:1302 #, c-format @@ -2045,7 +2045,7 @@ msgstr "%s: Ð´ÐµÐºÐ»Ð°Ñ€Ð°Ñ†Ð¸Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ð¸ '%s' не преобразова #: protoize.c:3037 #, c-format msgid "%s: warning: too many parameter lists in declaration of '%s'\n" -msgstr "%s: предупреждение: много ÑпиÑков параметров в декларации '%s'\n" +msgstr "%s: предупреждение: Ñлишком много ÑпиÑков параметров в декларации '%s' \n" #: protoize.c:3058 #, c-format @@ -2054,7 +2054,7 @@ msgid "" "%s: warning: too few parameter lists in declaration of '%s'\n" msgstr "" "\n" -"%s: предупреждение: мало ÑпиÑков параметров в декларации '%s'\n" +"%s: предупреждение: Ñлишком мало ÑпиÑков параметров в декларации '%s'\n" #: protoize.c:3154 #, c-format @@ -2144,7 +2144,7 @@ msgstr "" #: protoize.c:4052 #, c-format msgid "%s: can't create/open clean file '%s': %s\n" -msgstr "%s: ошибка ÑозданиÑ/Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ clean-файла '%s': %s\n" +msgstr "%s: ошибка ÑозданиÑ/Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð¿ÑƒÑтого файла '%s': %s\n" #: protoize.c:4157 #, c-format @@ -2154,7 +2154,7 @@ msgstr "%s: предупреждение: файл '%s' уже Ñохранён #: protoize.c:4165 #, c-format msgid "%s: can't link file '%s' to '%s': %s\n" -msgstr "%s: ошибка Ð¿ÐµÑ€ÐµÐ¸Ð¼ÐµÐ½Ð¾Ð²Ð°Ð½Ð¸Ñ Ñ„Ð°Ð¹Ð»Ð° '%s' в '%s': %s\n" +msgstr "%s: ошибка ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑÑылки файла '%s' на '%s': %s\n" #: protoize.c:4195 #, c-format @@ -2192,7 +2192,7 @@ msgstr "не найден региÑÑ‚Ñ€ Ð´Ð»Ñ Ð²Ñ‹Ñ‚Ð°Ð»ÐºÐ¸Ð²Ð°Ð½Ð¸Ñ" #. It's the compiler's fault. #: reload1.c:7038 msgid "VOIDmode on an output" -msgstr "выходной операнд имеет моду VOIDmode" +msgstr "режим VOID выходного потока" #: reload1.c:8043 msgid "Failure trying to reload:" @@ -2247,12 +2247,12 @@ msgstr "collect: перекомпилÑÑ†Ð¸Ñ %s\n" #: tlink.c:737 #, c-format msgid "collect: tweaking %s in %s\n" -msgstr "collect: tweaking %s in %s\n" +msgstr "" #: tlink.c:787 #, c-format msgid "collect: relinking\n" -msgstr "collect: relinking\n" +msgstr "" #: toplev.c:606 #, c-format @@ -2279,9 +2279,9 @@ msgid "GMP version %s, MPFR version %s.\n" msgstr "ВерÑÐ¸Ñ GMP %s, верÑÐ¸Ñ MPFR %s.\n" #: toplev.c:1188 -#, fuzzy, c-format +#, c-format msgid "%s%swarning: %s header version %s differs from library version %s.\n" -msgstr "предупреждение: верÑÐ¸Ñ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° %s %s отличаетÑÑ Ð¾Ñ‚ верÑии библиотеки %s.\n" +msgstr "%s%sпредупреждение: верÑÐ¸Ñ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° %s %s отличаетÑÑ Ð¾Ñ‚ верÑии библиотеки %s.\n" #: toplev.c:1190 #, c-format @@ -2430,7 +2430,7 @@ msgstr "Размер тела \"большой\" функции" #: params.def:201 msgid "Maximal growth due to inlining of large function (in percent)" -msgstr "МакÑимальный роÑÑ‚ объема большой функции в результате inline-подÑтановок (в процентах)" +msgstr "МакÑимальный роÑÑ‚ объема \"большой\" функции в результате inline-подÑтановок (в процентах)" #: params.def:205 msgid "The size of translation unit to be considered large" @@ -2610,7 +2610,7 @@ msgstr "ЕÑли чиÑло иÑпользований индуктивных п #: params.def:460 msgid "If number of candidates in the set is smaller, we always try to remove unused ivs during its optimization" -msgstr "ЕÑли чиÑло кандидатов в множеÑтве меньше Ñтого значениÑ, то при оптимизации множеÑтва вÑегда делаетÑÑ Ð¿Ð¾Ð¿Ñ‹Ñ‚ÐºÐ° удалить неиÑпользуемые инд. переменные" +msgstr "ЕÑли чиÑло кандидатов в множеÑтве меньше Ñтого значениÑ, то при оптимизации множеÑтва вÑегда делаетÑÑ Ð¿Ð¾Ð¿Ñ‹Ñ‚ÐºÐ° удалить неиÑпользуемые незавиÑимые переменные" #: params.def:465 msgid "Bound on size of expressions used in the scalar evolutions analyzer" @@ -2690,11 +2690,11 @@ msgstr "МакÑимальное чиÑло блоков в отрезке Ð´Ð»Ñ #: params.def:565 msgid "The maximum number of insns in a region to be considered for interblock scheduling" -msgstr "МакÑимальное чиÑло инÑтрукций в отрезке Ð´Ð»Ñ Ð¼ÐµÐ¶Ð´ÑƒÐ±Ð»Ð¾Ñ‡Ð½Ð¾Ð³Ð¾ планированиÑ" +msgstr "МакÑимальное чиÑло инÑтрукций в отрезке Ð´Ð»Ñ Ð¼ÐµÐ¶Ð±Ð»Ð¾Ñ‡Ð½Ð¾Ð³Ð¾ планированиÑ" #: params.def:570 msgid "The minimum probability of reaching a source block for interblock speculative scheduling" -msgstr "ÐœÐ¸Ð½Ð¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ Ð²ÐµÑ€Ð¾ÑтноÑÑ‚ÑŒ доÑÑ‚Ð¸Ð¶ÐµÐ½Ð¸Ñ Ð±Ð»Ð¾ÐºÐ° Ð´Ð»Ñ ÑпекулÑтивного междублочного планированиÑ" +msgstr "ÐœÐ¸Ð½Ð¸Ð¼Ð°Ð»ÑŒÐ½Ð°Ñ Ð²ÐµÑ€Ð¾ÑтноÑÑ‚ÑŒ доÑÑ‚Ð¸Ð¶ÐµÐ½Ð¸Ñ Ð±Ð»Ð¾ÐºÐ° Ð´Ð»Ñ ÑпекулÑтивного межблочного планированиÑ" #: params.def:575 #, fuzzy @@ -2917,7 +2917,7 @@ msgstr "некорректный оператор Ñдвига" #: config/bfin/bfin.c:1573 config/bfin/bfin.c:1580 #, c-format msgid "invalid operand for code '%c'" -msgstr "некорректный код операнда '%c'" +msgstr "недопуÑтимый операнд Ð´Ð»Ñ ÐºÐ¾Ð´Ð° '%c'" #: config/arm/arm.c:12825 #, c-format @@ -2932,11 +2932,11 @@ msgstr "отÑутÑтвует операнд" #: config/avr/avr.c:1062 #, c-format msgid "address operand requires constraint for X, Y, or Z register" -msgstr "Ð”Ð»Ñ Ð¾Ð¿ÐµÑ€Ð°Ð½Ð´Ð° адреÑа должны задаватьÑÑ Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð¸Ñ Ð¾Ð´Ð¸Ð½ из региÑтров X, Y или Z" +msgstr "Ð´Ð»Ñ Ð¾Ð¿ÐµÑ€Ð°Ð½Ð´Ð° адреÑа требуютÑÑ Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ из региÑтров X, Y или Z" #: config/avr/avr.c:1169 msgid "bad address, not (reg+disp):" -msgstr "некорректный адреÑ, не (рег+Ñмещение)" +msgstr "некорректный адреÑ, не (reg+disp)" #: config/avr/avr.c:1176 msgid "bad address, not post_inc or pre_dec:" @@ -2944,15 +2944,15 @@ msgstr "некорректный адреÑ, не post_inc или pre_dec:" #: config/avr/avr.c:1187 msgid "internal compiler error. Bad address:" -msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: Ðекорректный адреÑ:" +msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: некорректный адреÑ:" #: config/avr/avr.c:1200 msgid "internal compiler error. Unknown mode:" -msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: ÐеизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð¾Ð´Ð°:" +msgstr "внутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: неизвеÑтный режим:" #: config/avr/avr.c:1815 config/avr/avr.c:2503 msgid "invalid insn:" -msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¸Ð½ÑтрукциÑ:" +msgstr "недопуÑÑ‚Ð¸Ð¼Ð°Ñ Ð¸Ð½ÑтрукциÑ:" #: config/avr/avr.c:1854 config/avr/avr.c:1940 config/avr/avr.c:1989 #: config/avr/avr.c:2017 config/avr/avr.c:2112 config/avr/avr.c:2281 @@ -2963,7 +2963,7 @@ msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¸Ð½ÑтрукциÑ:" #: config/avr/avr.c:2036 config/avr/avr.c:2197 config/avr/avr.c:2352 #: config/avr/avr.c:2720 msgid "unknown move insn:" -msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¸Ð½ÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ move:" +msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¸Ð½ÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ Ð¿ÐµÑ€ÐµÐ¼ÐµÑ‰ÐµÐ½Ð¸Ñ:" #: config/avr/avr.c:2950 msgid "bad shift insn:" @@ -2971,7 +2971,7 @@ msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¸Ð½ÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ Ñдвига:" #: config/avr/avr.c:3066 config/avr/avr.c:3486 config/avr/avr.c:3844 msgid "internal compiler error. Incorrect shift:" -msgstr "ВнутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: Ðекорректный Ñдвиг:" +msgstr "ВнутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ° компилÑтора: некорректный Ñдвиг:" #: config/bfin/bfin.c:1478 #, c-format @@ -3246,7 +3246,7 @@ msgstr "некорректные Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð¾Ð¿ÐµÑ€Ð°Ð½Ð´Ð°" #: config/i386/i386.c:16423 msgid "unknown insn mode" -msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° инÑтрукции" +msgstr "некорректный режим инÑтрукции" #. If the environment variable DJDIR is not defined, then DJGPP is not installed correctly and GCC will quickly become confused with the default prefix settings. Report the problem now so the user doesn't receive deceptive "file not found" error messages later. #. DJDIR is automatically defined by the DJGPP environment config file pointed to by the environment variable DJGPP. Examine DJGPP to try and figure out what's wrong. @@ -3389,11 +3389,11 @@ msgstr "'%%%c' не ÑвлÑетÑÑ ÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ñ‹Ð¼ префикÑом оР#: config/mips/mips.c:6514 #, c-format msgid "invalid use of '%%%c'" -msgstr "некорректное иÑпользование '%%%c'" +msgstr "недопуÑтимое иÑпользование '%%%c'" #: config/mips/mips.c:6761 msgid "mips_debugger_offset called with non stack/frame/arg pointer" -msgstr "mips_debugger_offset вызвана не Ñ ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»ÐµÐ¼ кадра" +msgstr "mips_debugger_offset вызвана не Ñ ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»ÐµÐ¼ Ñтека/кадра/аргумента" #: config/mmix/mmix.c:1483 config/mmix/mmix.c:1613 msgid "MMIX Internal: Expected a CONST_INT, not this" @@ -3461,67 +3461,67 @@ msgstr "Попробуйте выполнить '%s' в командной ÑÑ‚Ñ #: config/rs6000/rs6000.c:11645 #, c-format msgid "invalid %%f value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%f" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%f" #: config/rs6000/rs6000.c:11654 #, c-format msgid "invalid %%F value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%F" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%F" #: config/rs6000/rs6000.c:11663 #, c-format msgid "invalid %%G value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%G" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%G" #: config/rs6000/rs6000.c:11698 #, c-format msgid "invalid %%j code" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%j" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%j" #: config/rs6000/rs6000.c:11708 #, c-format msgid "invalid %%J code" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%J" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%J" #: config/rs6000/rs6000.c:11718 #, c-format msgid "invalid %%k value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%k" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%k" #: config/rs6000/rs6000.c:11738 config/xtensa/xtensa.c:2028 #, c-format msgid "invalid %%K value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%K" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%K" #: config/rs6000/rs6000.c:11808 #, c-format msgid "invalid %%O value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%O" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%O" #: config/rs6000/rs6000.c:11855 #, c-format msgid "invalid %%q value" -msgstr "неверное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%q" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%q" #: config/rs6000/rs6000.c:11899 #, c-format msgid "invalid %%S value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%S" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%S" #: config/rs6000/rs6000.c:11939 #, c-format msgid "invalid %%T value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%T" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%T" #: config/rs6000/rs6000.c:11949 #, c-format msgid "invalid %%u value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%u" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%u" #: config/rs6000/rs6000.c:11958 config/xtensa/xtensa.c:1998 #, c-format msgid "invalid %%v value" -msgstr "некорректное значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%v" +msgstr "недопуÑтимое значение Ð´Ð»Ñ ÐºÐ¾Ð´Ð° %%v" #: config/rs6000/rs6000.c:21946 msgid "AltiVec argument passed to unprototyped function" @@ -9242,9 +9242,9 @@ msgid "Operands of comparison operator '%s' at %%L are %s/%s" msgstr "" #: fortran/resolve.c:3051 -#, fuzzy, c-format +#, c-format msgid "Unknown operator '%s' at %%L" -msgstr "некорректный оператор '%s' в %%:version-compare" +msgstr "ÐеизвеÑтный оператор '%s' в %%L" #: fortran/resolve.c:3053 #, c-format @@ -17267,7 +17267,7 @@ msgstr "" #: c-common.c:5220 #, gcc-internal-format msgid "unknown machine mode %qs" -msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° %qs" +msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð½Ñ‹Ð¹ режим %qs" #: c-common.c:5249 #, gcc-internal-format @@ -17287,7 +17287,7 @@ msgstr "ÑмулÑÑ†Ð¸Ñ %qs невозможна" #: c-common.c:5271 #, gcc-internal-format msgid "invalid pointer mode %qs" -msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° %qs Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ" +msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð½Ñ‹Ð¹ режим %qs Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ" #: c-common.c:5288 #, gcc-internal-format @@ -17297,17 +17297,17 @@ msgstr "" #: c-common.c:5299 #, gcc-internal-format msgid "no data type for mode %qs" -msgstr "тип данных, ÑоответÑтвующий моде %qs, не ÑущеÑтвует" +msgstr "тип данных, ÑоответÑтвующий режиму %qs, не ÑущеÑтвует" #: c-common.c:5309 #, gcc-internal-format msgid "cannot use mode %qs for enumeral types" -msgstr "иÑпользование моды %qs Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÑ‡Ð¸Ñлимых типов недопуÑтимо" +msgstr "иÑпользование режима %qs Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÑ‡Ð¸Ñлимых типов недопуÑтимо" #: c-common.c:5336 #, gcc-internal-format msgid "mode %qs applied to inappropriate type" -msgstr "мода %qs применена к неподходÑщему типу" +msgstr "режим %qs применен к неподходÑщему типу" #: c-common.c:5367 #, gcc-internal-format @@ -18622,7 +18622,7 @@ msgstr "перечиÑлимый тип превышает диапазон ма #: c-decl.c:5899 #, gcc-internal-format msgid "specified mode too small for enumeral values" -msgstr "Ð·Ð°Ð´Ð°Ð½Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° Ñлишком мала Ð´Ð»Ñ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ð¹ перечиÑлимого типа" +msgstr "заданный режим Ñлишком мал Ð´Ð»Ñ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ð¹ перечиÑлимого типа" #: c-decl.c:5995 #, gcc-internal-format @@ -19605,9 +19605,9 @@ msgid "floating constant exceeds range of %qT" msgstr "Ð¿Ð»Ð°Ð²Ð°ÑŽÑ‰Ð°Ñ ÐºÐ¾Ð½Ñтанта превышает диапазон Ð´Ð»Ñ %<%s%>" #: c-lex.c:732 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "floating constant truncated to zero" -msgstr "некорректное употребление плавающей конÑтанты" +msgstr "деление на ноль плавающей конÑтанты" #: c-lex.c:941 #, gcc-internal-format @@ -24854,9 +24854,9 @@ msgid "-mshared-library-id=%s is not between 0 and %d" msgstr "-mshared-library-id=%s не между 0 и %d" #: config/bfin/bfin.c:2372 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "-mcpu=%s is not valid" -msgstr "параметр '%s' инициализирован" +msgstr "недопуÑтимый параметр -mcpu=%s" #: config/bfin/bfin.c:2410 #, gcc-internal-format @@ -25935,9 +25935,9 @@ msgid "passing arg %d of %qE discards qualifiers frompointer target type" msgstr "приведение от %qT к %qT отменÑет квалификаторы указуемого типа" #: config/rs6000/rs6000-c.c:2596 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "invalid parameter combination for AltiVec intrinsic" -msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ ÐºÐ¾Ð¼Ð±Ð¸Ð½Ð°Ñ†Ð¸Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð¾Ð² Ð´Ð»Ñ %qs AltiVec intrinsic" +msgstr "недопуÑÑ‚Ð¸Ð¼Ð°Ñ ÐºÐ¾Ð¼Ð±Ð¸Ð½Ð°Ñ†Ð¸Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð¾Ð² Ð´Ð»Ñ AltiVec intrinsic" #: config/rs6000/rs6000.c:1312 #, gcc-internal-format @@ -26504,9 +26504,9 @@ msgid "parameter list does not match a valid signature for %s()" msgstr "" #: config/spu/spu.c:341 config/spu/spu.c:352 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "Unknown architecture '%s'" -msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° %qs" +msgstr "неизвеÑÑ‚Ð½Ð°Ñ Ð°Ñ€Ñ…Ð¸Ñ‚ÐµÐºÑ‚ÑƒÑ€Ð° '%s'" #: config/spu/spu.c:3023 #, fuzzy, gcc-internal-format @@ -32776,9 +32776,9 @@ msgid "Function return value not set" msgstr "Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‰Ð°ÐµÑ‚ агрегатное значение" #: fortran/trans-expr.c:1177 -#, fuzzy, gcc-internal-format +#, gcc-internal-format msgid "Unknown intrinsic op" -msgstr "Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð°Ñ Ð¼Ð¾Ð´Ð° инÑтрукции" +msgstr "ÐеизвеÑтный операнд intrinsic" #: fortran/trans-intrinsic.c:714 #, fuzzy, gcc-internal-format diff --git a/gcc/regrename.c b/gcc/regrename.c index b01c2e6b15b..83fd605fcb4 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -137,8 +137,15 @@ merge_overlapping_regs (basic_block b, HARD_REG_SET *pset, struct du_chain *t = chain; rtx insn; HARD_REG_SET live; + df_ref *def_rec; REG_SET_TO_HARD_REG_SET (live, df_get_live_in (b)); + for (def_rec = df_get_artificial_defs (b->index); *def_rec; def_rec++) + { + df_ref def = *def_rec; + if (DF_REF_FLAGS (def) & DF_REF_AT_TOP) + SET_HARD_REG_BIT (live, DF_REF_REGNO (def)); + } insn = BB_HEAD (b); while (t) { diff --git a/gcc/reload1.c b/gcc/reload1.c index 76175e3ecf3..e9ac1486915 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1,6 +1,6 @@ /* Reload pseudo regs into hard regs for insns that require hard regs. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -3299,7 +3299,7 @@ eliminate_regs_in_insn (rtx insn, int replace) { rtx to_rtx = ep->to_rtx; offset += ep->offset; - offset = trunc_int_for_mode (offset, GET_MODE (reg)); + offset = trunc_int_for_mode (offset, GET_MODE (plus_cst_src)); if (GET_CODE (XEXP (plus_cst_src, 0)) == SUBREG) to_rtx = gen_lowpart (GET_MODE (XEXP (plus_cst_src, 0)), diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index dd91e120d23..16d0d48688d 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2304,12 +2304,19 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, case AND: if (trueop1 == CONST0_RTX (mode) && ! side_effects_p (op0)) return trueop1; - /* If we are turning off bits already known off in OP0, we need - not do an AND. */ if (GET_CODE (trueop1) == CONST_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (trueop0, mode) & ~INTVAL (trueop1)) == 0) - return op0; + && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) + { + HOST_WIDE_INT nzop0 = nonzero_bits (trueop0, mode); + HOST_WIDE_INT val1 = INTVAL (trueop1); + /* If we are turning off bits already known off in OP0, we need + not do an AND. */ + if ((nzop0 & ~val1) == 0) + return op0; + /* If we are clearing all the nonzero bits, the result is zero. */ + if ((val1 & nzop0) == 0 && !side_effects_p (op0)) + return CONST0_RTX (mode); + } if (rtx_equal_p (trueop0, trueop1) && ! side_effects_p (op0) && GET_MODE_CLASS (mode) != MODE_CC) return op0; @@ -2391,7 +2398,9 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, ((A & N) + B) & M -> (A + B) & M Similarly if (N & M) == 0, ((A | N) + B) & M -> (A + B) & M - and for - instead of + and/or ^ instead of |. */ + and for - instead of + and/or ^ instead of |. + Also, if (N & M) == 0, then + (A +- N) & M -> A & M. */ if (GET_CODE (trueop1) == CONST_INT && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT && ~INTVAL (trueop1) @@ -2404,6 +2413,10 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, pmop[0] = XEXP (op0, 0); pmop[1] = XEXP (op0, 1); + if (GET_CODE (pmop[1]) == CONST_INT + && (INTVAL (pmop[1]) & INTVAL (trueop1)) == 0) + return simplify_gen_binary (AND, mode, pmop[0], op1); + for (which = 0; which < 2; which++) { tem = pmop[which]; @@ -3591,10 +3604,6 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, ops[j + 1] = save; } - /* This is only useful the first time through. */ - if (!canonicalized) - return NULL_RTX; - changed = 0; for (i = n_ops - 1; i > 0; i--) for (j = i - 1; j >= 0; j--) @@ -3650,10 +3659,15 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, ops[i].neg = lneg; ops[j].op = NULL_RTX; changed = 1; + canonicalized = 1; } } } + /* If nothing changed, fail. */ + if (!canonicalized) + return NULL_RTX; + /* Pack all the operands to the lower-numbered entries. */ for (i = 0, j = 0; j < n_ops; j++) if (ops[j].op) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f0774f06b3..d02f289d9ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,231 @@ +2008-11-28 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/37955 + PR tree-optimization/37742 + * gcc.c-torture/compile/pr37955.c: New testcase. + * gcc.c-torture/compile/pr37742-3.c: Likewise. + +2008-11-28 Jakub Jelinek <jakub@redhat.com> + + PR testsuite/38261 + * gcc.dg/tree-ssa/alias-2.c: Only compile on nonpic targets. + * gcc.dg/torture/ipa-pta-1.c: Likewise. + +2008-11-26 Janis Johnson <janis187@us.ibm.com> + + * lib/objc.exp (objc_target_compile): Fix typo from previous change. + * lib/gnat.exp (gnat_target_compile): Fix typo from previous change. + + PR testsuite/28870 + * lib/timeout.exp: New. + * lib/timeout-dg.exp: New. + * lib/gcc-dg.exp: Include new timeout library files. + (dg-test): Unset timeout variables. + * lib/gcc.exp (gcc_target_compile): Set timeout value from new proc. + * lib/g++.exp (g++_target_compile): Ditto. + * lib/gfortran.exp (gfortran_target_compile): Ditto. + * lib/objc.exp (objc_target_compile): Ditto. + * lib/obj-c++.exp (obj-c++_target_compile): Ditto. + * lib/obj-c++.exp (obj-c++_target_compile): Ditto. + * lib/gnat.exp (gnat_target_compile): Ditto. + +2008-11-26 H.J. Lu <hongjiu.lu@intel.com> + + PR middle-end/37843 + * gcc.target/i386/pr37843-1.c: Make it Linux only. + * gcc.target/i386/pr37843-2.c: Likewise. + +2008-11-26 Kai Tietz <kai.tietz@onevision.com> + + * gcc.dg/callabi/func-indirect.c: New. + +2008-11-25 Jason Merrill <jason@redhat.com> + + PR c++/28743 + * g++.dg/template/nontype18.C: New test. + +2008-11-25 Maxim Kuvyrkov <maxim@codesourcery.com> + + * gcc.c-torture/compile/20080929-1.c: New. + +2008-11-25 Janis Johnson <janis187@us.ibm.com> + + * gfortran.dg/default_format_denormal_1.f90: Fix xfail for darwin. + +2008-11-25 H.J. Lu <hongjiu.lu@intel.com> + + PR middle-end/37843 + * gcc.target/i386/align-main-3.c: New. + * gcc.target/i386/pr37843-1.c: Likewise. + * gcc.target/i386/pr37843-2.c: Likewise. + * gcc.target/i386/pr37843-3.c: Likewise. + +2008-11-25 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/36463 + * gfortran.dg/proc_decl_20.f90: New test. + +2008-11-25 Richard Guenther <rguenther@suse.de> + + PR middle-end/38151 + PR middle-end/38236 + * gcc.c-torture/execute/pr38151.c: New testcase. + * gcc.c-torture/execute/pr38236.c: Likewise. + +2008-11-24 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * g++.dg/eh/weak1.C: Don't xfail hppa*64*-*-*. + +2008-11-24 DJ Delorie <dj@redhat.com> + + * gcc.c-torture/execute/pr36321.c: Don't rely on argv[0] being set. + +2008-11-24 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/38184 + * gfortran.dg/reshape_empty_1.f03: New test. + +2008-11-24 Jack Howarth <howarth@bromo.med.uc.edu> + + PR testsuite/38241 + * g++.old-deja/g++.pt/const2.C: Prune output for Darwin. + + PR testsuite/38076 + * g++.dg/other/anon5.C: Skip on Darwin. + + * gfortran.dg/default_format_denormal_1.f90: XFAIL on darwin8 + and darwin9 subversions. + +2008-11-24 Maxim Kuvyrkov <maxim@codesourcery.com> + + PR target/35018 + * gcc.target/m68k/pr35018.c: New. + +2008-11-24 Daniel Kraft <d@domob.eu> + + PR fortran/37779 + * gfortran.dg/c_funloc_tests.f03: Added missing `RECURSIVE'. + * gfortran.dg/c_funloc_tests_2.f03: Ditto. + * gfortran.dg/recursive_check_4.f03: New test. + * gfortran.dg/recursive_check_5.f03: New test. + +2008-11-24 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/35681 + * gfortran.dg/elemental_dependency_1.f90: Really commit it. + +2008-11-24 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/34820 + * gfortran.dg/alloc_comp_constructor_6.f90 : New test. + * gfortran.dg/alloc_comp_basics_1.f90 : Reduce expected refs to + 'builtin_free' from 24 to 18. + + PR fortran/34143 + * gfortran.dg/alloc_comp_constructor_5.f90 : New test. + + PR fortran/32795 + * gfortran.dg/alloc_comp_constructor_4.f90 : New test. + +2008-11-23 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/37735 + * gfortran.dg/alloc_comp_assign_7.f90: New test. + +2008-11-23 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * g++.dg/ext/tmplattr9.C: Require weak. + * g++.old-deja/g++.pt/static6.C: Remove xfail for *-*-hpux*. + +2008-11-23 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/38234 + * gfortran.dg/reshape_4.f90: New test. + +2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/38225 + * gfortran.dg/reshape_3.f90: New test. + +2008-11-22 Tobias Burnus <burnus@net-b.de> + + PR fortran/38160 + * gfortran.dg/bind_c_usage_18.f90: New test. + * gfortran.dg/c_kind_tests_2.f03: Update dg-messages. + * gfortran.dg/interop_params.f03: Ditto. + +2008-11-22 Uros Bizjak <ubizjak@gmail.com> + + PR target/38222 + * gcc.target/i386/funcspec-3.c: Scan for popcnt on Darwin targets. + +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/37839 + * gfortran.dg/f2003_inquire_1.f03: New test. + * gfortran.dg/f2003_io_1.f03: Remove xfail. + * gfortran.dg/f2003_io_4.f03: Likewise. + * gfortran.dg/f2003_io_5.f03: Likewise. + * gfortran.dg/f2003_io_6.f03: Likewise. + * gfortran.dg/f2003_io_7.f03: Likewise. + +2008-11-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/38200 + * gcc.dg/pr38200.c: New test. + +2008-11-21 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/avx-1.c: Include <immintrin.h> instead of + <gmmintrin.h>. + * gcc.target/i386/avx-2.c: Likewise. + * gcc.target/i386/m256-check.h: Likewise. + * g++.dg/other/i386-5.C: Likewise. + * g++.dg/other/i386-6.C: Likewise. + +2008-11-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/37472 + * gfortran.dg/namelist_print_1.f: Update test. + +2008-11-20 Andreas Krebbel <krebbel1@de.ibm.com> + + * gcc.dg/sync-2.c: Add type cast to avoid folding. + * gcc.dg/sync-3.c: Likewise. + 2008-11-20 Jakub Jelinek <jakub@redhat.com> + PR middle-end/29215 + * gfortran.dg/array_memcpy_3.f90: Adjust pattern to match even + memcpy optimized into ref-all store. + * gcc.dg/pr29215.c: New test. + +2008-11-20 Uros Bizjak <ubizjak@gmail.com> + + PR target/38151 + * gcc.target/i386/pr38151-1.c: New test. + +2008-11-20 Jason Merrill <jason@redhat.com> + + PR c++/28513 + * g++.dg/lookup/name-clash7.C: New test. + + PR c++/37540 + * g++.dg/cpp0x/decltype14.C: New test. + +2008-11-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/37868 + * gcc.dg/torture/pr37868.c: New testcase. + * gcc.c-torture/execute/pr38048-1.c: Likewise. + * gcc.c-torture/execute/pr38048-2.c: Likewise. + +2008-11-20 Jakub Jelinek <jakub@redhat.com> + + PR fortran/38181 + * gfortran.dg/array_section_2.f90: Adjust pattern to match + the inlined size0 instead of a size0 call. + PR c++/36631 * g++.dg/template/call5.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype14.C b/gcc/testsuite/g++.dg/cpp0x/decltype14.C new file mode 100644 index 00000000000..9484173cd98 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype14.C @@ -0,0 +1,17 @@ +// PR c++/37540 + +struct A +{ + int g() {return 0;} +}; + +template <typename T_> +void f(A a) +{ + __decltype(a.g()) i; +} + +int main() +{ + f<int>(A()); +} diff --git a/gcc/testsuite/g++.dg/eh/weak1.C b/gcc/testsuite/g++.dg/eh/weak1.C index 3034e809ea7..4dd08d1e6b9 100644 --- a/gcc/testsuite/g++.dg/eh/weak1.C +++ b/gcc/testsuite/g++.dg/eh/weak1.C @@ -1,5 +1,5 @@ // PR target/29487 -// { dg-do run { xfail "hppa*-hp-hpux11.*" } } +// { dg-do run { xfail { hppa*-*-hpux* && { ! hppa*64*-*-* } } } } // { dg-require-weak "" } // { dg-additional-sources "weak1-a.cc" } // { dg-options "-O2" } diff --git a/gcc/testsuite/g++.dg/ext/tmplattr9.C b/gcc/testsuite/g++.dg/ext/tmplattr9.C index 721ccefecf8..090257a5f91 100644 --- a/gcc/testsuite/g++.dg/ext/tmplattr9.C +++ b/gcc/testsuite/g++.dg/ext/tmplattr9.C @@ -1,4 +1,5 @@ // PR c++/34937, 34962 +// { dg-require-weak "" } // { dg-options "" } struct A diff --git a/gcc/testsuite/g++.dg/lookup/name-clash7.C b/gcc/testsuite/g++.dg/lookup/name-clash7.C new file mode 100644 index 00000000000..5c0690aa850 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/name-clash7.C @@ -0,0 +1,11 @@ +// PR c++/28513 + +class foo { // { dg-error "changes meaning" } +public: + typedef int bar; +}; + +class baz { +public: + foo::bar foo; // { dg-error "declaration" } +}; diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C index 7dcfe519bfd..12f0900f5f7 100644 --- a/gcc/testsuite/g++.dg/other/anon5.C +++ b/gcc/testsuite/g++.dg/other/anon5.C @@ -1,5 +1,5 @@ // PR c++/34094 -// { dg-do link { target { ! { *-*-hpux* *-*-solaris2.* } } } } +// { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* } } } } // { dg-options "-g" } namespace { diff --git a/gcc/testsuite/g++.dg/other/i386-5.C b/gcc/testsuite/g++.dg/other/i386-5.C index 2556e7e021b..d9b5460a8dc 100644 --- a/gcc/testsuite/g++.dg/other/i386-5.C +++ b/gcc/testsuite/g++.dg/other/i386-5.C @@ -5,5 +5,5 @@ #include <wmmintrin.h> #include <bmmintrin.h> -#include <gmmintrin.h> +#include <immintrin.h> #include <mm3dnow.h> diff --git a/gcc/testsuite/g++.dg/other/i386-6.C b/gcc/testsuite/g++.dg/other/i386-6.C index 905ac97b011..15f1d5258df 100644 --- a/gcc/testsuite/g++.dg/other/i386-6.C +++ b/gcc/testsuite/g++.dg/other/i386-6.C @@ -5,7 +5,7 @@ #include <wmmintrin.h> #include <bmmintrin.h> -#include <gmmintrin.h> +#include <immintrin.h> #include <mm3dnow.h> int dummy; diff --git a/gcc/testsuite/g++.dg/template/nontype18.C b/gcc/testsuite/g++.dg/template/nontype18.C new file mode 100644 index 00000000000..cbe0a1b5a0d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nontype18.C @@ -0,0 +1,8 @@ +// PR c++/28743 + +template<int I> struct A +{ + template<typename T> void foo(); +}; + +template<int I> template<typename T> void A<0>::foo() {} // { dg-error "template parameter" } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/const2.C b/gcc/testsuite/g++.old-deja/g++.pt/const2.C index 2666b9bc1f7..3ca4a532b19 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/const2.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/const2.C @@ -1,5 +1,6 @@ // { dg-do link } // This test should get a linker error for the reference to A<int>::i. +// { dg-prune-output "ld: symbol" } // { dg-message "i" "" { target *-*-* } 0 } template <class T> struct B { static const int i = 3; }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static6.C b/gcc/testsuite/g++.old-deja/g++.pt/static6.C index a0d255c5f5e..3ff41fead3a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/static6.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/static6.C @@ -1,5 +1,5 @@ // { dg-do link } -// { dg-xfail-if "" { *-*-aout *-*-coff *-*-hpux* *-*-hms } { "*" } { "" } } +// { dg-xfail-if "" { *-*-aout *-*-coff *-*-hms } { "*" } { "" } } // Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> diff --git a/gcc/testsuite/gcc.c-torture/compile/20080929-1.c b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c new file mode 100644 index 00000000000..1aa868ca224 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080929-1.c @@ -0,0 +1,39 @@ +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; +enum { + UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, }; +typedef void * libubi_t; +struct ubi_dev_info { + int leb_size; +}; +struct args { + int vol_id; + int vol_type; + long long bytes; + int lebs; + int alignment; + const char *node; + int maxavs; + int devn; +}; +static struct args args = { + .vol_type = UBI_DYNAMIC_VOLUME, .bytes = -1, .lebs = -1, .alignment = 1, .vol_id = (-1), .devn = -1, }; +extern libubi_t libubi_open (int); +extern int ubi_get_dev_info (libubi_t, const char *, struct ubi_dev_info *); +int main(int argc, char * const argv[]) { + int err; + libubi_t libubi; + struct ubi_dev_info dev_info; + libubi = libubi_open(1); + if (!libubi) + return 0; + err = ubi_get_dev_info(libubi, args.node, &dev_info); + if (args.maxavs) { + args.bytes = dev_info.leb_size; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c new file mode 100644 index 00000000000..541bd42ad5d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c @@ -0,0 +1,17 @@ +void matmul_i4 (int * __restrict dest_y, + const int * __restrict abase, + const int * __restrict bbase_y, + int count, int xcount, int ycount, int aystride) +{ + int x, y, n; + const int * __restrict abase_n; + int bbase_yn; + for (y = 0; y < ycount; y++) + for (n = 0; n < count; n++) { + abase_n = abase + n*aystride; + bbase_yn = bbase_y[n]; + for (x = 0; x < xcount; x++) + dest_y[x] += abase_n[x] * bbase_yn; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37955.c b/gcc/testsuite/gcc.c-torture/compile/pr37955.c new file mode 100644 index 00000000000..1ac0246f5ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37955.c @@ -0,0 +1,19 @@ +typedef struct +{ + enum { NotConnected = 0 } conn_state; + unsigned int conn_hndl; +} AEP_CONNECTION_ENTRY; + +static AEP_CONNECTION_ENTRY aep_app_conn_table[256]; + +void aep_mod_exp (void) +{ + int count; + + for (count = 0; count < 256; count++) + { + aep_app_conn_table[count].conn_state = NotConnected; + aep_app_conn_table[count].conn_hndl = 0; + } +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36321.c b/gcc/testsuite/gcc.c-torture/execute/pr36321.c index 37d64f3d8be..1edf8e41525 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr36321.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr36321.c @@ -16,9 +16,11 @@ void foo(char *str) } } +static char * volatile argp = "pr36321.x"; + int main(int argc, char **argv) { - foo (argv[0]); + foo (argp); return 0; } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c b/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c new file mode 100644 index 00000000000..b87363f6446 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38048-1.c @@ -0,0 +1,22 @@ +extern void abort(void); + +int foo () +{ + int mat[2][1]; + int (*a)[1] = mat; + int det = 0; + int i; + mat[0][0] = 1; + mat[1][0] = 2; + for (i = 0; i < 2; ++i) + det += a[i][0]; + return det; +} + +int main() +{ + if (foo () != 3) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c b/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c new file mode 100644 index 00000000000..f4fe40cac87 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38048-2.c @@ -0,0 +1,28 @@ +extern void abort (void); + +static int inv_J(int a[][2]) +{ + int i, j; + int det = 0.0; + for (j=0; j<2; ++j) + det += a[j][0] + a[j][1]; + return det; +} + +int foo() +{ + int mat[2][2]; + mat[0][0] = 1; + mat[0][1] = 2; + mat[1][0] = 4; + mat[1][1] = 8; + return inv_J(mat); +} + +int main() +{ + if (foo () != 15) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38151.c b/gcc/testsuite/gcc.c-torture/execute/pr38151.c new file mode 100644 index 00000000000..113a255b15e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38151.c @@ -0,0 +1,46 @@ +void abort (void); + +struct S2848 +{ + unsigned int a; + _Complex int b; + struct + { + } __attribute__ ((aligned)) c; +}; + +struct S2848 s2848; + +int fails; + +void __attribute__((noinline)) +check2848va (int z, ...) +{ + struct S2848 arg; + __builtin_va_list ap; + + __builtin_va_start (ap, z); + + arg = __builtin_va_arg (ap, struct S2848); + + if (s2848.a != arg.a) + ++fails; + if (s2848.b != arg.b) + ++fails; + + __builtin_va_end (ap); +} + +int main (void) +{ + s2848.a = 4027477739U; + s2848.b = (723419448 + -218144346 * __extension__ 1i); + + check2848va (1, s2848); + + if (fails) + abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38236.c b/gcc/testsuite/gcc.c-torture/execute/pr38236.c new file mode 100644 index 00000000000..d781542c7cc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38236.c @@ -0,0 +1,22 @@ +struct X { int i; }; + +int __attribute__((noinline)) +foo (struct X *p, int *q, int a, int b) +{ + struct X x, y; + if (a) + p = &x; + if (b) + q = &x.i; + else + q = &y.i; + *q = 1; + return p->i; +} +extern void abort (void); +int main() +{ + if (foo((void *)0, (void *)0, 1, 1) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/callabi/func-indirect.c b/gcc/testsuite/gcc.dg/callabi/func-indirect.c new file mode 100644 index 00000000000..d7733bd9d72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/func-indirect.c @@ -0,0 +1,24 @@ +/* Test for cross x86_64<->w64 abi standard calls via variable. +*/ +/* Origin: Kai Tietz <kai.tietz@onevision.com> */ +/* { dg-do run { target { x86_64-*-* } } } */ +/* { dg-options "-std=gnu99 -ffast-math" } */ +#include "callabi.h" + +extern void abort (void); + +typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long); + +int CALLABI_CROSS +callback(void * ptr, char *string1, char *string2, short number, long long rand) +{ + return (rand != 0x1234567890abcdefLL); +} + +int main() +{ + volatile func callme = callback; + if(callme(0, 0, 0, 0, 0x1234567890abcdefLL)) + abort(); +} + diff --git a/gcc/testsuite/gcc.dg/pr29215.c b/gcc/testsuite/gcc.dg/pr29215.c new file mode 100644 index 00000000000..aa3f82ce0e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr29215.c @@ -0,0 +1,33 @@ +/* PR middle-end/29215 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-gimple" } */ + +char buf[5 * sizeof (int) + 1] __attribute__((aligned (__alignof__ (int)))); + +static void +foo (int arg1, int arg2, int arg3, int arg4, int arg5) +{ + __builtin_memcpy (buf, &arg1, sizeof (int)); + __builtin_memcpy (buf + sizeof (int), &arg2, sizeof (int)); + __builtin_memcpy (buf + 2 * sizeof (int), &arg3, sizeof (int)); + __builtin_memcpy (buf + 3 * sizeof (int), &arg4, sizeof (int)); + __builtin_memcpy (buf + 4 * sizeof (int), &arg5, sizeof (int)); +} + +int +main (void) +{ + union { char buf[4]; int i; } u; + u.i = 0; + u.buf[0] = 'a'; + u.buf[1] = 'b'; + u.buf[2] = 'c'; + u.buf[3] = 'd'; + foo (u.i, u.i, u.i, u.i, u.i); + buf[5 * sizeof (int)] = '\0'; + __builtin_puts (buf); + return 0; +} + +/* { dg-final { scan-tree-dump-not "memcpy" "gimple" } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/pr38200.c b/gcc/testsuite/gcc.dg/pr38200.c new file mode 100644 index 00000000000..d5391bd889e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr38200.c @@ -0,0 +1,16 @@ +/* PR middle-end/38200 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing" } */ + +typedef int (*callptr) (void); +int foo (void **x); +void foo2 (callptr *); +int (*foo_ptr) (void **x) = foo; + +void +bar (void) +{ + void *ptr; + foo2 ((callptr *) &ptr); + *(void **) &foo_ptr = ptr; +} diff --git a/gcc/testsuite/gcc.dg/sync-2.c b/gcc/testsuite/gcc.dg/sync-2.c index 7fea8f8fd03..7794ffd9d36 100644 --- a/gcc/testsuite/gcc.dg/sync-2.c +++ b/gcc/testsuite/gcc.dg/sync-2.c @@ -46,7 +46,7 @@ do_qi (void) abort (); if (__sync_xor_and_fetch(AI+16, 9) != 9) abort (); - if (__sync_nand_and_fetch(AI+17, 7) != ~7) + if (__sync_nand_and_fetch(AI+17, 7) != (char)~7) abort (); } diff --git a/gcc/testsuite/gcc.dg/sync-3.c b/gcc/testsuite/gcc.dg/sync-3.c index a359d162fee..f912405035a 100644 --- a/gcc/testsuite/gcc.dg/sync-3.c +++ b/gcc/testsuite/gcc.dg/sync-3.c @@ -43,7 +43,7 @@ do_qi (void) abort (); if (__sync_xor_and_fetch(AI+16, 9) != 9) abort (); - if (__sync_nand_and_fetch(AI+17, 7) != ~7) /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" } */ + if (__sync_nand_and_fetch(AI+17, 7) != (char)~7) /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" } */ abort (); } diff --git a/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c index c5adb259d26..10963973c3b 100644 --- a/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c +++ b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { nonpic } } } */ /* { dg-options "-fipa-pta -fdump-ipa-pta" } */ /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr37868.c b/gcc/testsuite/gcc.dg/torture/pr37868.c new file mode 100644 index 00000000000..85c2b5072ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr37868.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-fno-strict-aliasing" } */ + +extern void abort (void); + +struct X { + unsigned char pad : 4; + unsigned int a : 32; + unsigned int b : 24; + unsigned int c : 6; +} __attribute__((packed)); + +int main (void) +{ + struct X x; + unsigned int bad_bits; + + x.pad = -1; + x.a = -1; + x.b = -1; + x.c = -1; + + bad_bits = ((unsigned int)-1) ^ *(1+(unsigned int *) &x); + if (bad_bits != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-2.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-2.c index fde5c3956c5..ecd0fdc9fde 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-2.c @@ -1,3 +1,4 @@ +/* { dg-do compile { target { nonpic } } } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ static int a; int f; diff --git a/gcc/testsuite/gcc.target/i386/align-main-3.c b/gcc/testsuite/gcc.target/i386/align-main-3.c new file mode 100644 index 00000000000..d2f88d85961 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/align-main-3.c @@ -0,0 +1,14 @@ +/* Test for stack alignment with sibcall optimization. */ +/* { dg-do compile { target { *-*-linux* && ilp32 } } } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=4 -mincoming-stack-boundary=2" } */ +/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler "call\[\\t \]*foo" } } */ +/* { dg-final { scan-assembler-not "jmp\[\\t \]*foo" } } */ + +extern int foo (void); + +int +main () +{ + return foo (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c index 3cda080a3df..d093d6c1cc3 100644 --- a/gcc/testsuite/gcc.target/i386/avx-1.c +++ b/gcc/testsuite/gcc.target/i386/avx-1.c @@ -18,7 +18,7 @@ #define __builtin_ia32_extrqi(X, I, L) __builtin_ia32_extrqi(X, 1, 1) #define __builtin_ia32_insertqi(X, Y, I, L) __builtin_ia32_insertqi(X, Y, 1, 1) -/* gmmintrin.h */ +/* immintrin.h */ #define __builtin_ia32_blendpd256(X, Y, M) __builtin_ia32_blendpd256(X, Y, 1) #define __builtin_ia32_blendps256(X, Y, M) __builtin_ia32_blendps256(X, Y, 1) #define __builtin_ia32_dpps256(X, Y, M) __builtin_ia32_dpps256(X, Y, 1) @@ -135,5 +135,5 @@ #include <wmmintrin.h> #include <bmmintrin.h> -#include <gmmintrin.h> +#include <immintrin.h> #include <mm3dnow.h> diff --git a/gcc/testsuite/gcc.target/i386/avx-2.c b/gcc/testsuite/gcc.target/i386/avx-2.c index 6699558d8f9..62f6538bbe6 100644 --- a/gcc/testsuite/gcc.target/i386/avx-2.c +++ b/gcc/testsuite/gcc.target/i386/avx-2.c @@ -14,7 +14,7 @@ #include <wmmintrin.h> #include <bmmintrin.h> -#include <gmmintrin.h> +#include <immintrin.h> #include <mm3dnow.h> #define _CONCAT(x,y) x ## y @@ -53,7 +53,7 @@ test_1x (_mm_extracti_si64, __m128i, __m128i, 1, 1) test_2x (_mm_inserti_si64, __m128i, __m128i, __m128i, 1, 1) -/* gmmintrin.h */ +/* immintrin.h */ test_2 (_mm256_blend_pd, __m256d, __m256d, __m256d, 1) test_2 (_mm256_blend_ps, __m256, __m256, __m256, 1) test_2 (_mm256_dp_ps, __m256, __m256, __m256, 1) diff --git a/gcc/testsuite/gcc.target/i386/funcspec-3.c b/gcc/testsuite/gcc.target/i386/funcspec-3.c index 62748beeeff..01c7e4ca05e 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-3.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-3.c @@ -59,8 +59,9 @@ int main () exit (0); } -/* { dg-final { scan-assembler "popcntl" } } */ -/* { dg-final { scan-assembler "popcntq" } } */ +/* { dg-final { scan-assembler "popcntl" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "popcntq" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times "popcnt" 2 { target *-*-darwin* } } } */ /* { dg-final { scan-assembler "call\t(.*)sse4a_pop_i" } } */ /* { dg-final { scan-assembler "call\t(.*)sse42_pop_l" } } */ /* { dg-final { scan-assembler "call\t(.*)popcountdi2" } } */ diff --git a/gcc/testsuite/gcc.target/i386/m256-check.h b/gcc/testsuite/gcc.target/i386/m256-check.h index 324af75ba64..e1843550ecd 100644 --- a/gcc/testsuite/gcc.target/i386/m256-check.h +++ b/gcc/testsuite/gcc.target/i386/m256-check.h @@ -1,4 +1,4 @@ -#include <gmmintrin.h> +#include <immintrin.h> #include "m128-check.h" #ifndef max diff --git a/gcc/testsuite/gcc.target/i386/pr37843-1.c b/gcc/testsuite/gcc.target/i386/pr37843-1.c new file mode 100644 index 00000000000..b094f9dbc16 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr37843-1.c @@ -0,0 +1,13 @@ +/* Test for stack alignment with sibcall optimization. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=5" } */ +/* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler "call\[\\t \]*foo" } } */ +/* { dg-final { scan-assembler-not "jmp\[\\t \]*foo" } } */ + +extern int foo (void); + +int bar (void) +{ + return foo(); +} diff --git a/gcc/testsuite/gcc.target/i386/pr37843-2.c b/gcc/testsuite/gcc.target/i386/pr37843-2.c new file mode 100644 index 00000000000..47fd04c491a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr37843-2.c @@ -0,0 +1,13 @@ +/* Test for stack alignment with sibcall optimization. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=6 -mincoming-stack-boundary=6" } */ +/* { dg-final { scan-assembler-not "and\[lq\]?\[\\t \]*\\$-64,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-not "call\[\\t \]*foo" } } */ +/* { dg-final { scan-assembler "jmp\[\\t \]*foo" } } */ + +extern int foo (void); + +int bar (void) +{ + return foo(); +} diff --git a/gcc/testsuite/gcc.target/i386/pr37843-3.c b/gcc/testsuite/gcc.target/i386/pr37843-3.c new file mode 100644 index 00000000000..7923b295294 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr37843-3.c @@ -0,0 +1,13 @@ +/* Test for stack alignment with sibcall optimization. */ +/* { dg-do compile { target { *-*-linux* && ilp32 } } } */ +/* { dg-options "-O2 -std=gnu99 -mpreferred-stack-boundary=4 -mincoming-stack-boundary=2" } */ +/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%\[re\]?sp" } } */ +/* { dg-final { scan-assembler-not "call\[\\t \]*foo" } } */ +/* { dg-final { scan-assembler "jmp\[\\t \]*foo" } } */ + +extern int foo (_Decimal128); + +int bar (_Decimal128 x) +{ + return foo(x); +} diff --git a/gcc/testsuite/gcc.target/i386/pr38151-1.c b/gcc/testsuite/gcc.target/i386/pr38151-1.c new file mode 100644 index 00000000000..6500a5029b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr38151-1.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +struct S2848 +{ + unsigned int a; + _Complex int b; +}; + +struct S2848 s2848; + +void __attribute__((noinline)) +check2848 (struct S2848 arg0) +{ + if (arg0.b != s2848.b) + abort (); +} + +int main() +{ + s2848.a = 4027477739U; + s2848.b = (723419448 + -218144346 * __extension__ 1i); + + check2848 (s2848); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/m68k/pr35018.c b/gcc/testsuite/gcc.target/m68k/pr35018.c new file mode 100644 index 00000000000..fadea8620b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/pr35018.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -mcpu=5249" } */ + +static inline void vect_add(int *x, int *y, int n) +{ + asm volatile ("nop;" + : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y) + : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3", + "cc", "memory"); +} + +extern void vect_copy (int *, int *, int); + +void vorbis_synthesis_blockin(int *blocksizes) +{ + int j, *pcm, *p; + + int n=blocksizes[*p]/2; + int n0=blocksizes[0]/2; + int n1=blocksizes[1]/2; + + for(j=0;j<*p;j++) + { + vect_add(p, pcm, n1); + vect_add(pcm, p, n0); + vect_add(p, pcm, n0); + vect_add(p, pcm, n0); + vect_copy(pcm, p, n); + } +} + diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90 new file mode 100644 index 00000000000..c0f3c76eb83 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! +! Test the fix for PR37735, in which gfc gagged in the assignement to +! 'p'. The array component 'r' caused an ICE. +! +! Contributed by Steven Winfield <saw44@cam.ac.uk> +! +module PrettyPix_module + implicit none + type Spline + real, allocatable, dimension(:) ::y2 + end type Spline + type Path + type(Spline) :: r(3) + end type Path + type Scene + type(path) :: look_at_path + end type Scene +contains + subroutine scene_set_look_at_path(this,p) + type(scene), intent(inout) :: this + type(path), intent(in) :: p + this%look_at_path = p + end subroutine scene_set_look_at_path +end module PrettyPix_module + + use PrettyPix_module + implicit none + integer :: i + real :: x(3) = [1.0, 2.0, 3.0] + type(scene) :: this + type(path) :: p + p = path ([spline([x(1)]),spline([x(2)]),spline([x(3)])]) + call scene_set_look_at_path(this,p) + do i = 1, 3 + if (this%look_at_path%r(i)%y2(1) .ne. x(i)) call abort + end do +end + +! { dg-final { cleanup-modules "PrettyPix_module" } } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_2.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_2.f90 new file mode 100644 index 00000000000..c4c4ae21e01 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_2.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! Tests the fix for PR34820, in which the nullification of the +! automatic array iregion occurred in the caller, rather than the +! callee. Since 'nproc' was not available, an ICE ensued. During +! the bug fix, it was found that the scalar to array assignment +! of derived types with allocatable components did not work and +! the fix of this is tested too. +! +! Contributed by Toon Moene <toon@moene.indiv.nluug.nl> +! +module grid_io + type grid_index_region + integer, allocatable::lons(:) + end type grid_index_region +contains + subroutine read_grid_header() + integer :: npiece = 1 + type(grid_index_region),allocatable :: iregion(:) + allocate (iregion(npiece + 1)) + call read_iregion(npiece,iregion) + if (size(iregion) .ne. npiece + 1) call abort + if (.not.allocated (iregion(npiece)%lons)) call abort + if (allocated (iregion(npiece+1)%lons)) call abort + if (any (iregion(npiece)%lons .ne. [(i, i = 1, npiece)])) call abort + deallocate (iregion) + end subroutine read_grid_header + + subroutine read_iregion (nproc,iregion) + integer,intent(in)::nproc + type(grid_index_region), intent(OUT)::iregion(1:nproc) + integer :: iarg(nproc) + iarg = [(i, i = 1, nproc)] + iregion = grid_index_region (iarg) ! + end subroutine read_iregion +end module grid_io + + use grid_io + call read_grid_header +end +! { dg-final { cleanup-tree-dump "grid_io" } } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90 index 11f655e320b..e024d8b790d 100644 --- a/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90 +++ b/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90 @@ -139,6 +139,6 @@ contains end subroutine check_alloc2 end program alloc -! { dg-final { scan-tree-dump-times "builtin_free" 27 "original" } } +! { dg-final { scan-tree-dump-times "builtin_free" 21 "original" } } ! { dg-final { cleanup-tree-dump "original" } } ! { dg-final { cleanup-modules "alloc_m" } } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_4.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_4.f90 new file mode 100644 index 00000000000..4b047daf349 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_4.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! Tests the fix for PR32795, which was primarily about memory leakage is +! certain combinations of alloctable components and constructors. This test +! which appears in comment #2 of the PR has the advantage of a wrong +! numeric result which is symptomatic. +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> +! + type :: a + integer, allocatable :: i(:) + end type a + type(a) :: x, y + x = a ([1, 2, 3]) + y = a (x%i(:)) ! used to cause a memory leak and wrong result + if (any (x%i .ne. [1, 2, 3])) call abort +end diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_5.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_5.f90 new file mode 100644 index 00000000000..9526112c995 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_5.f90 @@ -0,0 +1,29 @@ +! { dg-do run } +! { dg-options "-fdefault-integer-8" } +! Tests the fix for PR34143, in which the implicit conversion of yy, with +! fdefault-integer-8, would cause a segfault at runtime. +! +! Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> +! +Program test_constructor + implicit none + type :: thytype + integer(4) :: a(2,2) + end type thytype + type :: mytype + integer(4), allocatable :: a(:, :) + type(thytype), allocatable :: q(:) + end type mytype + integer, allocatable :: yy(:,:) + type (thytype), allocatable :: bar(:) + type (mytype) :: x, y + x = mytype(yy, bar) + if (allocated (x%a) .or. allocated (x%q)) call abort + allocate (yy(2,2)) + allocate (bar(2)) + yy = reshape ([10,20,30,40],[2,2]) + bar = thytype (reshape ([1,2,3,4],[2,2])) + ! Check that unallocated allocatables work + y = mytype(yy, bar) + if (.not.allocated (y%a) .or. .not.allocated (y%q)) call abort +end program test_constructor diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_6.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_6.f90 new file mode 100644 index 00000000000..b2ac4f723be --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_6.f90 @@ -0,0 +1,38 @@ +! { dg-do run } +! { dg-options "-fdefault-integer-8 -O2" } +! Tests the fix for PR34143, where the implicit type +! conversion in the derived type constructor would fail, +! when 'yy' was not allocated. The testscase is an +! extract from alloc_comp_constructor.f90. +! +! Reported by Thomas Koenig <tkoenig@gcc.gnu.org> +! +Program test_constructor + implicit none + type :: thytype + integer(4) :: a(2,2) + end type thytype + type :: mytype + integer(4), allocatable :: a(:, :) + type(thytype), allocatable :: q(:) + end type mytype + integer, allocatable :: yy(:,:) + type (thytype), allocatable :: bar(:) + call non_alloc + call alloc +contains + subroutine non_alloc + type (mytype) :: x + x = mytype(yy, bar) + if (allocated (x%a) .or. allocated (x%q)) call abort + end subroutine non_alloc + subroutine alloc + type (mytype) :: x + allocate (yy(2,2)) + allocate (bar(2)) + yy = reshape ([10,20,30,40],[2,2]) + bar = thytype (reshape ([1,2,3,4],[2,2])) + x = mytype(yy, bar) + if (.not.allocated (x%a) .or. .not.allocated (x%q)) call abort + end subroutine alloc +end program test_constructor diff --git a/gcc/testsuite/gfortran.dg/array_memcpy_3.f90 b/gcc/testsuite/gfortran.dg/array_memcpy_3.f90 index 05915877b15..df6bd49ef26 100644 --- a/gcc/testsuite/gfortran.dg/array_memcpy_3.f90 +++ b/gcc/testsuite/gfortran.dg/array_memcpy_3.f90 @@ -11,5 +11,5 @@ subroutine bar(x) x = (/ 3, 1, 4, 1 /) end subroutine -! { dg-final { scan-tree-dump-times "memcpy" 2 "original" } } +! { dg-final { scan-tree-dump-times "memcpy|ref-all" 2 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/array_section_2.f90 b/gcc/testsuite/gfortran.dg/array_section_2.f90 index bfb4c01e6af..ed5208cf3ad 100644 --- a/gcc/testsuite/gfortran.dg/array_section_2.f90 +++ b/gcc/testsuite/gfortran.dg/array_section_2.f90 @@ -12,5 +12,5 @@ program test allocate(a(n), temp(n)) temp(1:size(a)) = a end program -! { dg-final { scan-tree-dump-times "size0" 1 "original" } } +! { dg-final { scan-tree-dump-times "MAX_EXPR\[^\n\t\]+ubound\[^\n\t\]+lbound" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 new file mode 100644 index 00000000000..30534cca9a9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! +! PR fortran/38160 +! + +subroutine foo(x,y,z,a) bind(c) ! { dg-warning "but may not be C interoperable" } + use iso_c_binding + implicit none + integer(4) :: x + integer(c_float) :: y ! { dg-error "C kind type parameter is for type REAL" } + complex(c_float) :: z ! OK, c_float == c_float_complex + real(c_float_complex) :: a ! OK, c_float == c_float_complex +end subroutine foo + +use iso_c_binding +implicit none +integer, parameter :: it = c_int +integer, parameter :: dt = c_double +complex(c_int), target :: z1 ! { dg-error "C kind type parameter is for type INTEGER" } +complex(it), target :: z2 ! { dg-error "C kind type parameter is for type INTEGER" } +complex(c_double), target :: z3 ! OK +complex(dt), target :: z4 ! OK +type(c_ptr) :: ptr + +ptr = c_loc(z1) +ptr = c_loc(z2) +ptr = c_loc(z3) +ptr = c_loc(z4) +end diff --git a/gcc/testsuite/gfortran.dg/c_funloc_tests.f03 b/gcc/testsuite/gfortran.dg/c_funloc_tests.f03 index c34ef2b6f49..8ba07b9fbba 100644 --- a/gcc/testsuite/gfortran.dg/c_funloc_tests.f03 +++ b/gcc/testsuite/gfortran.dg/c_funloc_tests.f03 @@ -5,7 +5,7 @@ module c_funloc_tests use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc contains - subroutine sub0() bind(c) + recursive subroutine sub0() bind(c) type(c_funptr) :: my_c_funptr my_c_funptr = c_funloc(sub0) diff --git a/gcc/testsuite/gfortran.dg/c_funloc_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_funloc_tests_2.f03 index afaf29fc896..d3ed265ea8c 100644 --- a/gcc/testsuite/gfortran.dg/c_funloc_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_funloc_tests_2.f03 @@ -4,7 +4,7 @@ module c_funloc_tests_2 implicit none contains - subroutine sub0() bind(c) + recursive subroutine sub0() bind(c) type(c_funptr) :: my_c_funptr integer :: my_local_variable diff --git a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 index dcac65dec43..ced31a554ba 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 @@ -4,11 +4,11 @@ module c_kind_tests_2 integer, parameter :: myF = c_float real(myF), bind(c) :: myCFloat - integer(myF), bind(c) :: myCInt ! { dg-error "is for type REAL" } + integer(myF), bind(c) :: myCInt ! { dg-error "is for type REAL" } integer(c_double), bind(c) :: myCInt2 ! { dg-error "is for type REAL" } integer, parameter :: myI = c_int - real(myI) :: myReal + real(myI) :: myReal ! { dg-error "is for type INTEGER" } real(myI), bind(c) :: myCFloat2 ! { dg-error "is for type INTEGER" } - real(4), bind(c) :: myFloat ! { dg-warning "may not be a C interoperable" } + real(4), bind(c) :: myFloat ! { dg-warning "may not be a C interoperable" } end module c_kind_tests_2 diff --git a/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 b/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 index 06fa5a5bc93..181ae9d7959 100644 --- a/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 +++ b/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 @@ -1,4 +1,4 @@ -! { dg-do run { xfail *-*-darwin[1-9] *-*-freebsd* *-*-mingw* } } +! { dg-do run { xfail *-*-darwin[89]* *-*-freebsd* *-*-mingw* } } ! Test XFAILed on these platforms because the system's printf() lacks ! proper support for denormals. ! diff --git a/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 b/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 new file mode 100644 index 00000000000..3e1f67b9a71 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 @@ -0,0 +1,83 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } +! +! PR fortran/35681 +! Test the use of temporaries in case of elemental subroutines. + +PROGRAM main + IMPLICIT NONE + INTEGER, PARAMETER :: sz = 5 + INTEGER :: i + INTEGER :: a(sz) = (/ (i, i=1,sz) /) + INTEGER :: b(sz) + + b = a + CALL double(a(sz-b+1), a) ! { dg-warning "might interfere with actual" } + ! Don't check the result, as the above is invalid + ! and might produce unexpected results (overlapping vector subscripts). + + + b = a + CALL double (a, a) ! same range, no temporary + IF (ANY(a /= 2*b)) CALL abort + + + b = a + CALL double (a+1, a) ! same range, no temporary + IF (ANY(a /= 2*b+2)) CALL abort + + + b = a + CALL double ((a(1:sz)), a(1:sz)) ! same range, no temporary + IF (ANY(a /= 2*b)) CALL abort + + + b = a + CALL double(a(1:sz-1), a(2:sz)) ! { dg-warning "might interfere with actual" } + ! Don't check the result, as the above is invalid, + ! and might produce unexpected results (arguments overlap). + + + b = a + CALL double((a(1:sz-1)), a(2:sz)) ! paren expression, temporary created +! { dg-final { scan-tree-dump-times "A\.17\\\[4\\\]" 1 "original" } } + + IF (ANY(a /= (/ b(1), (2*b(i), i=1,sz-1) /))) CALL abort + + + b = a + CALL double(a(1:sz-1)+1, a(2:sz)) ! op expression, temporary created +! { dg-final { scan-tree-dump-times "A\.26\\\[4\\\]" 1 "original" } } + + IF (ANY(a /= (/ b(1), (2*b(i)+2, i=1,sz-1) /))) CALL abort + + + b = a + CALL double(self(a), a) ! same range, no temporary + IF (ANY(a /= 2*b)) CALL abort + + + b = a + CALL double(self(a(1:sz-1)), a(2:sz)) ! function expr, temporary created +! { dg-final { scan-tree-dump-times "A\.38\\\[4\\\]" 1 "original" } } + + IF (ANY(a /= (/ b(1), (2*b(i), i=1,sz-1) /))) CALL abort + + +CONTAINS + ELEMENTAL SUBROUTINE double(a, b) + IMPLICIT NONE + INTEGER, INTENT(IN) :: a + INTEGER, INTENT(OUT) :: b + b = 2 * a + END SUBROUTINE double + ELEMENTAL FUNCTION self(a) + IMPLICIT NONE + INTEGER, INTENT(IN) :: a + INTEGER :: self + self = a + END FUNCTION self +END PROGRAM main + +! { dg-final { scan-tree-dump-times "_gfortran_internal_unpack" 3 "original" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 new file mode 100644 index 00000000000..5f3a9612a3b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 @@ -0,0 +1,21 @@ +! { dg-do run { target fd_truncate } } +! { dg-options "-std=gnu" } +character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding +integer :: vsize, vid +logical :: vpending + +open(10, file='mydata', asynchronous="yes", blank="null", & +& decimal="comma", encoding="utf-8", sign="plus") + +inquire(unit=10, round=sround, sign=ssign, size=vsize, id=vid, & +& pending=vpending, asynchronous=sasynchronous, decimal=sdecimal, & +& encoding=sencoding) + +if (ssign.ne."PLUS") call abort +if (sasynchronous.ne."YES") call abort +if (sdecimal.ne."COMMA") call abort +if (sencoding.ne."UTF-8") call abort +if (vpending) call abort + +close(10, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 index d5861d9cab3..f1d67c5aaae 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 @@ -1,6 +1,5 @@ ! { dg-do run { target fd_truncate } } ! { dg-options "-std=gnu" } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> real :: a(4), b(4) real :: c diff --git a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 index 5c45f9619ef..92c708c2921 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal= feature diff --git a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 index c59e500ab07..3949b1a372f 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal="comma" in namelist and complex integer :: i diff --git a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 index ad16cf6b74c..40758e2232d 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 @@ -1,5 +1,4 @@ ! { dg-do run } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal="comma" in namelist, checks separators implicit none diff --git a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 index 488377d5c43..f45741718dc 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of sign=, decimal=, and blank= . program iotests diff --git a/gcc/testsuite/gfortran.dg/interop_params.f03 b/gcc/testsuite/gfortran.dg/interop_params.f03 index 8163b4a5040..96c7d5cef16 100644 --- a/gcc/testsuite/gfortran.dg/interop_params.f03 +++ b/gcc/testsuite/gfortran.dg/interop_params.f03 @@ -13,8 +13,8 @@ contains integer, value :: my_f90_int end subroutine test_0 - subroutine test_1(my_f90_real) bind(c) ! { dg-error "is for type INTEGER" } - real(c_int), value :: my_f90_real + subroutine test_1(my_f90_real) bind(c) + real(c_int), value :: my_f90_real ! { dg-error "is for type INTEGER" } end subroutine test_1 subroutine test_2(my_type) bind(c) ! { dg-error "is not C interoperable" } diff --git a/gcc/testsuite/gfortran.dg/namelist_print_1.f b/gcc/testsuite/gfortran.dg/namelist_print_1.f index feebd0053bf..abc8aec6cdc 100644 --- a/gcc/testsuite/gfortran.dg/namelist_print_1.f +++ b/gcc/testsuite/gfortran.dg/namelist_print_1.f @@ -9,5 +9,5 @@ namelist /mynml/ x x = 1 ! ( dg-output "^" } - print mynml ! { dg-output "&MYNML(\n|\r\n|\r) X= 1.00000000 ,(\n|\r\n|\r) /(\n|\r\n|\r)" } + print mynml ! { dg-output "&MYNML(\n|\r\n|\r) X= 1.0000000 ,(\n|\r\n|\r) /(\n|\r\n|\r)" } end diff --git a/gcc/testsuite/gfortran.dg/proc_decl_20.f90 b/gcc/testsuite/gfortran.dg/proc_decl_20.f90 new file mode 100644 index 00000000000..612dac19529 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_decl_20.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR fortran/36463 +! Gfortran used to fail on this testcase with: +! gfc_get_default_type(): Bad symbol '@0' +! +! Original program by James Van Buskirk +! Reduced by Janus Weil <janus@gcc.gnu.org> + +module other_fun + interface + function abstract_fun(x) + integer x + integer abstract_fun(x) + end function abstract_fun + end interface +end module other_fun + + program fptr + use other_fun + procedure(abstract_fun) :: fun + end program fptr + +! { dg-final { cleanup-modules "other_fun" } } diff --git a/gcc/testsuite/gfortran.dg/recursive_check_4.f03 b/gcc/testsuite/gfortran.dg/recursive_check_4.f03 new file mode 100644 index 00000000000..2a95554ff25 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_4.f03 @@ -0,0 +1,26 @@ +! { dg-do compile } + +! PR fortran/37779 +! Check that using a non-recursive procedure as "value" is an error. + +MODULE m + IMPLICIT NONE + +CONTAINS + + SUBROUTINE test () + IMPLICIT NONE + PROCEDURE(test), POINTER :: procptr + + CALL bar (test) ! { dg-warning "Non-RECURSIVE" } + procptr => test ! { dg-warning "Non-RECURSIVE" } + END SUBROUTINE test + + INTEGER FUNCTION func () + ! Using a result variable is ok of course! + func = 42 ! { dg-bogus "Non-RECURSIVE" } + END FUNCTION func + +END MODULE m + +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/recursive_check_5.f03 b/gcc/testsuite/gfortran.dg/recursive_check_5.f03 new file mode 100644 index 00000000000..4014986b3b5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_5.f03 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options "-frecursive" } + +! PR fortran/37779 +! Check that -frecursive allows using procedures in as procedure expressions. + +MODULE m + IMPLICIT NONE + +CONTAINS + + SUBROUTINE test () + IMPLICIT NONE + PROCEDURE(test), POINTER :: procptr + + CALL bar (test) ! { dg-bogus "Non-RECURSIVE" } + procptr => test ! { dg-bogus "Non-RECURSIVE" } + END SUBROUTINE test + + INTEGER FUNCTION func () + ! Using a result variable is ok of course! + func = 42 ! { dg-bogus "Non-RECURSIVE" } + END FUNCTION func + +END MODULE m + +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/reshape_3.f90 b/gcc/testsuite/gfortran.dg/reshape_3.f90 new file mode 100644 index 00000000000..a9f44b414eb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_3.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +program main + implicit none + integer, dimension(2,2) :: a4 + integer(kind=1), dimension(2,2) :: a1 + character(len=100) line + data a4 /1, 2, 3, 4/ + a1 = a4 + write (unit=line,fmt='(4I3)') reshape(a4,(/4/)) + write (unit=line,fmt='(4I3)') reshape(a1,(/4/)) +end program main diff --git a/gcc/testsuite/gfortran.dg/reshape_4.f90 b/gcc/testsuite/gfortran.dg/reshape_4.f90 new file mode 100644 index 00000000000..92208e57da5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_4.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +program main + real, dimension(2,2) :: result + real, dimension(6) :: source + real, dimension(2) :: pad + + call random_number (source) + call random_number (pad) + + result = reshape(source, shape(result),pad=pad(1:0)) + result = reshape(source, shape(result)) + result = reshape(source, shape(result),pad=pad) + +end program main diff --git a/gcc/testsuite/gfortran.dg/reshape_empty_1.f03 b/gcc/testsuite/gfortran.dg/reshape_empty_1.f03 new file mode 100644 index 00000000000..cac7e736085 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_empty_1.f03 @@ -0,0 +1,20 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } +! +! PR fortran/38184 +! invariant RESHAPE not expanded if SOURCE is empty. +! +! Original program by James Van Buskirk + +integer, parameter :: N = 3 +integer, parameter :: A(N,N) = reshape([integer::],[N,N],reshape([1],[N+1],[2])) +integer, parameter :: K = N*A(2,2)+A(2,3) +integer :: B(N,N) = reshape([1,2,2,2,1,2,2,2,1],[3,3]) +integer :: i +i = 5 +if (any(A /= B)) call abort +if (K /= i) call abort +end + +! { dg-final { scan-tree-dump-times "\\\{1, 2, 2, 2, 1, 2, 2, 2, 1\\\}" 2 "original" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 07f1c504eb2..09f6e26aef4 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -24,6 +24,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -279,6 +280,7 @@ proc g++_target_compile { source dest type options } { lappend options "additional_flags=[libio_include_flags]" lappend options "compiler=$GXX_UNDER_TEST" + lappend options "timeout=[timeout_value]" set options [concat $gpp_compile_options $options] diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 5d1efbb1763..13e0171d650 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -23,6 +23,8 @@ load_lib scanasm.exp load_lib scanrtl.exp load_lib scantree.exp load_lib scanipa.exp +load_lib timeout.exp +load_lib timeout-dg.exp load_lib prune.exp load_lib libgloss.exp load_lib target-libpath.exp @@ -580,12 +582,14 @@ if { [info procs saved-dg-test] == [list] } { if [info exists compiler_conditional_xfail_data] { unset compiler_conditional_xfail_data } + unset_timeout_vars error $errmsg $saved_info } set additional_files "" set additional_sources "" set additional_prunes "" set shouldfail 0 + unset_timeout_vars if [info exists compiler_conditional_xfail_data] { unset compiler_conditional_xfail_data } diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index 5985ce061d7..070b966a9a9 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -29,6 +29,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp # # GCC_UNDER_TEST is the compiler under test. @@ -147,9 +148,7 @@ proc gcc_target_compile { source dest type options } { if [info exists TOOL_OPTIONS] { set options [concat "{additional_flags=$TOOL_OPTIONS}" $options] } - if [target_info exists gcc,timeout] { - lappend options "timeout=[target_info gcc,timeout]" - } + lappend options "timeout=[timeout_value]" lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] return [target_compile $source $dest $type $options] diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index c00ee095022..b0e66d8d3a8 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -24,6 +24,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -193,6 +194,7 @@ proc gfortran_target_compile { source dest type options } { } lappend options "compiler=$GFORTRAN_UNDER_TEST" + lappend options "timeout=[timeout_value]" set options [concat "$ALWAYS_GFORTRANFLAGS" $options] set options [dg-additional-files-options $options $source] diff --git a/gcc/testsuite/lib/gnat.exp b/gcc/testsuite/lib/gnat.exp index 2ff7997284a..f73ec8152a0 100644 --- a/gcc/testsuite/lib/gnat.exp +++ b/gcc/testsuite/lib/gnat.exp @@ -27,6 +27,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp # # GNAT_UNDER_TEST is the compiler under test. @@ -131,6 +132,7 @@ proc gnat_target_compile { source dest type options } { set ld_library_path ".:${gnat_libgcc_s_path}" lappend options "compiler=$GNAT_UNDER_TEST -q -f" lappend options "incdir=${rootme}/ada/rts" + lappend options "timeout=[timeout_value]" if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp index 37882cbd233..502f4a73094 100644 --- a/gcc/testsuite/lib/obj-c++.exp +++ b/gcc/testsuite/lib/obj-c++.exp @@ -23,6 +23,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -324,6 +325,7 @@ proc obj-c++_target_compile { source dest type options } { lappend options "additional_flags=[libio_include_flags]" lappend options "compiler=$OBJCXX_UNDER_TEST"; + lappend options "timeout=[timeout_value]" set options [concat $gpp_compile_options $options] diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index 37e2a3fcdda..1705979dede 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -28,6 +28,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib timeout.exp load_lib target-libpath.exp # @@ -193,6 +194,7 @@ proc objc_target_compile { source dest type options } { set source [concat "-x objective-c-header" $source] } lappend options "compiler=$OBJC_UNDER_TEST" + lappend options "timeout=[timeout_value]" set_ld_library_path_env_vars diff --git a/gcc/testsuite/lib/timeout-dg.exp b/gcc/testsuite/lib/timeout-dg.exp new file mode 100644 index 00000000000..45de9041cc5 --- /dev/null +++ b/gcc/testsuite/lib/timeout-dg.exp @@ -0,0 +1,49 @@ +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# +# dg-timeout -- Set the timout limit, in seconds, for a particular test +# + +proc dg-timeout { args } { + global individual_timeout + + set args [lreplace $args 0 0] + if { [llength $args] > 1 } { + if { [dg-process-target [lindex $args 1]] == "S" } { + set individual_timeout [lindex $args 0] + } + } else { + set individual_timeout [lindex $args 0] + } +} + +# +# dg-timeout-factor -- Scale the timeout limit for a particular test +# + +proc dg-timeout-factor { args } { + global timeout_factor + + set args [lreplace $args 0 0] + if { [llength $args] > 1 } { + if { [dg-process-target [lindex $args 1]] == "S" } { + set timeout_factor [lindex $args 0] + } + } else { + set timeout_factor [lindex $args 0] + } +} diff --git a/gcc/testsuite/lib/timeout.exp b/gcc/testsuite/lib/timeout.exp new file mode 100644 index 00000000000..b4f4c18c704 --- /dev/null +++ b/gcc/testsuite/lib/timeout.exp @@ -0,0 +1,81 @@ +# Copyright (C) 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# +# unset_timeout_vars -- Unset variables used for timeouts +# + +proc unset_timeout_vars { args } { + global individual_timeout + global timeout_factor + + if [info exists individual_timeout] { + unset individual_timeout + } + if [info exists timeout_factor] { + unset timeout_factor + } +} + +# +# timeout_value -- Return the integer timeout value to use for this test +# + +proc timeout_value { args } { + global tool_timeout + global individual_timeout + global timeout_factor + + # Find the current timeout limit, in seconds. + if [info exists individual_timeout] { + set val $individual_timeout + } elseif [info exists tool_timeout] { + set val $tool_timeout + } elseif [target_info exists gcc,timeout] { + set val [target_info gcc,timeout] + } else { + # This is really, REALLY ugly, but this is the default from + # remote.exp deep within DejaGnu. + set val 300 + } + + # If the test specified a timeout factor, adjust by that. + if [info exists timeout_factor] { + set val [expr int([expr $val * $timeout_factor])] + } + + return $val +} + +# +# standard_wait -- Set the timeout value used by DejaGnu +# + +# Override standard_wait from DejaGnu to use timeout value specified by +# by the user or by the target board, possibly multiplied by a factor +# for a particular test. + +if { [info procs standard_wait] != [list] \ + && [info procs saved_standard_wait] == [list] } { + rename standard_wait saved_standard_wait + proc standard_wait { dest timeout } { + set val [timeout_value] + if { $val != 0 } { + set timeout $val + } + saved_standard_wait $dest $timeout + } +} diff --git a/gcc/tlink.c b/gcc/tlink.c index 51f371715ff..50206472eba 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "demangle.h" #include "collect2.h" +#include "libiberty.h" #define MAX_ITERATIONS 17 @@ -38,7 +39,7 @@ extern int prepends_underscore; static int tlink_verbose; -static char initial_cwd[MAXPATHLEN + 1]; +static char *initial_cwd; /* Hash table boilerplate for working with htab_t. We have hash tables for symbol names, file names, and demangled symbols. */ @@ -273,7 +274,7 @@ tlink_init (void) tlink_verbose = 3; } - getcwd (initial_cwd, sizeof (initial_cwd)); + initial_cwd = getpwd (); } static int diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 83800ed5722..6155809631d 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -188,15 +188,8 @@ struct alias_info struct alias_map_d **pointers; size_t num_pointers; - /* Variables that have been written to directly (i.e., not through a - pointer dereference). */ - struct pointer_set_t *written_vars; - - /* Pointers that have been used in an indirect store operation. */ - struct pointer_set_t *dereferenced_ptrs_store; - - /* Pointers that have been used in an indirect load operation. */ - struct pointer_set_t *dereferenced_ptrs_load; + /* Pointers that have been used in an indirect load/store operation. */ + struct pointer_set_t *dereferenced_ptrs; }; @@ -2073,9 +2066,7 @@ init_alias_info (void) ai->ssa_names_visited = sbitmap_alloc (num_ssa_names); sbitmap_zero (ai->ssa_names_visited); ai->processed_ptrs = VEC_alloc (tree, heap, 50); - ai->written_vars = pointer_set_create (); - ai->dereferenced_ptrs_store = pointer_set_create (); - ai->dereferenced_ptrs_load = pointer_set_create (); + ai->dereferenced_ptrs = pointer_set_create (); /* Clear out all memory reference stats. */ init_mem_ref_stats (); @@ -2123,9 +2114,7 @@ delete_alias_info (struct alias_info *ai) free (ai->pointers[i]); free (ai->pointers); - pointer_set_destroy (ai->written_vars); - pointer_set_destroy (ai->dereferenced_ptrs_store); - pointer_set_destroy (ai->dereferenced_ptrs_load); + pointer_set_destroy (ai->dereferenced_ptrs); free (ai); delete_mem_ref_stats (cfun); @@ -2361,23 +2350,18 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) { struct alias_map_d *v_map; var_ann_t v_ann; - bool tag_stored_p, var_stored_p; v_map = ai->addressable_vars[j]; var = v_map->var; v_ann = var_ann (var); - /* Skip memory tags and variables that have never been - written to. We also need to check if the variables are - call-clobbered because they may be overwritten by - function calls. */ - tag_stored_p = pointer_set_contains (ai->written_vars, tag) - || is_call_clobbered (tag); - var_stored_p = pointer_set_contains (ai->written_vars, var) - || is_call_clobbered (var); - if (!tag_stored_p && !var_stored_p) - continue; - + /* We used to skip variables that have never been written to + if the memory tag has been never written to directly (or + either of them were call clobbered). This is not enough + though, as this misses writes through the tags aliases. + So, for correctness we need to include any aliased + variable here. */ + if (may_alias_p (p_map->var, p_map->set, var, v_map->set, false)) { /* Add VAR to TAG's may-aliases set. */ @@ -2618,13 +2602,8 @@ update_alias_info_1 (gimple stmt, struct alias_info *ai) /* ??? For always executed direct dereferences we can apply TBAA-pruning to their escape set. */ - /* If this is a store operation, mark OP as being - dereferenced to store, otherwise mark it as being - dereferenced to load. */ - if (num_stores > 0) - pointer_set_insert (ai->dereferenced_ptrs_store, var); - else - pointer_set_insert (ai->dereferenced_ptrs_load, var); + /* Mark OP as being dereferenced. */ + pointer_set_insert (ai->dereferenced_ptrs, var); /* Update the frequency estimate for all the dereferences of pointer OP. */ @@ -2649,7 +2628,7 @@ update_alias_info_1 (gimple stmt, struct alias_info *ai) if (is_gimple_call (stmt) || stmt_escape_type == ESCAPE_STORED_IN_GLOBAL) { - pointer_set_insert (ai->dereferenced_ptrs_store, var); + pointer_set_insert (ai->dereferenced_ptrs, var); pi->memory_tag_needed = 1; } } @@ -2667,17 +2646,6 @@ update_alias_info_1 (gimple stmt, struct alias_info *ai) mem_ref_stats->num_mem_stmts++; - /* Add all decls written to to the list of written variables. */ - if (gimple_has_lhs (stmt) - && TREE_CODE (gimple_get_lhs (stmt)) != SSA_NAME) - { - tree lhs = gimple_get_lhs (stmt); - while (handled_component_p (lhs)) - lhs = TREE_OPERAND (lhs, 0); - if (DECL_P (lhs)) - pointer_set_insert (ai->written_vars, lhs); - } - /* Notice that we only update memory reference stats for symbols loaded and stored by the statement if the statement does not contain pointer dereferences and it is not a call/asm site. @@ -2770,7 +2738,7 @@ setup_pointers_and_addressables (struct alias_info *ai) /* Since we don't keep track of volatile variables, assume that these pointers are used in indirect store operations. */ if (TREE_THIS_VOLATILE (var)) - pointer_set_insert (ai->dereferenced_ptrs_store, var); + pointer_set_insert (ai->dereferenced_ptrs, var); num_pointers++; } @@ -2845,8 +2813,7 @@ setup_pointers_and_addressables (struct alias_info *ai) array and create a symbol memory tag for them. */ if (POINTER_TYPE_P (TREE_TYPE (var))) { - if ((pointer_set_contains (ai->dereferenced_ptrs_store, var) - || pointer_set_contains (ai->dereferenced_ptrs_load, var))) + if (pointer_set_contains (ai->dereferenced_ptrs, var)) { tree tag, old_tag; var_ann_t t_ann; @@ -2872,11 +2839,6 @@ setup_pointers_and_addressables (struct alias_info *ai) /* Associate the tag with pointer VAR. */ set_symbol_mem_tag (var, tag); - - /* If pointer VAR has been used in a store operation, - then its memory tag must be marked as written-to. */ - if (pointer_set_contains (ai->dereferenced_ptrs_store, var)) - pointer_set_insert (ai->written_vars, tag); } else { @@ -3298,7 +3260,22 @@ get_smt_for (tree ptr, struct alias_info *ai) size_t i; tree tag; tree tag_type = TREE_TYPE (TREE_TYPE (ptr)); - alias_set_type tag_set = get_alias_set (tag_type); + alias_set_type tag_set; + + /* Get the alias set to be used for the pointed-to memory. If that + differs from what we would get from looking at the type adjust + the tag_type to void to make sure we get a proper alias set from + just looking at the SMT we create. */ + tag_set = get_alias_set (tag_type); + if (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (ptr)) + /* This is overly conservative but we do not want to assign + restrict alias sets here (which if they are not assigned + are -2 but still "known"). */ + || DECL_POINTER_ALIAS_SET_KNOWN_P (ptr)) + { + tag_set = 0; + tag_type = void_type_node; + } /* To avoid creating unnecessary memory tags, only create one memory tag per alias set class. Note that it may be tempting to group @@ -3329,7 +3306,8 @@ get_smt_for (tree ptr, struct alias_info *ai) artificial variable representing the memory location pointed-to by PTR. */ tag = symbol_mem_tag (ptr); - if (tag == NULL_TREE) + if (tag == NULL_TREE + || tag_set != get_alias_set (tag)) tag = create_memory_tag (tag_type, true); /* Add PTR to the POINTERS array. Note that we are not interested in diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 333ef828473..b19879f7909 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -719,30 +719,18 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, propagate the ADDR_EXPR into the use of NAME and fold the result. */ if (TREE_CODE (lhs) == INDIRECT_REF && TREE_OPERAND (lhs, 0) == name - && may_propagate_address_into_dereference (def_rhs, lhs)) + && may_propagate_address_into_dereference (def_rhs, lhs) + && (lhsp != gimple_assign_lhs_ptr (use_stmt) + || useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), + TREE_TYPE (rhs)))) { - bool valid = true; - if (lhsp == gimple_assign_lhs_ptr (use_stmt) - && !useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), - TREE_TYPE (rhs)) - && !CONVERT_EXPR_CODE_P (rhs_code)) - { - if (rhs_code == SSA_NAME) - gimple_assign_set_rhs_code (use_stmt, NOP_EXPR); - else - valid = false; - } - if (valid) - { - *lhsp = unshare_expr (TREE_OPERAND (def_rhs, 0)); - fold_stmt_inplace (use_stmt); - tidy_after_forward_propagate_addr (use_stmt); + *lhsp = unshare_expr (TREE_OPERAND (def_rhs, 0)); + fold_stmt_inplace (use_stmt); + tidy_after_forward_propagate_addr (use_stmt); - /* Continue propagating into the RHS if this was not the only - use. */ - if (single_use_p) - return true; - } + /* Continue propagating into the RHS if this was not the only use. */ + if (single_use_p) + return true; } /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 92d9c751aab..aa0472ea364 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -5323,11 +5323,15 @@ rewrite_use_compare (struct ivopts_data *data, { tree var = var_at_stmt (data->current_loop, cand, use->stmt); tree var_type = TREE_TYPE (var); + gimple_seq stmts; compare = iv_elimination_compare (data, use); bound = unshare_expr (fold_convert (var_type, bound)); - op = force_gimple_operand_gsi (&bsi, bound, true, NULL_TREE, - true, GSI_SAME_STMT); + op = force_gimple_operand (bound, &stmts, true, NULL_TREE); + if (stmts) + gsi_insert_seq_on_edge_immediate ( + loop_preheader_edge (data->current_loop), + stmts); gimple_cond_set_lhs (use->stmt, var); gimple_cond_set_code (use->stmt, compare); diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 33aacae83b5..13b10c9f1c4 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3053,7 +3053,7 @@ scev_probably_wraps_p (tree base, tree step, /* If we can use the fact that signed and pointer arithmetics does not wrap, we are done. */ - if (use_overflow_semantics && nowrap_type_p (type)) + if (use_overflow_semantics && nowrap_type_p (TREE_TYPE (base))) return false; /* To be able to use estimates on number of iterations of the loop, diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 80f7a92c3dc..e40681f9355 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2654,7 +2654,7 @@ start_over: usep = op_iter_init_use (&iter, defstmt, SSA_OP_ALL_USES); } else - iter.done = true; + clear_and_done_ssa_iter (&iter); while (1) { diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 11427ec69e2..3be76acf1b8 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -506,16 +506,6 @@ struct constraint_graph taken. Used for variable substitution. */ bitmap address_taken; - /* True if points_to bitmap for this node is stored in the hash - table. */ - sbitmap pt_used; - - /* Number of incoming edges remaining to be processed by pointer - equivalence. - Used for variable substitution. */ - unsigned int *number_incoming; - - /* Vector of complex constraints for each graph node. Complex constraints are those involving dereferences or offsets that are not 0. */ @@ -1101,11 +1091,8 @@ build_pred_graph (void) graph->points_to = XCNEWVEC (bitmap, graph->size); graph->eq_rep = XNEWVEC (int, graph->size); graph->direct_nodes = sbitmap_alloc (graph->size); - graph->pt_used = sbitmap_alloc (graph->size); graph->address_taken = BITMAP_ALLOC (&predbitmap_obstack); - graph->number_incoming = XCNEWVEC (unsigned int, graph->size); sbitmap_zero (graph->direct_nodes); - sbitmap_zero (graph->pt_used); for (j = 0; j < FIRST_REF_NODE; j++) { @@ -2008,11 +1995,6 @@ condense_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) bitmap_ior_into (graph->points_to[n], graph->points_to[w]); } - EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi) - { - unsigned int rep = si->node_mapping[i]; - graph->number_incoming[rep]++; - } } SET_BIT (si->deleted, n); } @@ -2041,21 +2023,10 @@ label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) /* Skip unused edges */ if (w == n || graph->pointer_label[w] == 0) - { - graph->number_incoming[w]--; - continue; - } + continue; + if (graph->points_to[w]) bitmap_ior_into(graph->points_to[n], graph->points_to[w]); - - /* If all incoming edges to w have been processed and - graph->points_to[w] was not stored in the hash table, we can - free it. */ - graph->number_incoming[w]--; - if (!graph->number_incoming[w] && !TEST_BIT (graph->pt_used, w)) - { - BITMAP_FREE (graph->points_to[w]); - } } /* Indirect nodes get fresh variables. */ if (!TEST_BIT (graph->direct_nodes, n)) @@ -2067,7 +2038,6 @@ label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) graph->points_to[n]); if (!label) { - SET_BIT (graph->pt_used, n); label = pointer_equiv_class++; equiv_class_add (pointer_equiv_class_table, label, graph->points_to[n]); @@ -2193,10 +2163,8 @@ free_var_substitution_info (struct scc_info *si) free (graph->loc_label); free (graph->pointed_by); free (graph->points_to); - free (graph->number_incoming); free (graph->eq_rep); sbitmap_free (graph->direct_nodes); - sbitmap_free (graph->pt_used); htab_delete (pointer_equiv_class_table); htab_delete (location_equiv_class_table); bitmap_obstack_release (&iteration_obstack); @@ -4592,6 +4560,15 @@ intra_create_variable_infos (void) make_constraint_from (p, nonlocal_id); } } + + /* Add a constraint for the incoming static chain parameter. */ + if (cfun->static_chain_decl != NULL_TREE) + { + varinfo_t p, chain_vi = get_vi_for_tree (cfun->static_chain_decl); + + for (p = chain_vi; p; p = p->next) + make_constraint_from (p, nonlocal_id); + } } /* Structure used to put solution bitmaps in a hashtable so they can diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 1e7538ab8a1..18c22e7eac7 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -5440,11 +5440,6 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, vec_oprnd = VEC_index (tree, result_chain, i); data_ref = build_fold_indirect_ref (dataref_ptr); - /* If accesses through a pointer to vectype do not alias the original - memory reference we have a problem. This should never happen. */ - gcc_assert (get_alias_set (data_ref) == get_alias_set (gimple_assign_lhs (stmt)) - || alias_set_subset_of (get_alias_set (data_ref), - get_alias_set (gimple_assign_lhs (stmt)))); /* Arguments are ready. Create the new vector stmt. */ new_stmt = gimple_build_assign (data_ref, vec_oprnd); @@ -6668,11 +6663,6 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, default: gcc_unreachable (); } - /* If accesses through a pointer to vectype do not alias the original - memory reference we have a problem. This should never happen. */ - gcc_assert (get_alias_set (data_ref) == get_alias_set (gimple_assign_rhs1 (stmt)) - || alias_set_subset_of (get_alias_set (data_ref), - get_alias_set (gimple_assign_rhs1 (stmt)))); vec_dest = vect_create_destination_var (scalar_dest, vectype); new_stmt = gimple_build_assign (vec_dest, data_ref); new_temp = make_ssa_name (vec_dest, new_stmt); diff --git a/gcc/varasm.c b/gcc/varasm.c index 4fe3c967032..7d6b86f6881 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6394,7 +6394,8 @@ default_internal_label (FILE *stream, const char *prefix, void default_file_start (void) { - if (targetm.file_start_app_off && !flag_verbose_asm) + if (targetm.file_start_app_off + && !(flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm)) fputs (ASM_APP_OFF, asm_out_file); if (targetm.file_start_file_directive) diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 1509523ea65..10dd1ebeb3d 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,10 @@ +2008-11-21 Eric Botcazou <ebotcazou@adacore.com> + + * src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for + signed/unsigned int8/16 return values. + * src/sparc/v8.S (ffi_call_v8): Likewise. + (ffi_closure_v8): Likewise. + 2008-09-26 Peter O'Gorman <pogma@thewrittenword.com> Steve Ellcey <sje@cup.hp.com> diff --git a/libffi/src/sparc/ffi.c b/libffi/src/sparc/ffi.c index a10fe811dad..fea0330e4e6 100644 --- a/libffi/src/sparc/ffi.c +++ b/libffi/src/sparc/ffi.c @@ -307,14 +307,24 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) cif->flags = FFI_TYPE_STRUCT; break; + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = cif->rtype->type; + break; + case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: - if (cif->abi != FFI_V9) - { - cif->flags = FFI_TYPE_SINT64; - break; - } - /* FALLTHROUGH */ + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = FFI_TYPE_SINT64; + break; + default: cif->flags = FFI_TYPE_INT; break; diff --git a/libffi/src/sparc/v8.S b/libffi/src/sparc/v8.S index 1d7bfa51daa..38307599bf5 100644 --- a/libffi/src/sparc/v8.S +++ b/libffi/src/sparc/v8.S @@ -72,21 +72,63 @@ _ffi_call_v8: be,a done st %f0, [%i4+0] ! (delay) + cmp %i3, FFI_TYPE_DOUBLE + be,a double + st %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_SINT8 + be,a sint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT8 + be,a uint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_SINT16 + be,a sint16 + sll %o0, 16, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT16 + be,a uint16 + sll %o0, 16, %o0 ! (delay) + cmp %i3, FFI_TYPE_SINT64 - be longlong + be,a longlong + st %o0, [%i4+0] ! (delay) +done: + ret + restore - cmp %i3, FFI_TYPE_DOUBLE - bne done - nop - st %f0, [%i4+0] +double: st %f1, [%i4+4] - -done: ret restore -longlong: +sint8: + sra %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +uint8: + srl %o0, 24, %o0 st %o0, [%i4+0] + ret + restore + +sint16: + sra %o0, 16, %o0 + st %o0, [%i4+0] + ret + restore + +uint16: + srl %o0, 16, %o0 + st %o0, [%i4+0] + ret + restore + +longlong: st %o1, [%i4+4] ret restore @@ -147,7 +189,8 @@ ffi_closure_v8: be done1 cmp %o0, FFI_TYPE_INT - be integer + be done1 + ld [%fp-8], %i0 cmp %o0, FFI_TYPE_FLOAT be,a done1 @@ -165,13 +208,11 @@ ffi_closure_v8: cmp %o0, FFI_TYPE_STRUCT be done2 - ! FFI_TYPE_SINT64 - ! FFI_TYPE_UINT64 - ld [%fp-4], %i1 + cmp %o0, FFI_TYPE_SINT64 + be,a done1 + ldd [%fp-8], %i0 -integer: ld [%fp-8], %i0 - done1: jmp %i7+8 restore diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index f73b8c7c89c..dd079c227eb 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,15 @@ +2008-11-20 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + PR bootstrap/33100 + * configure.ac (i?86-*-solaris2.1[0-9]*): Only include + i386/t-crtstuff if linker supports ZERO terminator unwind entries. + * configure: Regenerate. + * config.host (i[34567]86-*-solaris2*): Move i386/t-sol2 in + tmake_file here from gcc/config.gcc. + Move extra_parts here from gcc/config.gcc. + * config/i386/t-sol2: Move here from gcc/config/i386. + Use gcc_srcdir instead of srcdir. + 2008-11-18 Adam Nemet <anemet@caviumnetworks.com> * config.host (mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*): New diff --git a/libgcc/config.host b/libgcc/config.host index 747fd7e336b..f85f3cf32b4 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -318,6 +318,17 @@ i[34567]86-*-nto-qnx*) i[34567]86-*-rtems*) ;; i[34567]86-*-solaris2*) + tmake_file="${tmake_file} i386/t-sol2" + case ${host} in + *-*-solaris2.1[0-9]*) + # Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as + # part of the base system. + extra_parts="gmon.o crtbegin.o crtend.o" + ;; + *) + extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" + ;; + esac ;; i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae) ;; diff --git a/gcc/config/i386/t-sol2 b/libgcc/config/i386/t-sol2 index 0eec96f1f05..24b7c7c10f4 100644 --- a/gcc/config/i386/t-sol2 +++ b/libgcc/config/i386/t-sol2 @@ -1,23 +1,23 @@ # gmon build rule: -$(T)gmon.o: $(srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) +$(T)gmon.o: $(gcc_srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \ - -c $(srcdir)/config/i386/gmon-sol2.c -o $(T)gmon.o + -c $(gcc_srcdir)/config/i386/gmon-sol2.c -o $(T)gmon.o # Assemble startup files. # Apparently Sun believes that assembler files don't need comments, because no # single ASCII character is valid (tried them all). So we manually strip out # the comments with sed. This bug may only be in the Early Access releases. -$(T)gcrt1.o: $(srcdir)/config/i386/sol2-gc1.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-gc1.asm >gcrt1.s +$(T)gcrt1.o: $(gcc_srcdir)/config/i386/sol2-gc1.asm $(GCC_PASSES) + sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-gc1.asm >gcrt1.s $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)gcrt1.o gcrt1.s -$(T)crt1.o: $(srcdir)/config/i386/sol2-c1.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-c1.asm >crt1.s +$(T)crt1.o: $(gcc_srcdir)/config/i386/sol2-c1.asm $(GCC_PASSES) + sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-c1.asm >crt1.s $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o crt1.s -$(T)crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s +$(T)crti.o: $(gcc_srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) + sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-ci.asm >crti.s $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o crti.s -$(T)crtn.o: $(srcdir)/config/i386/sol2-cn.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-cn.asm >crtn.s +$(T)crtn.o: $(gcc_srcdir)/config/i386/sol2-cn.asm $(GCC_PASSES) + sed -e '/^!/d' <$(gcc_srcdir)/config/i386/sol2-cn.asm >crtn.s $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o crtn.s # We need to use -fPIC when we are using gcc to compile the routines in diff --git a/libgcc/configure b/libgcc/configure index 75bf9034b1a..6315ecd5cbc 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -3420,6 +3420,31 @@ esac # Collect host-machine-specific information. . ${srcdir}/config.host +# Check if Solaris/x86 linker supports ZERO terminator unwind entries. +# This is after config.host so we can augment tmake_file. +# Link with -nostartfiles -nodefaultlibs since neither are present while +# building libgcc. +case ${host} in +i?86-*-solaris2.1[0-9]*) + cat > conftest.s <<EOF + .section .eh_frame,"a",@unwind + .zero 4 + .section .jcr,"aw",@progbits + .zero 8 +EOF + if { ac_try='${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # configure expects config files in libgcc/config, so need a relative + # path here. + tmake_file="${tmake_file} ../../gcc/config/i386/t-crtstuff" + fi + ;; +esac + # Check for visibility support. This is after config.host so that # we can check for asm_hidden_op. echo "$as_me:$LINENO: checking for __attribute__((visibility(\"hidden\")))" >&5 diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 1238d742450..d48bccce065 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -171,6 +171,26 @@ esac # Collect host-machine-specific information. . ${srcdir}/config.host +# Check if Solaris/x86 linker supports ZERO terminator unwind entries. +# This is after config.host so we can augment tmake_file. +# Link with -nostartfiles -nodefaultlibs since neither are present while +# building libgcc. +case ${host} in +i?86-*-solaris2.1[[0-9]]*) + cat > conftest.s <<EOF + .section .eh_frame,"a",@unwind + .zero 4 + .section .jcr,"aw",@progbits + .zero 8 +EOF + if AC_TRY_COMMAND(${CC-cc} -shared -nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD); then + # configure expects config files in libgcc/config, so need a relative + # path here. + tmake_file="${tmake_file} ../../gcc/config/i386/t-crtstuff" + fi + ;; +esac + # Check for visibility support. This is after config.host so that # we can check for asm_hidden_op. AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 95f526a5374..36c0098cab2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,74 @@ +2008-11-23 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/38234 + * intrinsics/reshape_generic.c (reshape_internal): + Source can be larger than shape. + * m4/reshape.m4: Likewise. + * generated/reshape_c10.c Regenerated. + * generated/reshape_c16.c Regenerated. + * generated/reshape_c4.c Regenerated. + * generated/reshape_c8.c Regenerated. + * generated/reshape_i16.c Regenerated. + * generated/reshape_i4.c Regenerated. + * generated/reshape_i8.c Regenerated. + * generated/reshape_r10.c Regenerated. + * generated/reshape_r16.c Regenerated. + * generated/reshape_r4.c Regenerated. + * generated/reshape_r8.c Regenerated. + +2008-11-22 Danny Smith <dannysmith@users.sourceforge.net> + + * libgfortran.h (__mingw_snprintf): Declare with gnu_printf + format attribute. + + +2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/38225 + * intrinsics/reshape_generic.c (reshape_internal): + Use all dimensions of source for bounds checking. + * m4/reshape.m4: Likewise. + * generated/reshape_c10.c Regenerated. + * generated/reshape_c16.c Regenerated. + * generated/reshape_c4.c Regenerated. + * generated/reshape_c8.c Regenerated. + * generated/reshape_i16.c Regenerated. + * generated/reshape_i4.c Regenerated. + * generated/reshape_i8.c Regenerated. + * generated/reshape_r10.c Regenerated. + * generated/reshape_r16.c Regenerated. + * generated/reshape_r4.c Regenerated. + * generated/reshape_r8.c Regenerated. + +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/37839 + * io/io.h (IOPARM_INQUIRE_HAS_ROUND, IOPARM_INQUIRE_HAS_SIGN, + IOPARM_INQUIRE_HAS_PENDING): Adjust values. + (st_parameter_inquire): Reorder and fix types of round, sign and + pending fields. + (st_parameter_43, st_parameter_44): Removed. + (st_parameter_dt): Put back struct definition directly to u.p + declaration. Change type of u.p.size_used from gfc_offset to + GFC_IO_INT. Decrease back size of u.pad to 16 pointers and + 32 ints. Put id, pos, asynchronous, blank, decimal, delim, + pad, round and sign fields after the union. + * io/inquire.c (inquire_via_unit, inquire_via_filename): Only read + flags2 if it is defined. + * io/transfer.c (read_sf, read_block_form, write_block): Cast + additions to size_used to GFC_IO_INT instead of gfc_offset. + (data_transfer_init): Clear whole u.p struct. Adjust + for moving id, pos, asynchronous, blank, decimal, delim, pad, + round and sign fields from u.p directly into st_parameter_dt. + (finalize_transfer): Don't cast size_used to GFC_IO_INT. + * io/file_pos.c (st_endfile): Clear whole u.p struct. + +2008-11-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/37472 + * io/write_float.def (output_float_FMT_G_): Adjust conversion of + G format specification to F format. + 2008-11-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/38135 diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 076ea592130..53e59dbda84 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -119,6 +119,37 @@ reshape_c10 (gfc_array_c10 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_c10 (gfc_array_c10 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_c10 (gfc_array_c10 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_COMPLEX_10); diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 968fb9c34ce..19cfdfcc31c 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -119,6 +119,37 @@ reshape_c16 (gfc_array_c16 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_c16 (gfc_array_c16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_c16 (gfc_array_c16 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_COMPLEX_16); diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 00c95e7787c..64156d938ea 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -119,6 +119,37 @@ reshape_c4 (gfc_array_c4 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_c4 (gfc_array_c4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_c4 (gfc_array_c4 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_COMPLEX_4); diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 9d355a51370..5ba646ce112 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -119,6 +119,37 @@ reshape_c8 (gfc_array_c8 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_c8 (gfc_array_c8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_c8 (gfc_array_c8 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_COMPLEX_8); diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index 28885115569..81223eae670 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -119,6 +119,37 @@ reshape_16 (gfc_array_i16 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_16 (gfc_array_i16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_16 (gfc_array_i16 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_INTEGER_16); diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 021ecfbc314..911f2d7a902 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -119,6 +119,37 @@ reshape_4 (gfc_array_i4 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_4 (gfc_array_i4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_4 (gfc_array_i4 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_INTEGER_4); diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 9a2ce8d45dd..b5f9c1e19fc 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -119,6 +119,37 @@ reshape_8 (gfc_array_i8 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_8 (gfc_array_i8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_8 (gfc_array_i8 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_INTEGER_8); diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index 100173f70d0..57dca1aa888 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -119,6 +119,37 @@ reshape_r10 (gfc_array_r10 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_r10 (gfc_array_r10 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_r10 (gfc_array_r10 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_REAL_10); diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 8a344e0b6ba..4509df5b2bb 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -119,6 +119,37 @@ reshape_r16 (gfc_array_r16 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_r16 (gfc_array_r16 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_r16 (gfc_array_r16 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_REAL_16); diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index ea8c24a2b66..c9135577cbd 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -119,6 +119,37 @@ reshape_r4 (gfc_array_r4 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_r4 (gfc_array_r4 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_r4 (gfc_array_r4 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_REAL_4); diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index d8855e7874e..33ce1f0bfbb 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -119,6 +119,37 @@ reshape_r8 (gfc_array_r8 * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -135,9 +166,16 @@ reshape_r8 (gfc_array_r8 * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -212,37 +250,6 @@ reshape_r8 (gfc_array_r8 * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof (GFC_REAL_8); diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 04b87271e9b..e1cc92abaf1 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -108,6 +108,37 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -124,9 +155,16 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -199,37 +237,6 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= size; diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c index 25b0108eef4..4054b3a5bb1 100644 --- a/libgfortran/io/file_pos.c +++ b/libgfortran/io/file_pos.c @@ -300,7 +300,7 @@ st_endfile (st_parameter_filepos *fpp) { st_parameter_dt dtp; dtp.common = fpp->common; - memset (&dtp.u.p.transfer, 0, sizeof (dtp.u.q)); + memset (&dtp.u.p, 0, sizeof (dtp.u.p)); dtp.u.p.current_unit = u; next_record (&dtp, 1); } diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 3b5f3f74473..4134f166202 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -43,7 +43,6 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) { const char *p; GFC_INTEGER_4 cf = iqp->common.flags; - GFC_INTEGER_4 cf2 = iqp->flags2; if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0) { @@ -254,6 +253,8 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) if (cf & IOPARM_INQUIRE_HAS_FLAGS2) { + GFC_INTEGER_4 cf2 = iqp->flags2; + if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0) *iqp->pending = 0; @@ -525,7 +526,6 @@ inquire_via_filename (st_parameter_inquire *iqp) { const char *p; GFC_INTEGER_4 cf = iqp->common.flags; - GFC_INTEGER_4 cf2 = iqp->flags2; if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0) *iqp->exist = file_exists (iqp->file, iqp->file_len); @@ -586,6 +586,8 @@ inquire_via_filename (st_parameter_inquire *iqp) if (cf & IOPARM_INQUIRE_HAS_FLAGS2) { + GFC_INTEGER_4 cf2 = iqp->flags2; + if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0) cf_strcpy (iqp->encoding, iqp->encoding_len, undefined); diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index ec37be37a81..1f363914866 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -310,9 +310,9 @@ st_parameter_filepos; #define IOPARM_INQUIRE_HAS_ASYNCHRONOUS (1 << 0) #define IOPARM_INQUIRE_HAS_DECIMAL (1 << 1) #define IOPARM_INQUIRE_HAS_ENCODING (1 << 2) -#define IOPARM_INQUIRE_HAS_PENDING (1 << 3) -#define IOPARM_INQUIRE_HAS_ROUND (1 << 4) -#define IOPARM_INQUIRE_HAS_SIGN (1 << 5) +#define IOPARM_INQUIRE_HAS_ROUND (1 << 3) +#define IOPARM_INQUIRE_HAS_SIGN (1 << 4) +#define IOPARM_INQUIRE_HAS_PENDING (1 << 5) #define IOPARM_INQUIRE_HAS_SIZE (1 << 6) #define IOPARM_INQUIRE_HAS_ID (1 << 7) @@ -343,9 +343,9 @@ typedef struct CHARACTER1 (asynchronous); CHARACTER2 (decimal); CHARACTER1 (encoding); - CHARACTER2 (pending); - CHARACTER1 (round); - CHARACTER2 (sign); + CHARACTER2 (round); + CHARACTER1 (sign); + GFC_INTEGER_4 *pending; GFC_INTEGER_4 *size; GFC_INTEGER_4 *id; } @@ -377,172 +377,6 @@ struct format_data; #define IOPARM_DT_IONML_SET (1 << 31) -typedef struct st_parameter_43 -{ - void (*transfer) (struct st_parameter_dt *, bt, void *, int, - size_t, size_t); - struct gfc_unit *current_unit; - /* Item number in a formatted data transfer. Also used in namelist - read_logical as an index into line_buffer. */ - int item_count; - unit_mode mode; - unit_blank blank_status; - unit_sign sign_status; - int scale_factor; - int max_pos; /* Maximum righthand column written to. */ - /* Number of skips + spaces to be done for T and X-editing. */ - int skips; - /* Number of spaces to be done for T and X-editing. */ - int pending_spaces; - /* Whether an EOR condition was encountered. Value is: - 0 if no EOR was encountered - 1 if an EOR was encountered due to a 1-byte marker (LF) - 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */ - int sf_seen_eor; - unit_advance advance_status; - unsigned reversion_flag : 1; /* Format reversion has occurred. */ - unsigned first_item : 1; - unsigned seen_dollar : 1; - unsigned eor_condition : 1; - unsigned no_leading_blank : 1; - unsigned char_flag : 1; - unsigned input_complete : 1; - unsigned at_eol : 1; - unsigned comma_flag : 1; - /* A namelist specific flag used in the list directed library - to flag that calls are being made from namelist read (eg. to - ignore comments or to treat '/' as a terminator) */ - unsigned namelist_mode : 1; - /* A namelist specific flag used in the list directed library - to flag read errors and return, so that an attempt can be - made to read a new object name. */ - unsigned nml_read_error : 1; - /* A sequential formatted read specific flag used to signal that a - character string is being read so don't use commas to shorten a - formatted field width. */ - unsigned sf_read_comma : 1; - /* A namelist specific flag used to enable reading input from - line_buffer for logical reads. */ - unsigned line_buffer_enabled : 1; - /* An internal unit specific flag used to identify that the associated - unit is internal. */ - unsigned unit_is_internal : 1; - /* An internal unit specific flag to signify an EOF condition for list - directed read. */ - unsigned at_eof : 1; - /* 16 unused bits. */ - - char last_char; - char nml_delim; - - int repeat_count; - int saved_length; - int saved_used; - bt saved_type; - char *saved_string; - char *scratch; - char *line_buffer; - struct format_data *fmt; - jmp_buf *eof_jump; - namelist_info *ionml; - /* A flag used to identify when a non-standard expanded namelist read - has occurred. */ - int expanded_read; - /* Storage area for values except for strings. Must be large - enough to hold a complex value (two reals) of the largest - kind. */ - char value[32]; - gfc_offset size_used; -} st_parameter_43; - - -typedef struct st_parameter_44 -{ - GFC_INTEGER_4 *id; - GFC_IO_INT pos; - CHARACTER1 (asynchronous); - CHARACTER2 (blank); - CHARACTER1 (decimal); - CHARACTER2 (delim); - CHARACTER1 (pad); - CHARACTER2 (round); - CHARACTER1 (sign); - void (*transfer) (struct st_parameter_dt *, bt, void *, int, - size_t, size_t); - struct gfc_unit *current_unit; - /* Item number in a formatted data transfer. Also used in namelist - read_logical as an index into line_buffer. */ - int item_count; - unit_mode mode; - unit_blank blank_status; - unit_sign sign_status; - int scale_factor; - int max_pos; /* Maximum righthand column written to. */ - /* Number of skips + spaces to be done for T and X-editing. */ - int skips; - /* Number of spaces to be done for T and X-editing. */ - int pending_spaces; - /* Whether an EOR condition was encountered. Value is: - 0 if no EOR was encountered - 1 if an EOR was encountered due to a 1-byte marker (LF) - 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */ - int sf_seen_eor; - unit_advance advance_status; - unsigned reversion_flag : 1; /* Format reversion has occurred. */ - unsigned first_item : 1; - unsigned seen_dollar : 1; - unsigned eor_condition : 1; - unsigned no_leading_blank : 1; - unsigned char_flag : 1; - unsigned input_complete : 1; - unsigned at_eol : 1; - unsigned comma_flag : 1; - /* A namelist specific flag used in the list directed library - to flag that calls are being made from namelist read (eg. to - ignore comments or to treat '/' as a terminator) */ - unsigned namelist_mode : 1; - /* A namelist specific flag used in the list directed library - to flag read errors and return, so that an attempt can be - made to read a new object name. */ - unsigned nml_read_error : 1; - /* A sequential formatted read specific flag used to signal that a - character string is being read so don't use commas to shorten a - formatted field width. */ - unsigned sf_read_comma : 1; - /* A namelist specific flag used to enable reading input from - line_buffer for logical reads. */ - unsigned line_buffer_enabled : 1; - /* An internal unit specific flag used to identify that the associated - unit is internal. */ - unsigned unit_is_internal : 1; - /* An internal unit specific flag to signify an EOF condition for list - directed read. */ - unsigned at_eof : 1; - /* 16 unused bits. */ - - char last_char; - char nml_delim; - - int repeat_count; - int saved_length; - int saved_used; - bt saved_type; - char *saved_string; - char *scratch; - char *line_buffer; - struct format_data *fmt; - jmp_buf *eof_jump; - namelist_info *ionml; - /* A flag used to identify when a non-standard expanded namelist read - has occurred. */ - int expanded_read; - /* Storage area for values except for strings. Must be large - enough to hold a complex value (two reals) of the largest - kind. */ - char value[32]; - gfc_offset size_used; -} st_parameter_44; - typedef struct st_parameter_dt { st_parameter_common common; @@ -557,13 +391,97 @@ typedef struct st_parameter_dt to reserve enough space. */ union { - st_parameter_43 q; - st_parameter_44 p; + struct + { + void (*transfer) (struct st_parameter_dt *, bt, void *, int, + size_t, size_t); + struct gfc_unit *current_unit; + /* Item number in a formatted data transfer. Also used in namelist + read_logical as an index into line_buffer. */ + int item_count; + unit_mode mode; + unit_blank blank_status; + unit_sign sign_status; + int scale_factor; + int max_pos; /* Maximum righthand column written to. */ + /* Number of skips + spaces to be done for T and X-editing. */ + int skips; + /* Number of spaces to be done for T and X-editing. */ + int pending_spaces; + /* Whether an EOR condition was encountered. Value is: + 0 if no EOR was encountered + 1 if an EOR was encountered due to a 1-byte marker (LF) + 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */ + int sf_seen_eor; + unit_advance advance_status; + unsigned reversion_flag : 1; /* Format reversion has occurred. */ + unsigned first_item : 1; + unsigned seen_dollar : 1; + unsigned eor_condition : 1; + unsigned no_leading_blank : 1; + unsigned char_flag : 1; + unsigned input_complete : 1; + unsigned at_eol : 1; + unsigned comma_flag : 1; + /* A namelist specific flag used in the list directed library + to flag that calls are being made from namelist read (eg. to + ignore comments or to treat '/' as a terminator) */ + unsigned namelist_mode : 1; + /* A namelist specific flag used in the list directed library + to flag read errors and return, so that an attempt can be + made to read a new object name. */ + unsigned nml_read_error : 1; + /* A sequential formatted read specific flag used to signal that a + character string is being read so don't use commas to shorten a + formatted field width. */ + unsigned sf_read_comma : 1; + /* A namelist specific flag used to enable reading input from + line_buffer for logical reads. */ + unsigned line_buffer_enabled : 1; + /* An internal unit specific flag used to identify that the associated + unit is internal. */ + unsigned unit_is_internal : 1; + /* An internal unit specific flag to signify an EOF condition for list + directed read. */ + unsigned at_eof : 1; + /* 16 unused bits. */ + + char last_char; + char nml_delim; + + int repeat_count; + int saved_length; + int saved_used; + bt saved_type; + char *saved_string; + char *scratch; + char *line_buffer; + struct format_data *fmt; + jmp_buf *eof_jump; + namelist_info *ionml; + /* A flag used to identify when a non-standard expanded namelist read + has occurred. */ + int expanded_read; + /* Storage area for values except for strings. Must be large + enough to hold a complex value (two reals) of the largest + kind. */ + char value[32]; + GFC_IO_INT size_used; + } p; /* This pad size must be equal to the pad_size declared in trans-io.c (gfc_build_io_library_fndecls). The above structure must be smaller or equal to this array. */ - char pad[32 * sizeof (char *) + 32 * sizeof (int)]; + char pad[16 * sizeof (char *) + 32 * sizeof (int)]; } u; + GFC_INTEGER_4 *id; + GFC_IO_INT pos; + CHARACTER1 (asynchronous); + CHARACTER2 (blank); + CHARACTER1 (decimal); + CHARACTER2 (delim); + CHARACTER1 (pad); + CHARACTER2 (round); + CHARACTER1 (sign); } st_parameter_dt; diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 500cce95e40..c4fae32bead 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -300,7 +300,7 @@ read_sf (st_parameter_dt *dtp, int *length, int no_error) dtp->u.p.current_unit->bytes_left -= *length; if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) - dtp->u.p.size_used += (gfc_offset) *length; + dtp->u.p.size_used += (GFC_IO_INT) *length; return base; } @@ -377,7 +377,7 @@ read_block_form (st_parameter_dt *dtp, void *buf, size_t *nbytes) } if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) - dtp->u.p.size_used += (gfc_offset) nread; + dtp->u.p.size_used += (GFC_IO_INT) nread; if (nread != *nbytes) { /* Short read, this shouldn't happen. */ @@ -625,7 +625,7 @@ write_block (st_parameter_dt *dtp, int length) } if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) - dtp->u.p.size_used += (gfc_offset) length; + dtp->u.p.size_used += (GFC_IO_INT) length; dtp->u.p.current_unit->strm_pos += (gfc_offset) length; @@ -1829,11 +1829,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ionml = ((cf & IOPARM_DT_IONML_SET) != 0) ? dtp->u.p.ionml : NULL; - /* To maintain ABI, &transfer is the start of the private memory area in - in st_parameter_dt. Memory from the beginning of the structure to this - point is set by the front end and must not be touched. The number of - bytes to clear must stay within the sizeof q to avoid over-writing. */ - memset (&dtp->u.p.transfer, 0, sizeof (dtp->u.q)); + memset (&dtp->u.p, 0, sizeof (dtp->u.p)); dtp->u.p.ionml = ionml; dtp->u.p.mode = read_flag ? READING : WRITING; @@ -2077,7 +2073,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) /* Check the decimal mode. */ dtp->u.p.current_unit->decimal_status = !(cf & IOPARM_DT_HAS_DECIMAL) ? DECIMAL_UNSPECIFIED : - find_option (&dtp->common, dtp->u.p.decimal, dtp->u.p.decimal_len, + find_option (&dtp->common, dtp->decimal, dtp->decimal_len, decimal_opt, "Bad DECIMAL parameter in data transfer " "statement"); @@ -2087,7 +2083,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) /* Check the sign mode. */ dtp->u.p.sign_status = !(cf & IOPARM_DT_HAS_SIGN) ? SIGN_UNSPECIFIED : - find_option (&dtp->common, dtp->u.p.sign, dtp->u.p.sign_len, sign_opt, + find_option (&dtp->common, dtp->sign, dtp->sign_len, sign_opt, "Bad SIGN parameter in data transfer statement"); if (dtp->u.p.sign_status == SIGN_UNSPECIFIED) @@ -2096,7 +2092,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) /* Check the blank mode. */ dtp->u.p.blank_status = !(cf & IOPARM_DT_HAS_BLANK) ? BLANK_UNSPECIFIED : - find_option (&dtp->common, dtp->u.p.blank, dtp->u.p.blank_len, + find_option (&dtp->common, dtp->blank, dtp->blank_len, blank_opt, "Bad BLANK parameter in data transfer statement"); @@ -2106,7 +2102,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) /* Check the delim mode. */ dtp->u.p.current_unit->delim_status = !(cf & IOPARM_DT_HAS_DELIM) ? DELIM_UNSPECIFIED : - find_option (&dtp->common, dtp->u.p.delim, dtp->u.p.delim_len, + find_option (&dtp->common, dtp->delim, dtp->delim_len, delim_opt, "Bad DELIM parameter in data transfer statement"); if (dtp->u.p.current_unit->delim_status == DELIM_UNSPECIFIED) @@ -2115,7 +2111,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) /* Check the pad mode. */ dtp->u.p.current_unit->pad_status = !(cf & IOPARM_DT_HAS_PAD) ? PAD_UNSPECIFIED : - find_option (&dtp->common, dtp->u.p.pad, dtp->u.p.pad_len, pad_opt, + find_option (&dtp->common, dtp->pad, dtp->pad_len, pad_opt, "Bad PAD parameter in data transfer statement"); if (dtp->u.p.current_unit->pad_status == PAD_UNSPECIFIED) @@ -2858,7 +2854,7 @@ finalize_transfer (st_parameter_dt *dtp) GFC_INTEGER_4 cf = dtp->common.flags; if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) - *dtp->size = (GFC_IO_INT) dtp->u.p.size_used; + *dtp->size = dtp->u.p.size_used; if (dtp->u.p.eor_condition) { diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index d55e3799946..8bb4123084f 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -652,7 +652,10 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \ low = mid + 1;\ }\ else\ - break;\ + {\ + mid++;\ + break;\ + }\ }\ \ if (e < 0)\ diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index d1a7df93ecd..aaa466713ea 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -113,7 +113,7 @@ typedef off_t gfc_offset; __mingw_snprintf(), because the mingw headers currently don't have one. */ #if HAVE_MINGW_SNPRINTF extern int __mingw_snprintf (char *, size_t, const char *, ...) - __attribute__ ((format (printf, 3, 4))); + __attribute__ ((format (gnu_printf, 3, 4))); #undef snprintf #define snprintf __mingw_snprintf #endif diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4 index b7e321e3bb4..53a626e1cee 100644 --- a/libgfortran/m4/reshape.m4 +++ b/libgfortran/m4/reshape.m4 @@ -123,6 +123,37 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, if (shape_empty) return; + if (pad) + { + pdim = GFC_DESCRIPTOR_RANK (pad); + psize = 1; + pempty = 0; + for (n = 0; n < pdim; n++) + { + pcount[n] = 0; + pstride[n] = pad->dim[n].stride; + pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + if (pextent[n] <= 0) + { + pempty = 1; + pextent[n] = 0; + } + + if (psize == pstride[n]) + psize *= pextent[n]; + else + psize = 0; + } + pptr = pad->data; + } + else + { + pdim = 0; + psize = 1; + pempty = 1; + pptr = NULL; + } + if (unlikely (compile_options.bounds_check)) { index_type ret_extent, source_extent; @@ -139,9 +170,16 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, (long int) ret_extent, (long int) shape_data[n]); } - source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + source_extent = 1; + sdim = GFC_DESCRIPTOR_RANK (source); + for (n = 0; n < sdim; n++) + { + index_type se; + se = source->dim[n].ubound + 1 - source->dim[0].lbound; + source_extent *= se > 0 ? se : 0; + } - if (rs < source_extent || (rs > source_extent && !pad)) + if (rs > source_extent && (!pad || pempty)) runtime_error("Incorrect size in SOURCE argument to RESHAPE" " intrinsic: is %ld, should be %ld", (long int) source_extent, (long int) rs); @@ -216,37 +254,6 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, ssize = 0; } - if (pad) - { - pdim = GFC_DESCRIPTOR_RANK (pad); - psize = 1; - pempty = 0; - for (n = 0; n < pdim; n++) - { - pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; - if (pextent[n] <= 0) - { - pempty = 1; - pextent[n] = 0; - } - - if (psize == pstride[n]) - psize *= pextent[n]; - else - psize = 0; - } - pptr = pad->data; - } - else - { - pdim = 0; - psize = 1; - pempty = 1; - pptr = NULL; - } - if (rsize != 0 && ssize != 0 && psize != 0) { rsize *= sizeof ('rtype_name`); diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ed7b7a1683a..0cdfba6d83f 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2008-11-26 Janis Johnson <janis187@us.ibm.com> + + PR testsuite/28870 + * testsuite/lib/libgomp.exp: Include new timeout library files. + (libgomp_target_compile): Set timeout value from new proc. + 2008-11-13 Steve Ellcey <sje@cup.hp.com> PR libgomp/37938 diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index f86f1a18ed0..4e2600ec5f7 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -22,6 +22,8 @@ load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp load_gcc_lib gcc-defs.exp load_gcc_lib torture-options.exp +load_gcc_lib timeout.exp +load_gcc_lib timeout-dg.exp load_gcc_lib gcc-dg.exp load_gcc_lib gfortran-dg.exp @@ -180,6 +182,7 @@ proc libgomp_target_compile { source dest type options } { } lappend options "additional_flags=[libio_include_flags]" + lappend options "timeout=[timeout_value]" lappend options "compiler=$GCC_UNDER_TEST" set options [concat $libgomp_compile_options $options] diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index 208ab8fb99b..c75648e22d3 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,3 +1,12 @@ +2008-11-26 Janis Johnson <janis187@us.ibm.com> + + PR testsuite/28870 + * testsuite/lib/mfdg.exp (dg-test): Use new timeout support. + (dg-timeout): Remove. + (standard-wait): Remove. + * testsuite/lib/libmudflap.exp: Include new timeout library files. + (libmudflap_target_compile): Set timeout value from new proc. + 2008-11-10 Jakub Jelinek <jakub@redhat.com> PR middle-end/35314 diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp index 94d060b3c75..1abd783c510 100644 --- a/libmudflap/testsuite/lib/libmudflap.exp +++ b/libmudflap/testsuite/lib/libmudflap.exp @@ -29,6 +29,8 @@ proc load_gcc_lib { filename } { load_lib mfdg.exp load_lib libgloss.exp load_gcc_lib target-libpath.exp +load_gcc_lib timeout.exp +load_gcc_lib timeout-dg.exp proc libmudflap-init { language } { global env @@ -213,6 +215,7 @@ proc libmudflap_target_compile { source dest type options } { set cxx_final [concat $cxx_final $libs] lappend options "compiler=$cxx_final" + lappend options "timeout=[timeout_value]" # Picks up the freshly-built testsuite library corresponding to the # multilib under test. diff --git a/libmudflap/testsuite/lib/mfdg.exp b/libmudflap/testsuite/lib/mfdg.exp index 7bcd44a94c1..68702994675 100644 --- a/libmudflap/testsuite/lib/mfdg.exp +++ b/libmudflap/testsuite/lib/mfdg.exp @@ -40,8 +40,7 @@ proc dg-test { args } { set keep 0 set i 0 set dg-repetitions 1 ;# may be overridden by { dg-repetitions N } - global dg-timeout - set dg-timeout 0 ;# likewise by { dg-timeout N } + unset_timeout_vars if { [string index [lindex $args 0] 0] == "-" } { for { set i 0 } { $i < [llength $args] } { incr i } { @@ -347,31 +346,3 @@ proc dg-repetitions { line value } { upvar dg-repetitions repetitions set repetitions $value } - - -# -# Indicate that this test case is to be run with a short timeout. -# The embedded format is "{ dg-timeout N }", where N is in seconds. -# -proc dg-timeout { line value } { - global dg-timeout - set dg-timeout $value -} - - -# dejagnu's config/unix.exp hard-codes 300 seconds as the timeout -# for any natively run executable. That's too long for tests run -# multiple times and that may possibly hang. So we override it here -# to provide some degree of control. -rename standard_wait hooked_standard_wait -proc standard_wait { dest timeout } { - global dg-timeout - if {[info exists dg-timeout]} { - if {${dg-timeout} > 0} { - verbose -log "Overriding timeout = ${dg-timeout}" - set timeout ${dg-timeout} - } - } - - hooked_standard_wait $dest $timeout -} diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 40cbd012c0f..a3330eefdcd 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,15 @@ +2008-11-21 Kai Tietz <kai.tietz@onevision.com> + + * Object.m (errno): Replaced by errno.h include. + (compare): Cast self to id to prevent warning on comparison. + * objc/objc.h (BOOL): Prevent redeclaration of BOOL, if it is + already there. + * sendmsg.c (__objc_print_dtable_stats): Remove type warnings. + * thr-win32.c (__objc_thread_detach): Remove type warning. + (__objc_thread_id): Likewise. + * thr.c (__objc_thread_detach_functiont): Add __builtin_trap () + for noreturn. + 2008-09-26 Peter O'Gorman <pogma@thewrittenword.com> Steve Ellcey <sje@cup.hp.com> diff --git a/libobjc/Object.m b/libobjc/Object.m index 1830acf4502..38016085b4f 100644 --- a/libobjc/Object.m +++ b/libobjc/Object.m @@ -25,12 +25,11 @@ Boston, MA 02110-1301, USA. */ executable file might be covered by the GNU General Public License. */ #include <stdarg.h> +#include <errno.h> #include "objc/Object.h" #include "objc/Protocol.h" #include "objc/objc-api.h" -extern int errno; - #define MAX_CLASS_NAME_LEN 256 @implementation Object @@ -121,7 +120,7 @@ extern int errno; return 0; // Ordering objects by their address is pretty useless, // so subclasses should override this is some useful way. - else if (self > anotherObject) + else if ((id)self > anotherObject) return 1; else return -1; diff --git a/libobjc/objc/objc.h b/libobjc/objc/objc.h index ee7612c9754..cc822edf5d3 100644 --- a/libobjc/objc/objc.h +++ b/libobjc/objc/objc.h @@ -39,6 +39,7 @@ extern "C" { #ifdef __vxworks typedef int BOOL; #else +#undef BOOL typedef unsigned char BOOL; #endif #define YES (BOOL)1 diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c index b132a153ff3..42d3e02af9f 100644 --- a/libobjc/sendmsg.c +++ b/libobjc/sendmsg.c @@ -687,14 +687,14 @@ __objc_print_dtable_stats () #endif printf ("arrays: %d = %ld bytes\n", narrays, - (long) (narrays * sizeof (struct sarray))); + (long) ((size_t) narrays * sizeof (struct sarray))); total += narrays * sizeof (struct sarray); printf ("buckets: %d = %ld bytes\n", nbuckets, - (long) (nbuckets * sizeof (struct sbucket))); + (long) ((size_t) nbuckets * sizeof (struct sbucket))); total += nbuckets * sizeof (struct sbucket); printf ("idxtables: %d = %ld bytes\n", - idxsize, (long) (idxsize * sizeof (void *))); + idxsize, (long) ((size_t) idxsize * sizeof (void *))); total += idxsize * sizeof (void *); printf ("-----------------------------------\n"); printf ("total: %d bytes\n", total); diff --git a/libobjc/thr-win32.c b/libobjc/thr-win32.c index cc4bb746e13..35a1c9e6833 100644 --- a/libobjc/thr-win32.c +++ b/libobjc/thr-win32.c @@ -70,7 +70,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg) arg, 0, &thread_id))) thread_id = 0; - return (objc_thread_t)thread_id; + return (objc_thread_t)(size_t) thread_id; } /* Set the current thread's priority. */ @@ -151,7 +151,7 @@ __objc_thread_exit(void) objc_thread_t __objc_thread_id(void) { - return (objc_thread_t)GetCurrentThreadId(); + return (objc_thread_t)(size_t) GetCurrentThreadId(); } /* Sets the thread's local storage pointer. */ diff --git a/libobjc/thr.c b/libobjc/thr.c index 17f6f7e2920..c70c5bf5a01 100644 --- a/libobjc/thr.c +++ b/libobjc/thr.c @@ -114,6 +114,9 @@ __objc_thread_detach_function (struct __objc_thread_start_state *istate) /* Exit the thread */ objc_thread_exit (); + + /* Make sure compiler detects no return. */ + __builtin_trap (); } /* diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 510bb2c56ce..a9638027c6d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,49 @@ +2008-11-26 Janis Johnson <janis187@us.ibm.com> + + PR testsuite/28870 + * testsuite/lib/libstdc++.exp: Include new timeout library files. + (libstdc++_init): Define tool_timeout. + (dg-test): Override DejaGnu proc. + (v3_target_compile): Set timeout value from new proc. + (v3_target_compile_as_c): Ditto. + +2008-11-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/38244 (cont, debug bits) + * include/debug/bitset (bitset<>::bitset(const char*, char, char)): + Remove, do not implement DR 778. + +2008-11-24 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/38244 + * include/std/bitset (bitset<>::bitset(const char*, char, char)): + Remove, do not implement DR 778. + * doc/xml/manual/intro.xml: Remove entry for DR 778. + * testsuite/23_containers/bitset/cons/2.cc: Remove. + * testsuite/23_containers/bitset/cons/dr396.cc: Tweak. + * testsuite/23_containers/bitset/cons/38244.cc: Add. + +2008-11-21 Paolo Carlini <paolo.carlini@oracle.com> + + * testsuite/22_locale/num_put/put/char/38210.cc: Tweak. + * testsuite/22_locale/num_put/put/wchar_t/38210.cc: Likewise. + +2008-11-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/38210 + * include/bits/locale_facets.tcc (num_put<>::do_put(iter_type, + ios_base&, char_type, const void*)): Fix. + * testsuite/22_locale/num_put/put/char/38210.cc: New. + * testsuite/22_locale/num_put/put/wchar_t/38210.cc: Likewise. + +2008-11-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/38196 + * include/bits/locale_facets.tcc (num_put<>::do_put(iter_type, + ios_base&, char_type, bool)): Fix. + * testsuite/22_locale/num_put/put/char/38196.cc: New. + * testsuite/22_locale/num_put/put/wchar_t/38196.cc: Likewise. + 2008-11-18 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1_impl/cinttypes: Remove redundant pragma system_header. diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index d60dd5df5d9..906d942f364 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -684,13 +684,6 @@ <listitem><para>In C++0x mode, remove assign, add fill. </para></listitem></varlistentry> - <varlistentry><term><ulink url="../ext/lwg-defects.html#778">778</ulink>: - <emphasis>std::bitset does not have any constructor taking a string - literal</emphasis> - </term> - <listitem><para>Add it. - </para></listitem></varlistentry> - <varlistentry><term><ulink url="../ext/lwg-defects.html#781">781</ulink>: <emphasis>std::complex should add missing C99 functions</emphasis> </term> diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 9a44007e451..4ae827f4e99 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1096,11 +1096,25 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE const streamsize __w = __io.width(); if (__w > static_cast<streamsize>(__len)) { - _CharT* __cs + const streamsize __plen = __w - __len; + _CharT* __ps = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) - * __w)); - _M_pad(__fill, __w, __io, __cs, __name, __len); - __name = __cs; + * __plen)); + + char_traits<_CharT>::assign(__ps, __plen, __fill); + __io.width(0); + + if ((__flags & ios_base::adjustfield) == ios_base::left) + { + __s = std::__write(__s, __name, __len); + __s = std::__write(__s, __ps, __plen); + } + else + { + __s = std::__write(__s, __ps, __plen); + __s = std::__write(__s, __name, __len); + } + return __s; } __io.width(0); __s = std::__write(__s, __name, __len); @@ -1137,8 +1151,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE { const ios_base::fmtflags __flags = __io.flags(); const ios_base::fmtflags __fmt = ~(ios_base::basefield - | ios_base::uppercase - | ios_base::internal); + | ios_base::uppercase); __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase)); typedef __gnu_cxx::__conditional_type<(sizeof(const void*) diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset index 1167ee93bdf..c0b33a454ab 100644 --- a/libstdc++-v3/include/debug/bitset +++ b/libstdc++-v3/include/debug/bitset @@ -146,12 +146,6 @@ namespace __debug _CharT __zero, _CharT __one = _CharT('1')) : _Base(__str, __pos, __n, __zero, __one) { } - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 778. std::bitset does not have any constructor taking a string literal - explicit - bitset(const char* __s, char __zero = '0', char __one = '1') - : _Base(__s, __zero, __one) { } - bitset(const _Base& __x) : _Base(__x), _Safe_base() { } // 23.3.5.2 bitset operations: diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index b18440d39f8..10d60055c31 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -802,17 +802,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _M_copy_from_string(__s, __position, __n, __zero, __one); } - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 778. std::bitset does not have any constructor taking a string literal - explicit - bitset(const char* __s, char __zero = '0', char __one = '1') - : _Base() - { - _M_copy_from_ptr<char, char_traits<char> >(__s, - char_traits<char>::length(__s), 0, size_t(-1), - __zero, __one); - } - // 23.3.5.2 bitset operations: //@{ /** diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc new file mode 100644 index 00000000000..69c0c998eed --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38196.cc @@ -0,0 +1,81 @@ +// Copyright (C) 2008 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +class my_punct : public std::numpunct<char> +{ +protected: + std::string do_falsename() const { return "-no-"; } +}; + +// libstdc++/38196 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + ostringstream oss1, oss2, oss3, oss4; + string result1, result2, result3, result4; + + oss1.imbue(locale(oss1.getloc(), new my_punct)); + oss2.imbue(locale(oss2.getloc(), new my_punct)); + oss3.imbue(locale(oss3.getloc(), new my_punct)); + oss4.imbue(locale(oss4.getloc(), new my_punct)); + const num_put<char>& ng1 = use_facet<num_put<char> >(oss1.getloc()); + const num_put<char>& ng2 = use_facet<num_put<char> >(oss2.getloc()); + const num_put<char>& ng3 = use_facet<num_put<char> >(oss3.getloc()); + const num_put<char>& ng4 = use_facet<num_put<char> >(oss4.getloc()); + + oss1.width(6); + oss1.setf(ios_base::boolalpha); + ng1.put(oss1.rdbuf(), oss1, '*', false); + result1 = oss1.str(); + VERIFY( result1 == "**-no-" ); + + oss2.width(6); + oss2.setf(ios_base::right, ios_base::adjustfield); + oss2.setf(ios_base::boolalpha); + ng2.put(oss2.rdbuf(), oss2, '*', false); + result2 = oss2.str(); + VERIFY( result2 == "**-no-" ); + + oss3.width(6); + oss3.setf(ios_base::internal, ios_base::adjustfield); + oss3.setf(ios_base::boolalpha); + ng3.put(oss3.rdbuf(), oss3, '*', false); + result3 = oss3.str(); + VERIFY( result3 == "**-no-" ); + + oss4.width(6); + oss4.setf(ios_base::left, ios_base::adjustfield); + oss4.setf(ios_base::boolalpha); + ng4.put(oss4.rdbuf(), oss4, '*', false); + result4 = oss4.str(); + VERIFY( result4 == "-no-**" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc new file mode 100644 index 00000000000..5d4aea9a742 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/38210.cc @@ -0,0 +1,69 @@ +// Copyright (C) 2008 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// libstdc++/38210 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + ostringstream oss1, oss2, oss3, oss4; + string result1, result2, result3, result4; + + const num_put<char>& ng1 = use_facet<num_put<char> >(oss1.getloc()); + const num_put<char>& ng2 = use_facet<num_put<char> >(oss2.getloc()); + const num_put<char>& ng3 = use_facet<num_put<char> >(oss3.getloc()); + const num_put<char>& ng4 = use_facet<num_put<char> >(oss4.getloc()); + + void* p = (void*)0x1; + + oss1.width(5); + ng1.put(oss1.rdbuf(), oss1, '*', p); + result1 = oss1.str(); + VERIFY( result1 == "**0x1" ); + + oss2.width(5); + oss2.setf(ios_base::right, ios_base::adjustfield); + ng2.put(oss2.rdbuf(), oss2, '*', p); + result2 = oss2.str(); + VERIFY( result2 == "**0x1" ); + + oss3.width(5); + oss3.setf(ios_base::internal, ios_base::adjustfield); + ng3.put(oss3.rdbuf(), oss3, '*', p); + result3 = oss3.str(); + VERIFY( result3 == "0x**1" ); + + oss4.width(5); + oss4.setf(ios_base::left, ios_base::adjustfield); + ng4.put(oss4.rdbuf(), oss4, '*', p); + result4 = oss4.str(); + VERIFY( result4 == "0x1**" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc new file mode 100644 index 00000000000..ac69b6d400d --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38196.cc @@ -0,0 +1,81 @@ +// Copyright (C) 2008 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +class my_punct : public std::numpunct<wchar_t> +{ +protected: + std::wstring do_falsename() const { return L"-no-"; } +}; + +// libstdc++/38196 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + wostringstream oss1, oss2, oss3, oss4; + wstring result1, result2, result3, result4; + + oss1.imbue(locale(oss1.getloc(), new my_punct)); + oss2.imbue(locale(oss2.getloc(), new my_punct)); + oss3.imbue(locale(oss3.getloc(), new my_punct)); + oss4.imbue(locale(oss4.getloc(), new my_punct)); + const num_put<wchar_t>& ng1 = use_facet<num_put<wchar_t> >(oss1.getloc()); + const num_put<wchar_t>& ng2 = use_facet<num_put<wchar_t> >(oss2.getloc()); + const num_put<wchar_t>& ng3 = use_facet<num_put<wchar_t> >(oss3.getloc()); + const num_put<wchar_t>& ng4 = use_facet<num_put<wchar_t> >(oss4.getloc()); + + oss1.width(6); + oss1.setf(ios_base::boolalpha); + ng1.put(oss1.rdbuf(), oss1, L'*', false); + result1 = oss1.str(); + VERIFY( result1 == L"**-no-" ); + + oss2.width(6); + oss2.setf(ios_base::right, ios_base::adjustfield); + oss2.setf(ios_base::boolalpha); + ng2.put(oss2.rdbuf(), oss2, L'*', false); + result2 = oss2.str(); + VERIFY( result2 == L"**-no-" ); + + oss3.width(6); + oss3.setf(ios_base::internal, ios_base::adjustfield); + oss3.setf(ios_base::boolalpha); + ng3.put(oss3.rdbuf(), oss3, L'*', false); + result3 = oss3.str(); + VERIFY( result3 == L"**-no-" ); + + oss4.width(6); + oss4.setf(ios_base::left, ios_base::adjustfield); + oss4.setf(ios_base::boolalpha); + ng4.put(oss4.rdbuf(), oss4, L'*', false); + result4 = oss4.str(); + VERIFY( result4 == L"-no-**" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc new file mode 100644 index 00000000000..a576249ca95 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/38210.cc @@ -0,0 +1,69 @@ +// Copyright (C) 2008 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// libstdc++/38210 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + wostringstream oss1, oss2, oss3, oss4; + wstring result1, result2, result3, result4; + + const num_put<wchar_t>& ng1 = use_facet<num_put<wchar_t> >(oss1.getloc()); + const num_put<wchar_t>& ng2 = use_facet<num_put<wchar_t> >(oss2.getloc()); + const num_put<wchar_t>& ng3 = use_facet<num_put<wchar_t> >(oss3.getloc()); + const num_put<wchar_t>& ng4 = use_facet<num_put<wchar_t> >(oss4.getloc()); + + void* p = (void*)0x1; + + oss1.width(5); + ng1.put(oss1.rdbuf(), oss1, L'*', p); + result1 = oss1.str(); + VERIFY( result1 == L"**0x1" ); + + oss2.width(5); + oss2.setf(ios_base::right, ios_base::adjustfield); + ng2.put(oss2.rdbuf(), oss2, L'*', p); + result2 = oss2.str(); + VERIFY( result2 == L"**0x1" ); + + oss3.width(5); + oss3.setf(ios_base::internal, ios_base::adjustfield); + ng3.put(oss3.rdbuf(), oss3, L'*', p); + result3 = oss3.str(); + VERIFY( result3 == L"0x**1" ); + + oss4.width(5); + oss4.setf(ios_base::left, ios_base::adjustfield); + ng4.put(oss4.rdbuf(), oss4, L'*', p); + result4 = oss4.str(); + VERIFY( result4 == L"0x1**" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc index 24bb6213e60..5d752325802 100644 --- a/libstdc++-v3/testsuite/23_containers/bitset/cons/2.cc +++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/38244.cc @@ -1,5 +1,3 @@ -// 2008-05-21 Paolo Carlini <paolo.carlini@oracle.com> - // Copyright (C) 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -18,32 +16,29 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-do compile } + #include <bitset> -#include <testsuite_hooks.h> -// DR 778. std::bitset does not have any constructor taking a string literal. -void test01() +class C0 { - bool test __attribute__((unused)) = true; - - std::bitset<4> z1("1101"); - std::bitset<4> z1_ref(std::string("1101")); - VERIFY( z1.to_string() == "1101" ); - VERIFY( z1 == z1_ref ); - - std::bitset<8> z2("1011"); - std::bitset<8> z2_ref(std::string("1011")); - VERIFY( z2.to_string() == "00001011" ); - VERIFY( z2 == z2_ref ); + public: + C0() : b(0) { } + private: + std::bitset<1> b; +}; - std::bitset<2> z3("1101"); - std::bitset<2> z3_ref(std::string("1101")); - VERIFY( z3.to_string() == "11" ); - VERIFY( z3 == z3_ref ); -} - -int main() +class C1 +{ + public: + C1() : b(1) { } + private: + std::bitset<1> b; +}; + +// libstdc++/38244 +void func() { - test01(); - return 0; + C0 val0; + C1 val1; } diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc index 3c8a576a96f..6218e8a840d 100644 --- a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc +++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr396.cc @@ -26,35 +26,23 @@ void test01() { bool test __attribute__((unused)) = true; - std::bitset<4> z1("bbab", 'a', 'b'); - std::bitset<4> z1_ref(std::string("bbab"), 0, std::string::npos, 'a', 'b'); + std::bitset<4> z1(std::string("bbab"), 0, std::string::npos, 'a', 'b'); VERIFY( z1.to_string('a', 'b') == "bbab" ); - VERIFY( z1 == z1_ref ); - std::bitset<4> z2("11a1", 'a'); - std::bitset<4> z2_ref(std::string("11a1"), 0, std::string::npos, 'a'); + std::bitset<4> z2(std::string("11a1"), 0, std::string::npos, 'a'); VERIFY( z2.to_string('a') == "11a1" ); - VERIFY( z2 == z2_ref ); - std::bitset<8> z3("babb", 'a', 'b'); - std::bitset<8> z3_ref(std::string("babb"), 0, std::string::npos, 'a', 'b'); + std::bitset<8> z3(std::string("babb"), 0, std::string::npos, 'a', 'b'); VERIFY( z3.to_string('a', 'b') == "aaaababb" ); - VERIFY( z3 == z3_ref ); - std::bitset<8> z4("1a11", 'a'); - std::bitset<8> z4_ref(std::string("1a11"), 0, std::string::npos, 'a'); + std::bitset<8> z4(std::string("1a11"), 0, std::string::npos, 'a'); VERIFY( z4.to_string('a') == "aaaa1a11" ); - VERIFY( z4 == z4_ref ); - std::bitset<2> z5("bbab", 'a', 'b'); - std::bitset<2> z5_ref(std::string("bbab"), 0, std::string::npos, 'a', 'b'); + std::bitset<2> z5(std::string("bbab"), 0, std::string::npos, 'a', 'b'); VERIFY( z5.to_string('a', 'b') == "bb" ); - VERIFY( z5 == z5_ref ); - std::bitset<2> z6("11a1", 'a'); - std::bitset<2> z6_ref(std::string("11a1"), 0, std::string::npos, 'a'); + std::bitset<2> z6(std::string("11a1"), 0, std::string::npos, 'a'); VERIFY( z6.to_string('a') == "11" ); - VERIFY( z6 == z6_ref ); } int main() diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 8a4e8c430c4..3b2e18b7b2c 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -53,6 +53,8 @@ load_gcc_lib target-supports-dg.exp load_lib prune.exp load_lib dg-options.exp load_gcc_lib target-libpath.exp +load_gcc_lib timeout.exp +load_gcc_lib timeout-dg.exp load_gcc_lib wrapper.exp # Useful for debugging. Pass the name of a variable and the verbosity @@ -89,6 +91,7 @@ proc libstdc++_init { testfile } { global ld_library_path global target_triplet global flags_file + global tool_timeout # We set LC_ALL and LANG to C so that we get the same error # messages as expected. @@ -184,6 +187,9 @@ proc libstdc++_init { testfile } { set compiler [transform "g++"] } + # Set the default timeout for v3 tests. + set tool_timeout 600 + # Default settings. set cxx [transform "g++"] set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" @@ -346,6 +352,24 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } { return [list $comp_output $output_file] } +# Override the DejaGnu dg-test in order to clear flags after a test, as +# is done for compiler tests in gcc-dg.exp. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global errorInfo + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + unset_timeout_vars + error $errmsg $saved_info + } + unset_timeout_vars + } +} + # True if the library supports wchar_t. set v3-wchar_t 0 @@ -389,7 +413,7 @@ proc v3_target_compile { source dest type options } { } lappend options "compiler=$cxx_final" - lappend options "timeout=600" + lappend options "timeout=[timeout_value]" return [target_compile $source $dest $type $options] } @@ -455,7 +479,7 @@ proc v3_target_compile_as_c { source dest type options } { set cc_final [concat $cc_final "$libdir"] lappend options "compiler=$cc_final" - lappend options "timeout=600" + lappend options "timeout=[timeout_value]" return [target_compile $source $dest $type $options] } |