summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-05 19:40:25 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-05 19:40:25 +0000
commit278281ab17fe7a77ceb03fd0c724d9047e336a0b (patch)
tree21e4423a1a871c37d08bfd17c3fba909461113d1
parent1726f7e9d58d49d1446fedbed9c38fc44e2ffc3e (diff)
downloadgcc-278281ab17fe7a77ceb03fd0c724d9047e336a0b.tar.gz
2008-10-05 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r140892 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@140894 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog.melt3
-rw-r--r--gcc/ChangeLog63
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/config/i386/winnt.c15
-rw-r--r--gcc/config/pa/pa.c4
-rw-r--r--gcc/config/rs6000/rs6000.c8
-rw-r--r--gcc/config/rs6000/rs6000.md4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/error.c7
-rw-r--r--gcc/doc/gimple.texi27
-rw-r--r--gcc/fortran/ChangeLog26
-rw-r--r--gcc/fortran/expr.c31
-rw-r--r--gcc/fortran/gfortran.h11
-rw-r--r--gcc/fortran/module.c7
-rw-r--r--gcc/fortran/resolve.c13
-rw-r--r--gcc/gcov.c67
-rw-r--r--gcc/gimple.h2
-rw-r--r--gcc/gimplify.c6
-rw-r--r--gcc/stringpool.c12
-rw-r--r--gcc/testsuite/ChangeLog29
-rw-r--r--gcc/testsuite/g++.dg/template/error36.C9
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c25
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-21.c15
-rw-r--r--gcc/testsuite/gfortran.dg/module_equivalence_4.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_array_intrinsic_5.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_9.f0363
-rw-r--r--gcc/tree-ssa-reassoc.c4
-rw-r--r--gcc/tree-ssa-sccvn.c4
-rw-r--r--libcpp/ChangeLog11
-rw-r--r--libcpp/include/cpplib.h30
-rw-r--r--libcpp/init.c9
-rw-r--r--libcpp/internal.h3
-rw-r--r--libcpp/lex.c49
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc89
-rw-r--r--libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc115
-rw-r--r--libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc88
-rw-r--r--maintainer-scripts/ChangeLog4
-rwxr-xr-xmaintainer-scripts/gcc_release14
39 files changed, 835 insertions, 99 deletions
diff --git a/ChangeLog.melt b/ChangeLog.melt
index 0ffc25b0f77..a0df0bf9333 100644
--- a/ChangeLog.melt
+++ b/ChangeLog.melt
@@ -1,3 +1,6 @@
+2008-10-05 Basile Starynkevitch <basile@starynkevitch.net>
+ MELT branch merged with trunk r140892
+
2008-10-03 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r140849
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 10aab9ca08a..71eaead3463 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,66 @@
+2008-10-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * doc/gimple.texi: Fix some typos, wrap some long lines,
+ fix some broken wraps with continuations.
+ * tree-ssa-reassoc.c: Fix comment typos.
+
+2000-10-04 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR target/37603
+ * pa.c (legitimize_pic_address): Force function labels to memory in
+ word mode.
+
+2008-10-04 Anton Blanchard <anton@samba.org>
+
+ * config/rs6000/rs6000.c (rs6000_emit_sync): Use gen_lwsync().
+ (rs6000_split_atomic_op): Same.
+ (rs6000_split_compare_and_swap): Same.
+ (rs6000_split_compare_and_swapqhi): Same.
+
+2008-10-04 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (vn_reference_op_eq): Use types_compatible_p
+ instead of pointer equality.
+ (vn_nary_op_eq): Likewise.
+
+2008-10-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * config/rs6000/rs6000.md (fseldfsf4): Add TARGET_SINGLE_FLOAT
+ condition.
+ (fselsfdf4): Make condition on "TARGET_HARD_FLOAT && TARGET_FPRS &&
+ TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT".
+
+2008-10-03 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * config/i386/winnt.c (i386_pe_strip_name_encoding_full):
+ Revert previous change.
+
+2008-10-03 Tom Tromey <tromey@redhat.com>
+
+ * stringpool.c (ggc_alloc_string): Terminate string.
+
+2008-10-03 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (gimplify_function_tree): For -finstrument-functions
+ use gimple_bind_{,set_}block instead of gimple_{,set_}block.
+ * gimple.h (gimple_bind_set_block): Allow second argument to be NULL.
+
+ PR debug/37726
+ * gimplify.c (declare_vars): Use gimple_bind_block instead of
+ gimple_block.
+
+2008-10-03 Pascal Obry <obry@adacore.com>
+
+ * gcov.c (create_file_names): Properly handle UNIX and DOS
+ directory separators.
+ (make_gcov_file_name): Likewise + convert the ':' DOS drive
+ separator to '~' to ensure clean filenames on Windows.
+
+2008-10-02 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * config/i386/winnt.c (i386_pe_strip_name_encoding_full):
+ Add a null terminator to the stripped name.
+
2008-10-02 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (USE_FP_FOR_ARG_P): Revert
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 98fc65eab46..ff0adc38af2 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20081003
+20081005
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index f4356c8bb94..7815be007a8 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -352,16 +352,8 @@ i386_pe_strip_name_encoding_full (const char *str)
/* Strip trailing "@n". */
p = strchr (name, '@');
if (p)
- {
- /* We need to replace the suffix with a null terminator.
- Do that before using ggc_alloc_string to allocate the
- const char *. */
- size_t len = p - name;
- char *newname = XALLOCAVEC (char, len + 1);
- memcpy (newname, name, len);
- newname [len] = 0;
- return ggc_alloc_string (newname, len);
- }
+ return ggc_alloc_string (name, p - name);
+
return name;
}
@@ -523,7 +515,8 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
i386_pe_maybe_record_exported_symbol (decl, name, 1);
- fprintf (stream, "\t.comm\t");
+ switch_to_section (bss_section);
+ fprintf (stream, "\t.balign %d\n\t.comm \t", ((int) align) / BITS_PER_UNIT);
assemble_name (stream, name);
fprintf (stream, ", " HOST_WIDE_INT_PRINT_DEC "\t" ASM_COMMENT_START
" " HOST_WIDE_INT_PRINT_DEC "\n",
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index c9c6525c91d..652eba526db 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -714,8 +714,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
if (function_label_operand (orig, mode))
{
- /* Force function label into memory. */
- orig = XEXP (force_const_mem (mode, orig), 0);
+ /* Force function label into memory in word mode. */
+ orig = XEXP (force_const_mem (word_mode, orig), 0);
/* Load plabel address from DLT. */
emit_move_insn (tmp_reg,
gen_rtx_PLUS (word_mode, pic_offset_table_rtx,
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index e1e0d1c02f8..d230dfd336b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -13792,7 +13792,7 @@ rs6000_emit_sync (enum rtx_code code, enum machine_mode mode,
rtx shift = NULL_RTX;
if (sync_p)
- emit_insn (gen_memory_barrier ());
+ emit_insn (gen_lwsync ());
if (GET_CODE (m) == NOT)
used_m = XEXP (m, 0);
@@ -14032,7 +14032,7 @@ rs6000_split_atomic_op (enum rtx_code code, rtx mem, rtx val,
enum machine_mode mode = GET_MODE (mem);
rtx label, x, cond = gen_rtx_REG (CCmode, CR0_REGNO);
- emit_insn (gen_memory_barrier ());
+ emit_insn (gen_lwsync ());
label = gen_label_rtx ();
emit_label (label);
@@ -14072,7 +14072,7 @@ rs6000_split_compare_and_swap (rtx retval, rtx mem, rtx oldval, rtx newval,
enum machine_mode mode = GET_MODE (mem);
rtx label1, label2, x, cond = gen_rtx_REG (CCmode, CR0_REGNO);
- emit_insn (gen_memory_barrier ());
+ emit_insn (gen_lwsync ());
label1 = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
label2 = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
@@ -14177,7 +14177,7 @@ rs6000_split_compare_and_swapqhi (rtx dest, rtx mask,
{
rtx label1, label2, x, cond = gen_rtx_REG (CCmode, CR0_REGNO);
- emit_insn (gen_memory_barrier ());
+ emit_insn (gen_lwsync ());
label1 = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
label2 = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
emit_label (XEXP (label1, 0));
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 9a4faa5b65a..71a73ad4eb5 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -5562,7 +5562,7 @@
(match_operand:DF 4 "zero_fp_constant" "F"))
(match_operand:SF 2 "gpc_reg_operand" "f")
(match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
"fsel %0,%1,%2,%3"
[(set_attr "type" "fp")])
@@ -5811,7 +5811,7 @@
(match_operand:SF 4 "zero_fp_constant" "F"))
(match_operand:DF 2 "gpc_reg_operand" "f")
(match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT"
+ "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
"fsel %0,%1,%2,%3"
[(set_attr "type" "fp")])
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ea319f31aaa..acb766f7124 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37719
+ * error.c (dump_function_decl): Save the exceptions in case of
+ error about incompatible specifications in a specialization.
+
2008-10-01 Andrew Pinski <andrew_pinski@playstation.sony.com>
* tree.c (lvalue_p_1): COMPOUND_LITERAL_EXPR is also an lvalue.
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index b8330c3d0fc..4064ad400e2 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1084,11 +1084,16 @@ dump_function_decl (tree t, int flags)
tree template_parms = NULL_TREE;
int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS;
int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME);
+ tree exceptions;
flags &= ~TFF_UNQUALIFIED_NAME;
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
+ /* Save the exceptions, in case t is a specialization and we are
+ emitting an error about incompatible specifications. */
+ exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (t));
+
/* Pretty print template instantiations only. */
if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t))
{
@@ -1153,7 +1158,7 @@ dump_function_decl (tree t, int flags)
if (flags & TFF_EXCEPTION_SPECIFICATION)
{
pp_base (cxx_pp)->padding = pp_before;
- dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
+ dump_exception_spec (exceptions, flags);
}
if (show_return)
diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 06d2186d182..541785114ad 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -249,7 +249,7 @@ Array of trees with @code{num_ops} slots.
This tuple is essentially identical to @code{gimple_statement_with_ops},
except that it contains 4 additional fields to hold vectors
related memory stores and loads. Similar to the previous case,
-the structure is split in two to accomodate for the operand
+the structure is split in two to accommodate for the operand
vector (@code{gimple_statement_with_memory_ops_base} and
@code{gimple_statement_with_memory_ops}).
@@ -953,8 +953,8 @@ Set @code{IN_OP} to be input operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
Return output operand @code{INDEX} of @code{GIMPLE_ASM} @code{G}.
@end deftypefn
-@deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, unsigne
-index, tree out_op)
+@deftypefn {GIMPLE function} void gimple_asm_set_output_op (gimple g, @
+unsigned index, tree out_op)
Set @code{OUT_OP} to be output operand @code{INDEX} in @code{GIMPLE_ASM} @code{G}.
@end deftypefn
@@ -1012,7 +1012,8 @@ case they will be converted to a gimple operand if necessary.
This function returns the newly created @code{GIMPLE_ASSIGN} tuple.
-@deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1, tree op2)
+@deftypefn {GIMPLE function} gimple gimple_build_assign_with_ops @
+(enum tree_code subcode, tree lhs, tree op1, tree op2)
This function is similar to @code{gimple_build_assign}, but is used to
build a @code{GIMPLE_ASSIGN} statement when the operands of the
right-hand side of the assignment are already split into
@@ -1031,8 +1032,8 @@ assignment statement @code{G}.
@deftypefn {GIMPLE function} enum gimple_rhs_class gimple_assign_rhs_class (gimple g)
-Return the gimple rhs class of the code fo the expression
-computed on the rhs of assignment statment @code{G}. This will never
+Return the gimple rhs class of the code for the expression
+computed on the rhs of assignment statement @code{G}. This will never
return @code{GIMPLE_INVALID_RHS}.
@end deftypefn
@@ -1479,7 +1480,7 @@ Return the destination of the unconditional jump @code{G}.
@end deftypefn
@deftypefn {GIMPLE function} void gimple_goto_set_dest (gimple g, tree dest)
-Set @code{DEST} to be the destination of the unconditonal jump @code{G}.
+Set @code{DEST} to be the destination of the unconditional jump @code{G}.
@end deftypefn
@@ -1605,8 +1606,8 @@ Set @code{NAME} to be the name associated with @code{OMP} critical statement @co
@subsection @code{GIMPLE_OMP_FOR}
@cindex @code{GIMPLE_OMP_FOR}
-@deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, tre
-clauses, tree index, tree initial, tree final, tree incr,
+@deftypefn {GIMPLE function} gimple gimple_build_omp_for (gimple_seq body, @
+tree clauses, tree index, tree initial, tree final, tree incr, @
gimple_seq pre_body, enum tree_code omp_for_cond)
Build a @code{GIMPLE_OMP_FOR} statement. @code{BODY} is sequence of statements
inside the for loop. @code{CLAUSES}, are any of the @code{OMP} loop
@@ -1651,7 +1652,7 @@ Return a pointer to the initial value for @code{OMP_FOR} @code{G}.
@end deftypefn
@deftypefn {GIMPLE function} void gimple_omp_for_set_initial (gimple g, tree initial)
-Set @code{INTIAL} to be the initial value for @code{OMP_FOR} @code{G}.
+Set @code{INITIAL} to be the initial value for @code{OMP_FOR} @code{G}.
@end deftypefn
@deftypefn {GIMPLE function} tree gimple_omp_for_final (gimple g)
@@ -1791,7 +1792,7 @@ Set @code{DATA_ARG} to be the data argument for @code{OMP_PARALLEL} @code{G}.
@end deftypefn
@deftypefn {GIMPLE function} bool is_gimple_omp (gimple stmt)
-Returns true when the gimple statment @code{STMT} is any of the OpenMP
+Returns true when the gimple statement @code{STMT} is any of the OpenMP
types.
@end deftypefn
@@ -1841,7 +1842,7 @@ Set the @code{GF_OMP_SECTION_LAST} flag on @code{G}.
@deftypefn {GIMPLE function} gimple gimple_build_omp_sections (gimple_seq body, tree clauses)
Build a @code{GIMPLE_OMP_SECTIONS} statement. @code{BODY} is a sequence of
section statements. @code{CLAUSES} are any of the @code{OMP} sections
-contsruct's clauses: private, firstprivate, lastprivate,
+construct's clauses: private, firstprivate, lastprivate,
reduction, and nowait.
@end deftypefn
@@ -2093,7 +2094,7 @@ clean-up expression.
Return the cleanup sequence for cleanup statement @code{G}.
@end deftypefn
-@deftypefn {GIMPLE function} void gimple_wce_set_canup (gimple g, gimple_seq cleanup)
+@deftypefn {GIMPLE function} void gimple_wce_set_cleanup (gimple g, gimple_seq cleanup)
Set @code{CLEANUP} to be the cleanup sequence for @code{G}.
@end deftypefn
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 869cd897b27..53f3f0c1526 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,29 @@
+2008-10-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35680
+ * gfortran.h : Add 'error' bit field to gfc_expr structure.
+ * expr.c (check_inquiry): When checking a restricted expression
+ check that arguments are either variables or restricted.
+ (check_restricted): Do not emit error if the expression has
+ 'error' set. Clean up detection of host-associated variable.
+
+2008-10-05 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37638
+ * gfortran.h (struct gfc_typebound_proc): New flag `error'.
+ * resolve.c (update_arglist_pass): Added assertion.
+ (update_compcall_arglist): Fail early for erraneous procedures to avoid
+ confusion later.
+ (resolve_typebound_generic_call): Ignore erraneous specific targets
+ and added assertions.
+ (resolve_typebound_procedure): Set new `error' flag.
+
+2008-10-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37706
+ * module.c (load_equiv): Check the module before negating the
+ unused flag.
+
2008-10-02 Steven Bosscher <steven@gcc.gnu.org>
PR fortran/37635
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 7b741b88050..7f6bf1b07e4 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2017,6 +2017,8 @@ check_init_expr_arguments (gfc_expr *e)
return MATCH_YES;
}
+static gfc_try check_restricted (gfc_expr *);
+
/* F95, 7.1.6.1, Initialization expressions, (7)
F2003, 7.1.7 Initialization expression, (8) */
@@ -2096,6 +2098,11 @@ check_inquiry (gfc_expr *e, int not_restricted)
}
else if (not_restricted && check_init_expr (ap->expr) == FAILURE)
return MATCH_ERROR;
+
+ if (not_restricted == 0
+ && ap->expr->expr_type != EXPR_VARIABLE
+ && check_restricted (ap->expr) == FAILURE)
+ return MATCH_ERROR;
}
return MATCH_YES;
@@ -2421,8 +2428,6 @@ gfc_match_init_expr (gfc_expr **result)
}
-static gfc_try check_restricted (gfc_expr *);
-
/* Given an actual argument list, test to see that each argument is a
restricted expression and optionally if the expression type is
integer or character. */
@@ -2561,14 +2566,17 @@ check_restricted (gfc_expr *e)
that host associated dummy array indices are accepted (PR23446).
This mechanism also does the same for the specification expressions
of array-valued functions. */
- if (sym->attr.in_common
- || sym->attr.use_assoc
- || sym->attr.dummy
- || sym->attr.implied_index
- || sym->ns != gfc_current_ns
- || (sym->ns->proc_name != NULL
- && sym->ns->proc_name->attr.flavor == FL_MODULE)
- || (gfc_is_formal_arg () && (sym->ns == gfc_current_ns)))
+ if (e->error
+ || sym->attr.in_common
+ || sym->attr.use_assoc
+ || sym->attr.dummy
+ || sym->attr.implied_index
+ || (sym->ns && sym->ns == gfc_current_ns->parent)
+ || (sym->ns && gfc_current_ns->parent
+ && sym->ns == gfc_current_ns->parent->parent)
+ || (sym->ns->proc_name != NULL
+ && sym->ns->proc_name->attr.flavor == FL_MODULE)
+ || (gfc_is_formal_arg () && (sym->ns == gfc_current_ns)))
{
t = SUCCESS;
break;
@@ -2576,7 +2584,8 @@ check_restricted (gfc_expr *e)
gfc_error ("Variable '%s' cannot appear in the expression at %L",
sym->name, &e->where);
-
+ /* Prevent a repetition of the error. */
+ e->error = 1;
break;
case EXPR_NULL:
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 60d9baccf9b..b032486abfd 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -637,10 +637,10 @@ typedef struct
unsigned function:1, subroutine:1, procedure:1;
unsigned generic:1, generic_copy:1;
unsigned implicit_type:1; /* Type defined via implicit rules. */
- unsigned untyped:1; /* No implicit type could be found. */
+ unsigned untyped:1; /* No implicit type could be found. */
- unsigned is_bind_c:1; /* say if is bound to C */
- unsigned extension:1; /* extends a derived type */
+ unsigned is_bind_c:1; /* say if is bound to C. */
+ unsigned extension:1; /* extends a derived type. */
/* These flags are both in the typespec and attribute. The attribute
list is what gets read from/written to a module file. The typespec
@@ -1037,6 +1037,7 @@ typedef struct gfc_typebound_proc
unsigned non_overridable:1;
unsigned is_generic:1;
unsigned function:1, subroutine:1;
+ unsigned error:1; /* Ignore it, when an error occurred during resolution. */
}
gfc_typebound_proc;
@@ -1546,6 +1547,10 @@ typedef struct gfc_expr
and if we have decided not to allocate temporary data for that array. */
unsigned int inline_noncopying_intrinsic : 1, is_boz : 1;
+ /* Sometimes, when an error has been emitted, it is necessary to prevent
+ it from recurring. */
+ unsigned int error : 1;
+
/* Used to quickly find a given constructor by its offset. */
splay_tree con_by_offset;
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 762114c2b75..3846d953e6b 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3806,11 +3806,14 @@ load_equiv (void)
mio_expr (&tail->expr);
}
- /* Unused equivalence members have a unique name. */
+ /* Unused equivalence members have a unique name. In addition, it
+ must be checked that the symbol is that from the module. */
unused = true;
for (eq = head; eq; eq = eq->eq)
{
- if (!check_unique_name (eq->expr->symtree->name))
+ if (eq->expr->symtree->n.sym->module
+ && strcmp (module_name, eq->expr->symtree->n.sym->module) == 0
+ && !check_unique_name (eq->expr->symtree->name))
{
unused = false;
break;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index d682e10dd5a..6976e64e0c8 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4366,6 +4366,8 @@ fixup_charlen (gfc_expr *e)
static gfc_actual_arglist*
update_arglist_pass (gfc_actual_arglist* lst, gfc_expr* po, unsigned argpos)
{
+ gcc_assert (argpos > 0);
+
if (argpos == 1)
{
gfc_actual_arglist* result;
@@ -4417,6 +4419,9 @@ update_compcall_arglist (gfc_expr* e)
tbp = e->value.compcall.tbp;
+ if (tbp->error)
+ return FAILURE;
+
po = extract_compcall_passed_object (e);
if (!po)
return FAILURE;
@@ -4497,6 +4502,10 @@ resolve_typebound_generic_call (gfc_expr* e)
bool matches;
gcc_assert (g->specific);
+
+ if (g->specific->error)
+ continue;
+
target = g->specific->u.specific->n.sym;
/* Get the right arglist by handling PASS/NOPASS. */
@@ -4508,6 +4517,8 @@ resolve_typebound_generic_call (gfc_expr* e)
if (!po)
return FAILURE;
+ gcc_assert (g->specific->pass_arg_num > 0);
+ gcc_assert (!g->specific->error);
args = update_arglist_pass (args, po, g->specific->pass_arg_num);
}
resolve_actual_arglist (args, target->attr.proc,
@@ -8448,10 +8459,12 @@ resolve_typebound_procedure (gfc_symtree* stree)
goto error;
}
+ stree->typebound->error = 0;
return;
error:
resolve_bindings_result = FAILURE;
+ stree->typebound->error = 1;
}
static gfc_try
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 1c4b97db1fd..a92ce91f2a3 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -661,7 +661,7 @@ create_file_names (const char *file_name)
base = !stat (object_directory, &status) && S_ISDIR (status.st_mode);
strcat (name, object_directory);
- if (base && name[strlen (name) - 1] != '/')
+ if (base && (! IS_DIR_SEPARATOR (name[strlen (name) - 1])))
strcat (name, "/");
}
else
@@ -674,8 +674,8 @@ create_file_names (const char *file_name)
if (base)
{
/* Append source file name. */
- cptr = strrchr (file_name, '/');
- strcat (name, cptr ? cptr + 1 : file_name);
+ const char *cptr = lbasename (file_name);
+ strcat (name, cptr ? cptr : file_name);
}
/* Remove the extension. */
@@ -1482,7 +1482,7 @@ function_summary (const coverage_t *coverage, const char *title)
static char *
make_gcov_file_name (const char *input_name, const char *src_name)
{
- char *cptr;
+ const char *cptr;
char *name;
if (flag_long_names && input_name && strcmp (src_name, input_name))
@@ -1490,8 +1490,8 @@ make_gcov_file_name (const char *input_name, const char *src_name)
name = XNEWVEC (char, strlen (src_name) + strlen (input_name) + 10);
name[0] = 0;
/* Generate the input filename part. */
- cptr = flag_preserve_paths ? NULL : strrchr (input_name, '/');
- strcat (name, cptr ? cptr + 1 : input_name);
+ cptr = flag_preserve_paths ? NULL : lbasename (input_name);
+ strcat (name, cptr ? cptr : input_name);
strcat (name, "##");
}
else
@@ -1501,39 +1501,52 @@ make_gcov_file_name (const char *input_name, const char *src_name)
}
/* Generate the source filename part. */
- cptr = flag_preserve_paths ? NULL : strrchr (src_name, '/');
- strcat (name, cptr ? cptr + 1 : src_name);
+
+ cptr = flag_preserve_paths ? NULL : lbasename (src_name);
+ strcat (name, cptr ? cptr : src_name);
if (flag_preserve_paths)
{
- /* Convert '/' to '#', remove '/./', convert '/../' to '/^/' */
- char *prev;
+ /* Convert '/' and '\' to '#', remove '/./', convert '/../' to '/^/',
+ convert ':' to '~' on DOS based file system. */
+ char *pnew = name, *pold = name;
- for (cptr = name; (cptr = strchr ((prev = cptr), '/'));)
- {
- unsigned shift = 0;
+ /* First check for leading drive separator. */
- if (prev + 1 == cptr && prev[0] == '.')
+ while (*pold != '\0')
+ {
+ if (*pold == '/' || *pold == '\\')
{
- /* Remove '.' */
- shift = 2;
+ *pnew++ = '#';
+ pold++;
}
- else if (prev + 2 == cptr && prev[0] == '.' && prev[1] == '.')
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ else if (*pold == ':')
{
- /* Convert '..' */
- shift = 1;
- prev[1] = '^';
+ *pnew++ = '~';
+ pold++;
}
- else
- *cptr++ = '#';
- if (shift)
+#endif
+ else if ((*pold == '/' && strstr (pold, "/./") == pold)
+ || (*pold == '\\' && strstr (pold, "\\.\\") == pold))
+ pold += 3;
+ else if (*pold == '/' && strstr (pold, "/../") == pold)
{
- cptr = prev;
- do
- prev[0] = prev[shift];
- while (*prev++);
+ strcpy (pnew, "/^/");
+ pnew += 3;
+ pold += 4;
}
+ else if (*pold == '\\' && strstr (pold, "\\..\\") == pold)
+ {
+ strcpy (pnew, "\\^\\");
+ pnew += 3;
+ pold += 4;
+ }
+ else
+ *pnew++ = *pold++;
}
+
+ *pnew = '\0';
}
strcat (name, ".gcov");
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a390590d705..a6947c33405 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2602,7 +2602,7 @@ static inline void
gimple_bind_set_block (gimple gs, tree block)
{
GIMPLE_CHECK (gs, GIMPLE_BIND);
- gcc_assert (TREE_CODE (block) == BLOCK);
+ gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
gs->gimple_bind.block = block;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index d723d9f16a9..2befb43ecff 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -772,7 +772,7 @@ declare_vars (tree vars, gimple scope, bool debug_info)
temps = nreverse (last);
- block = gimple_block (scope);
+ block = gimple_bind_block (scope);
gcc_assert (!block || TREE_CODE (block) == BLOCK);
if (!block || !debug_info)
{
@@ -7366,10 +7366,10 @@ gimplify_function_tree (tree fndecl)
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
gimplify_seq_add_stmt (&body, gimple_build_call (x, 0));
gimplify_seq_add_stmt (&body, tf);
- new_bind = gimple_build_bind (NULL, body, gimple_block (bind));
+ new_bind = gimple_build_bind (NULL, body, gimple_bind_block (bind));
/* Clear the block for BIND, since it is no longer directly inside
the function, but within a try block. */
- gimple_set_block (bind, NULL);
+ gimple_bind_set_block (bind, NULL);
/* Replace the current function body with the body
wrapped in the try/finally TF. */
diff --git a/gcc/stringpool.c b/gcc/stringpool.c
index 9146fbf4f7d..d8d66f2418f 100644
--- a/gcc/stringpool.c
+++ b/gcc/stringpool.c
@@ -18,9 +18,8 @@ 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/>. */
-/* String text, identifier text and identifier node allocator. Strings
- allocated by ggc_alloc_string are stored in an obstack which is
- never shrunk. Identifiers are uniquely stored in a hash table.
+/* String text, identifier text and identifier node allocator.
+ Identifiers are uniquely stored in a hash table.
We use cpplib's hash table implementation. libiberty's
hashtab.c is not used because it requires 100% average space
@@ -76,9 +75,7 @@ alloc_node (hash_table *table ATTRIBUTE_UNUSED)
/* Allocate and return a string constant of length LENGTH, containing
CONTENTS. If LENGTH is -1, CONTENTS is assumed to be a
- nul-terminated string, and the length is calculated using strlen.
- If the same string constant has been allocated before, that copy is
- returned this time too. */
+ nul-terminated string, and the length is calculated using strlen. */
const char *
ggc_alloc_string (const char *contents, int length)
@@ -94,7 +91,8 @@ ggc_alloc_string (const char *contents, int length)
return digit_string (contents[0] - '0');
result = GGC_NEWVAR (char, length + 1);
- memcpy (result, contents, length + 1);
+ memcpy (result, contents, length);
+ result[length] = '\0';
return (const char *) result;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7894386318c..df7ba0b1e96 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,32 @@
+2008-10-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35680
+ * gfortran.dg/transfer_array_intrinsic_5.f90: New test.
+
+2008-10-05 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37638
+ * gfortran.dg/typebound_call_9.f03: New test.
+
+2008-10-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37706
+ * gfortran.dg/module_equivalence_4.f90: New test.
+
+2008-10-04 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-pre-21.c: New testcase.
+
+2008-10-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/37726
+ * gcc.dg/debug/dwarf2/pr37726.c: New test.
+
+2008-10-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37719
+ * g++.dg/template/error36.C: New.
+
2008-10-02 Steven Bosscher <steven@gcc.gnu.org>
PR fortran/37635
diff --git a/gcc/testsuite/g++.dg/template/error36.C b/gcc/testsuite/g++.dg/template/error36.C
new file mode 100644
index 00000000000..b16b976e382
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error36.C
@@ -0,0 +1,9 @@
+// PR c++/37719.C
+
+template <typename T>
+class foo {
+ void bar() throw(int); // { dg-error "throw \\(int\\)" }
+};
+
+template <>
+void foo<int>::bar() throw(float) {} // { dg-error "throw \\(float\\)" }
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c
new file mode 100644
index 00000000000..60fb8396169
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c
@@ -0,0 +1,25 @@
+/* PR debug/37726 */
+/* { dg-do compile } */
+/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */
+
+int foo (int parm)
+{
+ int var = 0;
+ int bar (void)
+ {
+ return parm + var;
+ }
+ parm++;
+ var++;
+ return bar ();
+}
+
+int
+main (void)
+{
+ return foo (4) - 6;
+}
+
+/* Both parm and var variables should be in debug info for both foo and bar. */
+/* { dg-final { scan-assembler-times "\"parm\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */
+/* { dg-final { scan-assembler-times "\"var\[^\n\]*\"\[^\n\]*DW_AT_name" 2 } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-21.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-21.c
new file mode 100644
index 00000000000..65a73d2a0f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-21.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre" } */
+
+long
+NumSift (long *array, unsigned long k)
+{
+ if (array[k] < array[k + 1L])
+ ++k;
+ return array[k];
+}
+
+/* There should be only two loads left. */
+
+/* { dg-final { scan-tree-dump-times "= \\\*D" 2 "pre" } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_4.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
new file mode 100644
index 00000000000..7a8ef9c7cdf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! This checks the fix for PR37706 in which the equivalence would be
+! inserted into the 'nudata' namespace with the inevitable consequences.
+!
+! Contributed by Lester Petrie <petrielmjr@ornl.gov>
+!
+module data_C
+ integer, dimension(200) :: l = (/(201-i, i = 1,200)/)
+ integer :: l0
+ integer :: l24, l27, l28, l29
+ equivalence ( l(1), l0 )
+ end module data_C
+
+subroutine nudata(nlibe, a, l)
+ USE data_C, only: l24, l27, l28, l29
+ implicit none
+ integer :: nlibe
+ integer :: l(*)
+ real :: a(*)
+ print *, l(1), l(2)
+ return
+end subroutine nudata
+
+ integer :: l_(2) = (/1,2/), nlibe_ = 42
+ real :: a_(2) = (/1.,2./)
+ call nudata (nlibe_, a_, l_)
+end
+
+! { dg-final { cleanup-modules "data_C" } }
diff --git a/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_5.f90 b/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_5.f90
new file mode 100644
index 00000000000..c886b03f665
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_5.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! PR35680 - used to ICE because the argument of SIZE, being in a restricted
+! expression, was not checked if it too is restricted or is a variable. Since
+! it is neither, an error should be produced.
+!
+! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+!
+program main
+ print *, foo (), bar (), foobar ()
+contains
+ function foo ()
+ integer foo(size (transfer (x, [1]))) ! { dg-error "cannot appear" }
+ real x
+ end function
+ function bar()
+ real x
+ integer bar(size (transfer (x, [1]))) ! { dg-error "cannot appear" }
+ end function
+ function foobar() ! { dg-error "no IMPLICIT" }
+ implicit none
+ integer foobar(size (transfer (x, [1]))) ! { dg-error "used before" }
+ real x
+ end function
+end program
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_9.f03 b/gcc/testsuite/gfortran.dg/typebound_call_9.f03
new file mode 100644
index 00000000000..f2e128d3cb2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_9.f03
@@ -0,0 +1,63 @@
+! { dg-do compile }
+
+! FIXME: Remove once polymorphic PASS is resolved
+! { dg-options "-w" }
+
+! PR fortran/37638
+! If a PASS(arg) is invalid, a call to this routine later would ICE in
+! resolving. Check that this also works for GENERIC, in addition to the
+! PR's original test.
+
+! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
+
+module foo_mod
+ implicit none
+
+ type base_foo_type
+ integer :: nr,nc
+ integer, allocatable :: iv1(:), iv2(:)
+
+ contains
+
+ procedure, pass(a) :: makenull ! { dg-error "has no argument 'a'" }
+ generic :: null2 => makenull
+
+ end type base_foo_type
+
+contains
+
+ subroutine makenull(m)
+ implicit none
+ type(base_foo_type), intent(inout) :: m
+
+ m%nr=0
+ m%nc=0
+
+ end subroutine makenull
+
+ subroutine foo_free(a,info)
+ implicit none
+ Type(base_foo_type), intent(inout) :: A
+ Integer, intent(out) :: info
+ integer :: iret
+ info = 0
+
+
+ if (allocated(a%iv1)) then
+ deallocate(a%iv1,stat=iret)
+ if (iret /= 0) info = max(info,2)
+ endif
+ if (allocated(a%iv2)) then
+ deallocate(a%iv2,stat=iret)
+ if (iret /= 0) info = max(info,3)
+ endif
+
+ call a%makenull()
+ call a%null2 () ! { dg-error "no matching specific binding" }
+
+ Return
+ End Subroutine foo_free
+
+end module foo_mod
+
+! { dg-final { cleanup-modules "foo_mod" } }
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index bfe909d6738..aa01258da70 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1,5 +1,5 @@
/* Reassociation for trees.
- Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org>
This file is part of GCC.
@@ -154,7 +154,7 @@ along with GCC; see the file COPYING3. If not see
Thus, this is what we do. When we have three ops left, we check to see
what order to put them in, and call it a day. As a nod to vector sum
- reduction, we check if any of ops are a really a phi node that is a
+ reduction, we check if any of the ops are really a phi node that is a
destructive update for the associating op, and keep the destructive
update together for vector sum reduction recognition. */
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 290b308b907..082a2785ff7 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -387,7 +387,7 @@ vn_reference_op_eq (const void *p1, const void *p2)
const_vn_reference_op_t const vro1 = (const_vn_reference_op_t) p1;
const_vn_reference_op_t const vro2 = (const_vn_reference_op_t) p2;
return vro1->opcode == vro2->opcode
- && vro1->type == vro2->type
+ && types_compatible_p (vro1->type, vro2->type)
&& expressions_equal_p (vro1->op0, vro2->op0)
&& expressions_equal_p (vro1->op1, vro2->op1)
&& expressions_equal_p (vro1->op2, vro2->op2);
@@ -1184,7 +1184,7 @@ vn_nary_op_eq (const void *p1, const void *p2)
unsigned i;
if (vno1->opcode != vno2->opcode
- || vno1->type != vno2->type)
+ || !types_compatible_p (vno1->type, vno2->type))
return false;
for (i = 0; i < vno1->length; ++i)
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 39be98972ae..278bb06d6b8 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,14 @@
+2008-10-05 Matthew Gingell <gingell@adacore.com>
+ Arnaud Charlet <charlet@adacore.com>
+
+ * include/cpplib.h (cpp_comments, cpp_comment_table): New structs.
+ (cpp_get_comments): New function.
+ * internal.h (struct cpp_reader): Add comments field.
+ * init.c (cpp_destroy): Free comments.
+ * lex.c (store_comment, cpp_get_comments): New functions.
+ (comments): New struct.
+ (save_comment): Store comments in comments struct.
+
2008-09-18 Simon Baldwin <simonb@google.com>
* include/cpplib.h (struct cpp_options): Add new boolean flag
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 4f073f99433..5720c6fc8ea 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -870,6 +870,36 @@ extern const char *cpp_type2name (enum cpp_ttype);
extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr,
const unsigned char *limit, int wide);
+/* Structure used to hold a comment block at a given location in the
+ source code. */
+
+typedef struct
+{
+ /* Text of the comment including the terminators. */
+ char *comment;
+
+ /* source location for the given comment. */
+ source_location sloc;
+} cpp_comment;
+
+/* Structure holding all comments for a given cpp_reader. */
+
+typedef struct
+{
+ /* table of comment entries. */
+ cpp_comment *entries;
+
+ /* number of actual entries entered in the table. */
+ int count;
+
+ /* number of entries allocated currently. */
+ int allocated;
+} cpp_comment_table;
+
+/* Returns the table of comments encountered by the preprocessor. This
+ table is only populated when pfile->state.save_comments is true. */
+extern cpp_comment_table *cpp_get_comments (cpp_reader *);
+
/* In hash.c */
/* Lookup an identifier in the hashtable. Puts the identifier in the
diff --git a/libcpp/init.c b/libcpp/init.c
index 0db167c133c..cc7a09ed8c2 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -245,6 +245,7 @@ cpp_destroy (cpp_reader *pfile)
{
cpp_context *context, *contextn;
tokenrun *run, *runn;
+ int i;
free (pfile->op_stack);
@@ -287,6 +288,14 @@ cpp_destroy (cpp_reader *pfile)
free (context);
}
+ if (pfile->comments.entries)
+ {
+ for (i = 0; i < pfile->comments.count; i++)
+ free (pfile->comments.entries[i].comment);
+
+ free (pfile->comments.entries);
+ }
+
free (pfile);
}
diff --git a/libcpp/internal.h b/libcpp/internal.h
index c5bf35eab84..af075b4b1c9 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -471,6 +471,9 @@ struct cpp_reader
/* Next value of __COUNTER__ macro. */
unsigned int counter;
+
+ /* Table of comments, when state.save_comments is true. */
+ cpp_comment_table comments;
};
/* Character classes. Based on the more primitive macros in safe-ctype.h.
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 2eb66bd6342..57364f00bb9 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -55,6 +55,7 @@ static int skip_line_comment (cpp_reader *);
static void skip_whitespace (cpp_reader *, cppchar_t);
static void lex_string (cpp_reader *, cpp_token *, const uchar *);
static void save_comment (cpp_reader *, cpp_token *, const uchar *, cppchar_t);
+static void store_comment (cpp_reader *, cpp_token *);
static void create_literal (cpp_reader *, cpp_token *, const uchar *,
unsigned int, enum cpp_ttype);
static bool warn_in_comment (cpp_reader *, _cpp_line_note *);
@@ -670,6 +671,51 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
create_literal (pfile, token, base, cur - base, type);
}
+/* Return the comment table. The client may not make any assumption
+ about the ordering of the table. */
+cpp_comment_table *
+cpp_get_comments (cpp_reader *pfile)
+{
+ return &pfile->comments;
+}
+
+/* Append a comment to the end of the comment table. */
+static void
+store_comment (cpp_reader *pfile, cpp_token *token)
+{
+ int len;
+
+ if (pfile->comments.allocated == 0)
+ {
+ pfile->comments.allocated = 256;
+ pfile->comments.entries = (cpp_comment *) xmalloc
+ (pfile->comments.allocated * sizeof (cpp_comment));
+ }
+
+ if (pfile->comments.count == pfile->comments.allocated)
+ {
+ pfile->comments.allocated *= 2;
+ pfile->comments.entries = (cpp_comment *) xrealloc
+ (pfile->comments.entries,
+ pfile->comments.allocated * sizeof (cpp_comment));
+ }
+
+ len = token->val.str.len;
+
+ /* Copy comment. Note, token may not be NULL terminated. */
+ pfile->comments.entries[pfile->comments.count].comment =
+ (char *) xmalloc (sizeof (char) * (len + 1));
+ memcpy (pfile->comments.entries[pfile->comments.count].comment,
+ token->val.str.text, len);
+ pfile->comments.entries[pfile->comments.count].comment[len] = '\0';
+
+ /* Set source location. */
+ pfile->comments.entries[pfile->comments.count].sloc = token->src_loc;
+
+ /* Increment the count of entries in the comment table. */
+ pfile->comments.count++;
+}
+
/* The stored comment includes the comment start and any terminator. */
static void
save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from,
@@ -709,6 +755,9 @@ save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from,
buffer[clen - 2] = '*';
buffer[clen - 1] = '/';
}
+
+ /* Finally store this comment for use by clients of libcpp. */
+ store_comment (pfile, token);
}
/* Allocate COUNT tokens for RUN. */
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b6d61220630..153e6947eb7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/20_util/reference_wrapper/invoke.cc: New.
+ * testsuite/20_util/reference_wrapper/24803.cc: Likewise.
+ * testsuite/20_util/reference_wrapper/typedefs.cc: Likewise.
+
2008-10-01 Andrew Pinski <andrew_pinski@playstation.sony.com>
* config/locale/generic/c_locale.cc (__convert_to_v): Fix
diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
new file mode 100644
index 00000000000..eb3d9975a9c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/24803.cc
@@ -0,0 +1,89 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// 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.
+
+#include <functional>
+
+struct test_type
+{
+ int member();
+ int cmember()const;
+ int member2(char);
+ int cmember2(char)const;
+};
+
+struct functor1 : public std::unary_function<int, double>
+{
+ double operator()(int) const;
+};
+
+struct functor2 : public std::binary_function<int, char, double>
+{
+ double operator()(int, char) const;
+};
+
+template <class T>
+void verify_return_type(T, T)
+{
+}
+
+void test01()
+{
+ test_type* null_tt = 0;
+ const test_type* null_ttc = 0;
+ int zero;
+
+ std::reference_wrapper<double (int)>* pr1;
+ verify_return_type((*pr1)(0), double());
+ std::reference_wrapper<double (*)(int)>* pr2;
+ verify_return_type((*pr2)(0), double());
+ std::reference_wrapper<int (test_type::*)()>* pr3;
+ verify_return_type((*pr3)(null_tt), int());
+ std::reference_wrapper<int (test_type::*)()const>* pr4;
+ verify_return_type((*pr4)(null_ttc), int());
+ std::reference_wrapper<functor1>* pr5;
+
+ // libstdc++/24803
+ // FIXME: verify_return_type((*pr5)(0), double());
+ verify_return_type((*pr5)(zero), double());
+
+ std::reference_wrapper<double (int, char)>* pr1b;
+ verify_return_type((*pr1b)(0,0), double());
+ std::reference_wrapper<double (*)(int, char)>* pr2b;
+ verify_return_type((*pr2b)(0,0), double());
+ std::reference_wrapper<int (test_type::*)(char)>* pr3b;
+ verify_return_type((*pr3b)(null_tt,zero), int());
+ std::reference_wrapper<int (test_type::*)()const>* pr4b;
+ verify_return_type((*pr4b)(null_ttc), int());
+ std::reference_wrapper<functor2>* pr5b;
+
+ // libstdc++/24803
+ // FIXME: verify_return_type((*pr5b)(0,0), double());
+ verify_return_type((*pr5b)(zero,zero), double());
+}
diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
new file mode 100644
index 00000000000..77047db06c4
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/invoke.cc
@@ -0,0 +1,115 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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.
+
+#include <functional>
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+bool test __attribute__((unused)) = true;
+
+struct X
+{
+ typedef int result_type;
+
+ X() : bar(17) {}
+
+ int foo(float x) { return truncate_float(x); }
+ int foo_c(float x) const { return truncate_float(x); }
+ int foo_v(float x) volatile { return truncate_float(x); }
+ int foo_cv(float x) const volatile { return truncate_float(x); }
+
+ int operator()(float x)
+ {
+ return foo(x) + 1;
+ }
+
+ int operator()(float x) const
+ {
+ return foo_c(x) + 2;
+ }
+
+ int bar;
+
+ private:
+ X(const X&);
+ X& operator=(const X&);
+};
+
+int seventeen() { return 17; }
+
+struct get_seventeen
+{
+ typedef int result_type;
+ int operator()() const { return 17; }
+};
+
+void test01()
+{
+ using std::ref;
+ using std::cref;
+
+ ::get_seventeen get_sev;
+ ::X x;
+ ::X* xp = &x;
+ int (::X::* p_foo)(float) = &::X::foo;
+ int (::X::* p_foo_c)(float) const = &::X::foo_c;
+ int (::X::* p_foo_v)(float) volatile = &::X::foo_v;
+ int (::X::* p_foo_cv)(float) const volatile = &::X::foo_cv;
+ int ::X::* p_bar = &::X::bar;
+
+ const float pi = 3.14;
+
+ // Functions
+ VERIFY(ref(truncate_float)(pi) == 3);
+ VERIFY(ref(seventeen)() == 17);
+
+ // Function pointers
+ VERIFY(cref(&truncate_float)(pi) == 3);
+ VERIFY(cref(&seventeen)() == 17);
+
+ // Member function pointers
+ VERIFY(ref(p_foo)(x, pi) == 3);
+ VERIFY(ref(p_foo)(xp, pi) == 3);
+ VERIFY(ref(p_foo_c)(x, pi) == 3);
+ VERIFY(ref(p_foo_c)(xp, pi) == 3);
+ VERIFY(ref(p_foo_v)(x, pi) == 3);
+ VERIFY(ref(p_foo_v)(xp, pi) == 3);
+ VERIFY(ref(p_foo_cv)(x, pi) == 3);
+ VERIFY(ref(p_foo_cv)(xp, pi) == 3);
+
+ // Member data pointers
+ VERIFY(ref(p_bar)(x) == 17);
+ VERIFY(ref(p_bar)(xp) == 17);
+
+ // Function objects
+ VERIFY(ref(get_sev)() == 17);
+ VERIFY(cref(get_sev)() == 17);
+ VERIFY(ref(x)(pi) == 4);
+ VERIFY(cref(x)(pi) == 5);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
new file mode 100644
index 00000000000..36b57a89a03
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs.cc
@@ -0,0 +1,88 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// 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.
+
+#include <functional>
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+struct X {};
+
+struct int_result_type { typedef int result_type; };
+
+struct derives_unary : std::unary_function<int, int> {};
+
+struct derives_binary : std::binary_function<int, float, int> {};
+
+struct derives_unary_binary
+ : std::unary_function<int, int>,
+ std::binary_function<int, float, int>
+{
+ typedef int result_type;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using std::reference_wrapper;
+ using std::is_same;
+ using std::is_convertible;
+ using std::unary_function;
+ using std::binary_function;
+
+ // Check result_type typedef
+ VERIFY((is_same<reference_wrapper<int_result_type>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<derives_unary>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<derives_binary>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<derives_unary_binary>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<int(void)>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<int(*)(void)>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<int (::X::*)()>::result_type, int>::value));
+ VERIFY((is_same<reference_wrapper<int (::X::*)(float)>::result_type, int>::value));
+
+ // Check derivation from unary_function
+ VERIFY((is_convertible<reference_wrapper<derives_unary>*, unary_function<int, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<derives_unary_binary>*, unary_function<int, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int(int)>*, unary_function<int, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int(*)(int)>*, unary_function<int, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)()>*, unary_function< ::X*, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)() const>*, unary_function<const ::X*, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)() volatile>*, unary_function<volatile ::X*, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)() const volatile>*, unary_function<const volatile ::X*, int>*>::value));
+
+ // Check derivation from binary_function
+ VERIFY((is_convertible<reference_wrapper<derives_binary>*, binary_function<int, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<derives_unary_binary>*, binary_function<int, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int(int, float)>*, binary_function<int, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int(*)(int, float)>*, binary_function<int, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)(float)>*, binary_function< ::X*, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) const>*, binary_function<const ::X*, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) volatile>*, binary_function<volatile ::X*, float, int>*>::value));
+ VERIFY((is_convertible<reference_wrapper<int (::X::*)(float) const volatile>*, binary_function<const volatile ::X*, float, int>*>::value));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index 734a2d7d5d7..27f1c59239b 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-04 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * gcc_release: Fix a couple of comments.
+
2008-07-04 Joseph Myers <joseph@codesourcery.com>
* crontab: Remove 4.1 snapshots job.
diff --git a/maintainer-scripts/gcc_release b/maintainer-scripts/gcc_release
index 467ec4e4aca..cb44b19bc76 100755
--- a/maintainer-scripts/gcc_release
+++ b/maintainer-scripts/gcc_release
@@ -232,10 +232,10 @@ EOF
xargs md5sum >>MD5SUMS
}
-# Buid a single tarfile. The first argument is the name of the name
-# of the tarfile to build, without any suffixes. They will be added
-# automatically. The rest of the arguments are the files or
-# directories to include, and possibly other arguments to tar.
+# Build a single tarfile. The first argument is the name of the tarfile
+# to build, without any suffixes. They will be added automatically. The
+# rest of the arguments are files or directories to include, and possibly
+# other arguments to tar.
build_tarfile() {
# Get the name of the destination tar file.
@@ -384,7 +384,7 @@ upload_files() {
done
}
-#Print description if snapshot exists
+# Print description if snapshot exists.
snapshot_print() {
if [ -e ${RELEASE}/$1 ]; then
printf "%-38s%s\n\n" "$1" "$2" >> ${SNAPSHOT_README}
@@ -536,7 +536,7 @@ TAG=""
OLD_TARS=""
# The directory that will be used to construct the release. The
-# release itself will be placed in a subdirectory of this diretory.
+# release itself will be placed in a subdirectory of this directory.
DESTINATION=${HOME}
# The subdirectory.
WORKING_DIRECTORY=""
@@ -678,7 +678,7 @@ else
# If diffs are requested when building locally on gcc.gnu.org, we (usually)
# know what the last snapshot date was and take the corresponding tarballs,
- # unless the user specified tarballs explictly.
+ # unless the user specified tarballs explicitly.
if [ $MODE_DIFFS -ne 0 ] && [ $LOCAL -ne 0 ] && [ -z "${OLD_TARS}" ]; then
LAST_DATE=`cat ~/.snapshot_date-${BRANCH}`
OLD_TARS=${SNAPSHOTS_DIR}/${BRANCH}-${LAST_DATE}/gcc-${BRANCH}-${LAST_DATE}.tar.bz2