This commit is contained in:
Jakub Jelinek 2007-12-12 14:09:21 +00:00
parent 6d24351ab8
commit 56d2e81901
8 changed files with 397 additions and 99 deletions

View File

@ -0,0 +1,33 @@
2007-12-10 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (gen_array_type_die, gen_descr_array_type_die): For
Fortran multi-dimensional arrays use DW_AT_ordering
DW_ORD_col_major.
--- gcc/dwarf2out.c (revision 130741)
+++ gcc/dwarf2out.c (revision 130742)
@@ -11636,6 +11636,12 @@ gen_array_type_die (tree type, dw_die_re
add_AT_flag (array_die, DW_AT_GNU_vector, 1);
}
+ /* For Fortran multidimensional arrays use DW_ORD_col_major ordering. */
+ if (is_fortran ()
+ && TREE_CODE (type) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (type)) == ARRAY_TYPE)
+ add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major);
+
#if 0
/* We default the array ordering. SDB will probably do
the right things even if DW_AT_ordering is not present. It's not even
@@ -11787,6 +11793,11 @@ gen_descr_array_type_die (tree type, str
add_name_attribute (array_die, type_tag (type));
equate_type_number_to_die (type, array_die);
+ /* For Fortran multidimensional arrays use DW_ORD_col_major ordering. */
+ if (is_fortran ()
+ && info->ndimensions >= 2)
+ add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major);
+
if (info->data_location)
add_descr_info_field (array_die, DW_AT_data_location, info->data_location,
info->base_decl);

133
gcc41-omp-outer-ctx.patch Normal file
View File

@ -0,0 +1,133 @@
2007-12-03 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lookup_decl_in_outer_ctx): Allow calling this
with !ctx->is_nested.
(maybe_lookup_decl_in_outer_ctx): Look up in outer contexts
even if !ctx->is_nested.
(lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars): Call lookup_decl_in_outer_ctx
unconditionally.
* testsuite/libgomp.c/private-1.c: New test.
--- gcc/omp-low.c (revision 130589)
+++ gcc/omp-low.c (revision 130590)
@@ -1518,12 +1518,10 @@ lookup_decl_in_outer_ctx (tree decl, omp
tree t;
omp_context *up;
- gcc_assert (ctx->is_nested);
-
for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
t = maybe_lookup_decl (decl, up);
- gcc_assert (t || is_global_var (decl));
+ gcc_assert (!ctx->is_nested || t || is_global_var (decl));
return t ? t : decl;
}
@@ -1538,9 +1536,8 @@ maybe_lookup_decl_in_outer_ctx (tree dec
tree t = NULL;
omp_context *up;
- if (ctx->is_nested)
- for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
- t = maybe_lookup_decl (decl, up);
+ for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
+ t = maybe_lookup_decl (decl, up);
return t ? t : decl;
}
@@ -2012,7 +2009,7 @@ lower_copyprivate_clauses (tree clauses,
by_ref = use_pointer_for_field (var, false);
ref = build_sender_ref (var, ctx);
- x = (ctx->is_nested) ? lookup_decl_in_outer_ctx (var, ctx) : var;
+ x = lookup_decl_in_outer_ctx (var, ctx);
x = by_ref ? build_fold_addr_expr (x) : x;
x = build_gimple_modify_stmt (ref, x);
gimplify_and_add (x, slist);
@@ -2053,9 +2050,8 @@ lower_send_clauses (tree clauses, tree *
continue;
}
- var = val = OMP_CLAUSE_DECL (c);
- if (ctx->is_nested)
- var = lookup_decl_in_outer_ctx (val, ctx);
+ val = OMP_CLAUSE_DECL (c);
+ var = lookup_decl_in_outer_ctx (val, ctx);
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_COPYIN
&& is_global_var (var))
@@ -2127,13 +2123,10 @@ lower_send_shared_vars (tree *ilist, tre
if (!nvar || !DECL_HAS_VALUE_EXPR_P (nvar))
continue;
- var = ovar;
-
/* If CTX is a nested parallel directive. Find the immediately
enclosing parallel or workshare construct that contains a
mapping for OVAR. */
- if (ctx->is_nested)
- var = lookup_decl_in_outer_ctx (ovar, ctx);
+ var = lookup_decl_in_outer_ctx (ovar, ctx);
if (use_pointer_for_field (ovar, true))
{
--- libgomp/testsuite/libgomp.c/private-1.c (revision 0)
+++ libgomp/testsuite/libgomp.c/private-1.c (revision 130590)
@@ -0,0 +1,54 @@
+extern void abort (void);
+
+int a = 18;
+
+void
+f1 (int i, int j, int k)
+{
+ int l = 6, m = 7, n = 8;
+#pragma omp parallel private(j, m) shared(k, n) firstprivate(i, l) \
+ num_threads(1)
+ {
+ j = 6;
+ m = 5;
+ if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9)
+ #pragma omp atomic
+ k++;
+ }
+ if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9)
+ abort ();
+}
+
+int v1 = 1, v2 = 2, v5 = 5;
+int err;
+
+void
+f2 (void)
+{
+ int v3 = 3;
+#pragma omp sections private (v1) firstprivate (v2)
+ {
+ #pragma omp section
+ {
+ int v4 = 4;
+ v1 = 7;
+ #pragma omp parallel num_threads(1) firstprivate(v1, v2, v3, v4)
+ {
+ if (++v1 != 8 || ++v2 != 3 || ++v3 != 4 || ++v4 != 5 || ++v5 != 6)
+ err = 1;
+ }
+ if (v1 != 7 || v2 != 2 || v3 != 3 || v4 != 4 || v5 != 6)
+ abort ();
+ if (err)
+ abort ();
+ }
+ }
+}
+
+int
+main (void)
+{
+ f1 (8, 26, 0);
+ f2 ();
+ return 0;
+}

