Index: gcc-4.3/gcc/c-decl.c =================================================================== --- gcc-4.3/gcc/c-decl.c (revision 125280) +++ gcc-4.3/gcc/c-decl.c (working copy) @@ -3384,7 +3384,7 @@ void finish_decl (tree decl, tree init, tree asmspec_tree) { tree type; - int was_incomplete = (DECL_SIZE (decl) == 0); + bool was_incomplete = (DECL_SIZE (decl) == 0); const char *asmspec = 0; /* If a name was specified, get the string. */ Index: gcc-4.3/gcc/fortran/symbol.c =================================================================== --- gcc-4.3/gcc/fortran/symbol.c (revision 125280) +++ gcc-4.3/gcc/fortran/symbol.c (working copy) @@ -380,7 +380,7 @@ check_conflict (symbol_attribute * attr, conf (external, dimension); /* See Fortran 95's R504. */ conf (external, intrinsic); - + if (attr->if_source || attr->contained) { conf (external, subroutine); @@ -1425,8 +1425,8 @@ gfc_copy_attr (symbol_attribute * dest, if (src->cray_pointer && gfc_add_cray_pointer (dest, where) == FAILURE) goto fail; if (src->cray_pointee && gfc_add_cray_pointee (dest, where) == FAILURE) - goto fail; - + goto fail; + /* The subroutines that set these bits also cause flavors to be set, and that has already happened in the original, so don't let it happen again. */ @@ -2510,7 +2510,7 @@ free_common_tree (gfc_symtree * common_t free_common_tree (common_tree->right); gfc_free (common_tree); -} +} /* Recursive function that deletes an entire tree and all the user Index: gcc-4.3/gcc/fortran/decl.c =================================================================== --- gcc-4.3/gcc/fortran/decl.c (revision 125280) +++ gcc-4.3/gcc/fortran/decl.c (working copy) @@ -2612,7 +2612,7 @@ cleanup: static match match_prefix (gfc_typespec *ts) { - int seen_type; + bool seen_type; gfc_clear_attr (¤t_attr); seen_type = 0; @@ -2942,16 +2942,18 @@ static bool add_global_entry (const char *name, int sub) { gfc_gsymbol *s; + int type; s = gfc_get_gsymbol(name); + type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION; if (s->defined || (s->type != GSYM_UNKNOWN - && s->type != (sub ? GSYM_SUBROUTINE : GSYM_FUNCTION))) + && s->type != type)) global_used(s, NULL); else { - s->type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION; + s->type = type; s->where = gfc_current_locus; s->defined = 1; return true; Index: gcc-4.3/gcc/fortran/Make-lang.in =================================================================== --- gcc-4.3/gcc/fortran/Make-lang.in (revision 125280) +++ gcc-4.3/gcc/fortran/Make-lang.in (working copy) @@ -68,6 +68,8 @@ F95_OBJS = $(F95_PARSER_OBJS) \ fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \ fortran/trans-stmt.o fortran/trans-types.o +F95_OBJS-onestep = f951_frontend.o + # # Define the names for selecting gfortran in LANGUAGES. fortran: f951$(exeext) @@ -92,11 +94,22 @@ gfortran-cross$(exeext): gfortran$(exeex -rm -f gfortran-cross$(exeext) cp gfortran$(exeext) gfortran-cross$(exeext) +f951_frontend.o: $(F95_OBJS:.o=.c) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -c $(filter %.c,$^) -o $@ -combine + # The compiler itself is called f951. +# Make-lang.in is not generated via configure, so we cannot use @onestep@ +ifeq ($(onestep),) f951$(exeext): $(F95_OBJS) \ $(BACKEND) $(LIBDEPS) attribs.o $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ $(F95_OBJS) $(BACKEND) $(LIBS) attribs.o +else +f951$(exeext): $(F95_OBJS-onestep) \ + $(BACKEND) $(LIBDEPS) attribs.o + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ + $(F95_OBJS-onestep) $(BACKEND) $(LIBS) attribs.o +endif gt-fortran-trans.h : s-gtype; @true # Index: gcc-4.3/gcc/fortran/error.c =================================================================== --- gcc-4.3/gcc/fortran/error.c (revision 125280) +++ gcc-4.3/gcc/fortran/error.c (working copy) @@ -664,8 +664,7 @@ gfc_notify_std (int std, const char *noc if (gfc_suppress_error) return warning ? SUCCESS : FAILURE; - cur_error_buffer = (warning && !warnings_are_errors) - ? &warning_buffer : &error_buffer; + cur_error_buffer = warning ? &warning_buffer : &error_buffer; cur_error_buffer->flag = 1; cur_error_buffer->index = 0; Index: gcc-4.3/gcc/varasm.c =================================================================== --- gcc-4.3/gcc/varasm.c (revision 125280) +++ gcc-4.3/gcc/varasm.c (working copy) @@ -4972,7 +4972,7 @@ weak_finish (void) else if (! TREE_SYMBOL_REFERENCED (target)) { /* Use ASM_WEAKEN_LABEL only if ASM_WEAKEN_DECL is not - defined, otherwise we and weak_finish_1 would use a + defined, otherwise we and weak_finish_1 would use different macros. */ # if defined ASM_WEAKEN_LABEL && ! defined ASM_WEAKEN_DECL ASM_WEAKEN_LABEL (asm_out_file, IDENTIFIER_POINTER (target)); @@ -5151,6 +5151,9 @@ do_assemble_alias (tree decl, tree targe if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) { ultimate_transparent_alias_target (&target); + if (TREE_ASM_WRITTEN (target)){warning(0, "XXX: skipping '%s'", get_name(target)); + return;} /* NOT a fix. See PR31537 */ + TREE_ASM_WRITTEN (target) = 1; if (!targetm.have_tls && TREE_CODE (decl) == VAR_DECL @@ -5340,7 +5343,7 @@ assemble_alias (tree decl, tree target) varpool_node (decl)->alias = true; /* If the target has already been emitted, we don't have to queue the - alias. This saves a tad o memory. */ + alias. This saves a tad of memory. */ target_decl = find_decl_and_mark_needed (decl, target); if (target_decl && TREE_ASM_WRITTEN (target_decl)) do_assemble_alias (decl, target); Index: gcc-4.3/gcc/Makefile.in =================================================================== --- gcc-4.3/gcc/Makefile.in (revision 125280) +++ gcc-4.3/gcc/Makefile.in (working copy) @@ -1449,9 +1449,11 @@ rest.cross: specs compilations: $(BACKEND) # This archive is strictly for the host. -libbackend.a: $(OBJS@onestep@) +#libbackend.a: $(OBJS@onestep@) +libbackend.a: $(OBJS) -rm -rf libbackend.a - $(AR) $(AR_FLAGS) libbackend.a $(OBJS@onestep@) + #$(AR) $(AR_FLAGS) libbackend.a $(OBJS@onestep@) + $(AR) $(AR_FLAGS) libbackend.a $(OBJS) -$(RANLIB) $(RANLIB_FLAGS) libbackend.a # We call this executable `xgcc' rather than `gcc' @@ -2774,7 +2776,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) # FIXME: writing proper dependencies for this is a *LOT* of work. libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ insn-config.h insn-flags.h insn-codes.h insn-constants.h \ - insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) + insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h # PR30620 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ -DTARGET_NAME=\"$(target_noncanonical)\" \ -DLOCALEDIR=\"$(localedir)\" \ Index: gcc-4.3/gcc/stmt.c =================================================================== --- gcc-4.3/gcc/stmt.c (revision 125280) +++ gcc-4.3/gcc/stmt.c (working copy) @@ -2512,7 +2512,11 @@ expand_case (tree exp) use_cost_table = (TREE_CODE (orig_type) != ENUMERAL_TYPE && estimate_case_costs (case_list)); - balance_case_nodes (&case_list, NULL); + /* When optimizing for size, we want a straight list to avoid + jumps as much as possible. This basically creates an if-else + chain. *//*http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html*/ + if (!optimize_size) + balance_case_nodes (&case_list, NULL); emit_case_nodes (index, case_list, default_label, index_type); emit_jump (default_label); } @@ -3068,6 +3072,7 @@ emit_case_nodes (rtx index, case_node_pt { if (!node_has_low_bound (node, index_type)) { + if (!optimize_size) /* don't jl to the .default_label. */ emit_cmp_and_jump_insns (index, convert_modes (mode, imode, Index: gcc-4.3/libgfortran/configure.ac =================================================================== --- gcc-4.3/libgfortran/configure.ac (revision 125280) +++ gcc-4.3/libgfortran/configure.ac (working copy) @@ -21,6 +21,18 @@ AC_ARG_ENABLE(version-specific-runtime-l [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) +# Build with intermodule optimisations PR31546 +AC_MSG_CHECKING([for --enable-intermodule]) +AC_ARG_ENABLE(intermodule, +[ --enable-intermodule build the library in one step], +[case "$enable_intermodule" in + yes) onestep="-onestep";; + *) onestep="";; +esac], +[onestep=""]) +AC_MSG_RESULT($enable_intermodule) +AM_CONDITIONAL(onestep,[test x$onestep = x-onestep]) +AC_SUBST(onestep) # Gets build, host, target, *_vendor, *_cpu, *_os, etc. # Index: gcc-4.3/libgfortran/Makefile.am =================================================================== --- gcc-4.3/libgfortran/Makefile.am (revision 125280) +++ gcc-4.3/libgfortran/Makefile.am (working copy) @@ -22,7 +22,7 @@ myexeclibdir = $(libdir)/gcc/$(target_al libgfortranbegin_la_SOURCES = fmain.c libgfortranbegin_la_LDFLAGS = -static -## io.h conflicts with some a system header on some platforms, so +## io.h conflicts with a system header on some platforms, so ## use -iquote AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \ -I$(srcdir)/$(MULTISRCTOP)../gcc/config \ @@ -647,9 +647,41 @@ selected_real_kind.lo selected_int_kind. BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \ $(gfor_built_specific2_src) $(gfor_misc_specifics) -libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ + +prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \ $(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src) +if onestep +# dummy sources for libtool +BUILT_SOURCES+=libgfortran_c.c libgfortran_f.f90 libgfortran_F.F90 +libgfortran_c.c libgfortran_f.f90 libgfortran_F.F90: + > $@ +# overrides for libtool ignoring the dummy sources +libgfortran_c.o: $(filter %.c,$(prereq_SRC)) + $(COMPILE) -c $^ -o $@ -combine + +libgfortran_c.lo: $(filter %.c,$(prereq_SRC)) + $(LTCOMPILE) -c -o $@ $^ -combine +# gfortran currently rejects -combine, so don't use these for now +libgfortran_f.o: $(filter %.f %.f90,$(prereq_SRC)) + $(FCCOMPILE) -c $^ -o $@ -combine + +libgfortran_f.lo: $(filter %.f %.f90,$(prereq_SRC)) + $(LTFCCOMPILE) -c -o $@ $^ -combine +# not currently used: +#libgfortran_F.o: $(filter %.F %.F90,$(prereq_SRC)) +# $(PPFCCOMPILE) -c $^ -o $@ -combine +# +#libgfortran_F.lo: +# $(LTPPFCCOMPILE) -c -o $@ $^ -combine + +libgfortran_la_SOURCES = libgfortran_c.c $(filter-out %.c,$(prereq_SRC)) + +else +libgfortran_la_SOURCES = $(prereq_SRC) + +endif + I_M4_DEPS=m4/iparm.m4 I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4 I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4