View File

@ -1,60 +0,0 @@
2007-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34094
* decl2.c (cp_write_global_declarations): Issue error about static
data members in anonymous namespace which are declared and used,
but not defined.
* g++.dg/ext/visibility/anon7.C: New test.
--- gcc/cp/decl2.c (revision 130350)
+++ gcc/cp/decl2.c (revision 130351)
@@ -3365,7 +3365,21 @@ cp_write_global_declarations (void)
/* If this static data member is needed, provide it to the
back end. */
if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
- DECL_EXTERNAL (decl) = 0;
+ {
+ /* Error on
+ namespace { struct A { static int i; }; }
+ int foo () { return A::i; }
+ without A::i definition (which can't be defined in
+ a different CU because of the anonymous namespace).
+ Don't do this if DECL_INITIAL is set, because for
+ namespace { struct A { static const int i = 4; } };
+ decl_needed_p won't reliably detect whether it was
+ really needed. */
+ if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE)
+ error ("%Jstatic data member %qD used, but not defined",
+ decl, decl);
+ DECL_EXTERNAL (decl) = 0;
+ }
}
if (VEC_length (tree, pending_statics) != 0
&& wrapup_global_declarations (VEC_address (tree, pending_statics),
--- gcc/testsuite/g++.dg/ext/visibility/anon7.C (revision 0)
+++ gcc/testsuite/g++.dg/ext/visibility/anon7.C (revision 130351)
@@ -0,0 +1,23 @@
+// PR c++/34094
+// { dg-do compile }
+
+namespace
+{
+ struct A {
+ static int bar ();
+ static int i; // { dg-error "used, but not defined" }
+ static int j;
+ static int k;
+ static int l;
+ static const int m = 16;
+ static const int n = 17;
+ };
+ int A::j = 4;
+ int A::k;
+ const int A::m;
+}
+
+int foo (void)
+{
+ return A::i + A::j + A::k + A::m + A::n + A::bar ();
+}

128
gcc41-pr34178.patch Normal file
View File

@ -0,0 +1,128 @@
2007-12-09 Jakub Jelinek <jakub@redhat.com>
PR c++/34178
PR c++/34340
* repo.c (repo_emit_p): Return 2 for DECL_INTEGRAL_CONSTANT_VAR_P
in class scope rather than DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
Return 2 also if DECL_EXPLICIT_INSTANTIATION.
* decl2.c (import_export_decl): Don't make VAR_DECLs import_p when
flag_use_repository and repo_emit_p returned 2.
* g++.dg/template/repo6.C: New test.
* g++.dg/template/repo7.C: New test.
* g++.dg/template/repo8.C: New test.
--- gcc/cp/decl2.c (revision 130726)
+++ gcc/cp/decl2.c (revision 130727)
@@ -2230,7 +2230,8 @@ import_export_decl (tree decl)
{
/* DECL is an implicit instantiation of a function or static
data member. */
- if (flag_implicit_templates
+ if ((flag_implicit_templates
+ && !flag_use_repository)
|| (flag_implicit_inline_templates
&& TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (decl)))
--- gcc/cp/repo.c (revision 130726)
+++ gcc/cp/repo.c (revision 130727)
@@ -304,16 +304,19 @@ repo_emit_p (tree decl)
&& (!TYPE_LANG_SPECIFIC (type)
|| !CLASSTYPE_TEMPLATE_INSTANTIATION (type)))
return 2;
- /* Static data members initialized by constant expressions must
+ /* Const static data members initialized by constant expressions must
be processed where needed so that their definitions are
available. */
- if (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)
+ if (DECL_INTEGRAL_CONSTANT_VAR_P (decl)
&& DECL_CLASS_SCOPE_P (decl))
return 2;
}
else if (!DECL_TEMPLATE_INSTANTIATION (decl))
return 2;
+ if (DECL_EXPLICIT_INSTANTIATION (decl))
+ return 2;
+
/* For constructors and destructors, the repository contains
information about the clones -- not the original function --
because only the clones are emitted in the object file. */
--- gcc/testsuite/g++.dg/template/repo7.C (revision 0)
+++ gcc/testsuite/g++.dg/template/repo7.C (revision 130727)
@@ -0,0 +1,23 @@
+// PR c++/34340
+// { dg-options "-frepo" }
+// { dg-final { cleanup-repo-files } }
+
+struct A
+{
+ int a;
+};
+
+template <typename T> struct D
+{
+ static const A b;
+};
+
+template<typename T> const A D<T>::b = { 2 };
+template class D<A>;
+
+const A *x = &D<A>::b;
+
+int
+main ()
+{
+}
--- gcc/testsuite/g++.dg/template/repo8.C (revision 0)
+++ gcc/testsuite/g++.dg/template/repo8.C (revision 130727)
@@ -0,0 +1,22 @@
+// PR c++/34340
+// { dg-options "-frepo" }
+// { dg-final { cleanup-repo-files } }
+
+struct A
+{
+ int a;
+};
+
+template <typename T> struct D
+{
+ static const A b;
+};
+
+template<typename T> const A D<T>::b = { 2 };
+
+const A *x = &D<A>::b;
+
+int
+main ()
+{
+}
--- gcc/testsuite/g++.dg/template/repo6.C (revision 0)
+++ gcc/testsuite/g++.dg/template/repo6.C (revision 130727)
@@ -0,0 +1,24 @@
+// PR c++/34178
+// { dg-options "-frepo" }
+// { dg-final { cleanup-repo-files } }
+
+template<typename T>
+class A
+{
+private:
+ static const int x;
+ static int y;
+
+public:
+ int getX () { return x + y; }
+};
+
+template<typename T> const int A<T>::x = 0;
+template<typename T> int A<T>::y = 0;
+
+int
+main ()
+{
+ A<int> a;
+ return a.getX();
+}

View File

@ -1,34 +0,0 @@
2007-11-26 Jakub Jelinek <jakub@redhat.com>
PR c++/34238
* decl2.c (cp_write_global_declarations): Test
!DECL_INITIALIZED_IN_CLASS_P instead of checking NULL
DECL_INITIAL.
* g++.dg/ext/visibility/anon9.C: New test.
--- gcc/cp/decl2.c.jj 2007-11-22 15:03:54.000000000 +0100
+++ gcc/cp/decl2.c 2007-11-26 21:04:38.000000000 +0100
@@ -3375,7 +3375,7 @@ cp_write_global_declarations (void)
namespace { struct A { static const int i = 4; } };
decl_needed_p won't reliably detect whether it was
really needed. */
- if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE)
+ if (DECL_IN_AGGR_P (decl) && !DECL_INITIALIZED_IN_CLASS_P (decl))
error ("%Jstatic data member %qD used, but not defined",
decl, decl);
DECL_EXTERNAL (decl) = 0;
--- gcc/testsuite/g++.dg/ext/visibility/anon9.C.jj 2007-11-26 21:37:34.000000000 +0100
+++ gcc/testsuite/g++.dg/ext/visibility/anon9.C 2007-11-26 21:38:01.000000000 +0100
@@ -0,0 +1,11 @@
+// PR c++/34238
+// { dg-do compile }
+
+namespace
+{
+ template <typename T = int> struct A
+ {
+ static const bool a = true;
+ };
+}
+struct A<> a;

54
gcc41-pr34364.patch Normal file
View File

@ -0,0 +1,54 @@
2007-12-11 Jakub Jelinek <jakub@redhat.com>
PR c++/34364
* rtti.c (build_dynamic_cast): Call convert_from_reference even for
dynamic_cast in a template.
* g++.dg/rtti/dyncast2.C: New test.
--- gcc/cp/rtti.c (revision 130769)
+++ gcc/cp/rtti.c (revision 130770)
@@ -728,8 +728,7 @@ build_dynamic_cast (tree type, tree expr
{
expr = build_min (DYNAMIC_CAST_EXPR, type, expr);
TREE_SIDE_EFFECTS (expr) = 1;
-
- return expr;
+ return convert_from_reference (expr);
}
return convert_from_reference (build_dynamic_cast_1 (type, expr));
--- gcc/testsuite/g++.dg/rtti/dyncast2.C (revision 0)
+++ gcc/testsuite/g++.dg/rtti/dyncast2.C (revision 130770)
@@ -0,0 +1,31 @@
+// PR c++/34364
+// { dg-do run }
+
+struct A
+{
+ virtual ~A () {}
+};
+
+struct B : public A
+{
+ template <typename T> struct C
+ {
+ static void f (A &a)
+ {
+ dynamic_cast <B &>(a).g ();
+ }
+ };
+
+ B () : c (6) {}
+ void g () { c++; }
+ int c;
+};
+
+B b;
+
+int
+main (void)
+{
+ B::C<int>::f (b);
+ return b.c != 7;
+}

29
gcc41-pr34394.patch Normal file
View File

@ -0,0 +1,29 @@
2007-12-10 Jakub Jelinek <jakub@redhat.com>
PR c++/34394
* error.c (dump_expr): Handle ABS_EXPR.
* g++.dg/other/error22.C: New test.
--- gcc/cp/error.c (revision 130743)
+++ gcc/cp/error.c (revision 130744)
@@ -1757,6 +1757,7 @@ dump_expr (tree t, int flags)
break;
case SCOPE_REF:
+ case ABS_EXPR:
pp_expression (cxx_pp, t);
break;
--- gcc/testsuite/g++.dg/other/error22.C (revision 0)
+++ gcc/testsuite/g++.dg/other/error22.C (revision 130744)
@@ -0,0 +1,9 @@
+// PR c++/34394
+// { dg-do compile }
+
+extern double fabs (double);
+
+void foo (double x)
+{
+ fabs (x) (); // { dg-error "__builtin_abs" }
+}

View File

@ -1,6 +1,6 @@
%define DATE 20071124
%define gcc_version 4.1.2
%define gcc_release 35
%define gcc_release 36
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%define include_gappletviewer 1
@ -195,14 +195,17 @@ Patch69: gcc41-pr33844.patch
Patch70: gcc41-pr33962.patch
Patch71: gcc41-pr34070.patch
Patch72: gcc41-pr34089.patch
Patch73: gcc41-pr34094.patch
Patch73: gcc41-pr34178.patch
Patch74: gcc41-pr34130.patch
Patch75: gcc41-pr34146.patch
Patch76: gcc41-rh364001.patch
Patch77: gcc41-pr34213.patch
Patch78: gcc41-pr34238.patch
Patch78: gcc41-pr34364.patch
Patch79: gcc41-pr34275.patch
Patch80: gcc41-rh407281.patch
Patch81: gcc41-pr34394.patch
Patch82: gcc41-debug-fortran-array.patch
Patch83: gcc41-omp-outer-ctx.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
@ -556,14 +559,17 @@ which are required to run programs compiled with the GNAT.
%patch70 -p0 -b .pr33962~
%patch71 -p0 -b .pr34070~
%patch72 -p0 -b .pr34089~
%patch73 -p0 -b .pr34094~
%patch73 -p0 -b .pr34178~
%patch74 -p0 -b .pr34130~
%patch75 -p0 -b .pr34146~
%patch76 -p0 -b .rh364001~
%patch77 -p0 -b .pr34213~
%patch78 -p0 -b .pr34238~
%patch78 -p0 -b .pr34364~
%patch79 -p0 -b .pr34275~
%patch80 -p0 -b .rh407281~
%patch81 -p0 -b .pr34394~
%patch82 -p0 -b .debug-fortran-array~
%patch83 -p0 -b .omp-outer-ctx~
%if %{bootstrap_java}
tar xjf %{SOURCE10}
@ -1736,6 +1742,15 @@ fi
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
* Wed Dec 12 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-36
- revert PR c++/34094 fix altogether, it was only accepts-invalid and
caused a bunch of valid or unclear cases to be rejected (#411871, #402521)
- fix OpenMP handling of global vars privatized in orphaned constructs
with #pragma omp parallel inside them
- -frepo fixes (#411741, PRs c++/34178, c++/34340)
- fix dynamic_cast<C &> in templates (PR c++/34364)
- fix error diagnostics involving ABS_EXPR (PR c++/34394)
* Sun Dec 2 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-35
- two ctor preevaluation fixes (Olivier Hainque,
Eric Botcazou, #407281)