Compare commits

...

9 Commits
master ... f7

Author SHA1 Message Date
Fedora Release Engineering 0cbf5f37f5 dist-git conversion 2010-07-28 15:06:16 +00:00
Jakub Jelinek 0cadc6a312 4.1.2-27.fc7 2007-09-25 23:17:11 +00:00
Jakub Jelinek ba176c4261 4.1.2-24.fc7 2007-09-17 22:10:17 +00:00
Jakub Jelinek 8d2625a8b2 4.1.2-23.fc7 2007-09-15 08:08:15 +00:00
Jakub Jelinek 4ee2b4fe99 4.1.2-22.fc7 2007-09-07 07:13:59 +00:00
Jakub Jelinek 9cfac8cb02 4.1.2-21.fc7 2007-09-06 12:30:25 +00:00
Jakub Jelinek d18ac38a13 4.1.2-20.fc7 2007-09-01 09:50:08 +00:00
Jakub Jelinek 6329a9d46d 4.1.2-18.fc7 2007-08-27 11:08:53 +00:00
Bill Nottingham 2352fe0c7f Initialize branch F-7 for gcc 2007-05-18 04:07:02 +00:00
35 changed files with 5651 additions and 5978 deletions

View File

@ -1 +0,0 @@
gcc-4.1.2-20070503.tar.bz2

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
gcc-4.1.2-20070925.tar.bz2

View File

@ -1,6 +0,0 @@
# Makefile for source rpm: gcc
# $Id$
NAME := gcc
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

74
gcc41-build-id.patch Normal file
View File

@ -0,0 +1,74 @@
2007-07-22 Roland McGrath <roland@redhat.com>
* config/rs6000/sysv4.h (LINK_EH_SPEC): Add --build-id for
non-relocatable link.
* config/linux.h (LINK_EH_SPEC): Likewise.
* config/sparc/linux.h (LINK_EH_SPEC): Likewise.
* config/sparc/linux64.h (LINK_EH_SPEC): Likewise.
* config/alpha/elf.h (LINK_EH_SPEC): Likewise.
* config/ia64/linux.h (LINK_EH_SPEC): Likewise.
--- gcc/config/rs6000/sysv4.h.~1~
+++ gcc/config/rs6000/sysv4.h
@@ -1044,7 +1044,7 @@ extern int fixuplabelno;
%{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
#if defined(HAVE_LD_EH_FRAME_HDR)
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
#endif
#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
--- gcc/config/linux.h.~1~
+++ gcc/config/linux.h
@@ -85,7 +85,7 @@ Boston, MA 02110-1301, USA. */
} while (0)
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
#endif
/* Define this so we can compile MS code for use with WINE. */
--- gcc/config/sparc/linux64.h.~1~
+++ gcc/config/sparc/linux64.h
@@ -316,7 +316,7 @@ do { \
#define DITF_CONVERSION_LIBFUNCS 1
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
#endif
#ifdef HAVE_AS_TLS
--- gcc/config/sparc/linux.h.~1~
+++ gcc/config/sparc/linux.h
@@ -188,7 +188,7 @@ do { \
#define DITF_CONVERSION_LIBFUNCS 1
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
#endif
#ifdef HAVE_AS_TLS
--- gcc/config/alpha/elf.h.~1~
+++ gcc/config/alpha/elf.h
@@ -453,5 +453,5 @@ extern int alpha_this_gpdisp_sequence_nu
I imagine that other systems will catch up. In the meantime, it
doesn't harm to make sure that the data exists to be used later. */
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} %{!r:--build-id} "
#endif
--- gcc/config/ia64/linux.h.~1~
+++ gcc/config/ia64/linux.h
@@ -56,7 +56,7 @@ do { \
Signalize that because we have fde-glibc, we don't need all C shared libs
linked against -lgcc_s. */
#undef LINK_EH_SPEC
-#define LINK_EH_SPEC ""
+#define LINK_EH_SPEC "%{!r:--build-id} "
#define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"

View File

@ -1,89 +0,0 @@
2007-05-03 Ulrich Drepper <drepper@redhat.com>
Jakub Jelinek <jakub@redhat.com>
* crtstuff.c (HIDDEN_DTOR_LIST_END): New macro.
(__do_global_dtors_aux): Use more paranoid loop to run
destructors if HIDDEN_DTOR_LIST_END.
(__DTOR_END__): Export as a hidden symbol when HIDDEN_DTOR_LIST_END.
--- gcc/crtstuff.c.jj 2007-01-24 22:24:21.000000000 +0100
+++ gcc/crtstuff.c 2007-05-03 10:40:29.000000000 +0200
@@ -106,6 +107,11 @@ call_ ## FUNC (void) \
# define EH_FRAME_SECTION_CONST
#endif
+#if !defined(DTOR_LIST_END) && defined(OBJECT_FORMAT_ELF) \
+ && defined(HAVE_GAS_HIDDEN) && !defined(FINI_ARRAY_SECTION_ASM_OP)
+# define HIDDEN_DTOR_LIST_END
+#endif
+
/* We do not want to add the weak attribute to the declarations of these
routines in unwind-dw2-fde.h because that will cause the definition of
these symbols to be weak as well.
@@ -265,10 +271,6 @@ extern void __cxa_finalize (void *) TARG
static void __attribute__((used))
__do_global_dtors_aux (void)
{
-#ifndef FINI_ARRAY_SECTION_ASM_OP
- static func_ptr *p = __DTOR_LIST__ + 1;
- func_ptr f;
-#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
static _Bool completed;
if (__builtin_expect (completed, 0))
@@ -282,12 +284,32 @@ __do_global_dtors_aux (void)
#ifdef FINI_ARRAY_SECTION_ASM_OP
/* If we are using .fini_array then destructors will be run via that
mechanism. */
+#elif defined(HIDDEN_DTOR_LIST_END)
+ {
+ /* Safer version that makes sure only .dtors function pointers are
+ called even if the static variable is maliciously changed. */
+ extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
+ static size_t dtor_idx;
+ const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
+ func_ptr f;
+
+ while (dtor_idx < max_idx)
+ {
+ f = __DTOR_LIST__[++dtor_idx];
+ f ();
+ }
+ }
#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
- while ((f = *p))
- {
- p++;
- f ();
- }
+ {
+ static func_ptr *p = __DTOR_LIST__ + 1;
+ func_ptr f;
+
+ while ((f = *p))
+ {
+ p++;
+ f ();
+ }
+ }
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
#ifdef USE_EH_FRAME_REGISTRY
@@ -471,6 +493,17 @@ STATIC func_ptr __CTOR_END__[1]
#ifdef DTOR_LIST_END
DTOR_LIST_END;
+#elif defined(HIDDEN_DTOR_LIST_END)
+#ifdef DTORS_SECTION_ASM_OP
+asm (DTORS_SECTION_ASM_OP);
+#endif
+func_ptr __DTOR_END__[1]
+ __attribute__ ((unused,
+#ifndef DTORS_SECTION_ASM_OP
+ section(".dtors"),
+#endif
+ aligned(sizeof(func_ptr)), visibility ("hidden")))
+ = { (func_ptr) 0 };
#elif defined(DTORS_SECTION_ASM_OP)
asm (DTORS_SECTION_ASM_OP);
STATIC func_ptr __DTOR_END__[1]

295
gcc41-error-attrib.patch Normal file
View File

@ -0,0 +1,295 @@
2007-09-23 Jakub Jelinek <jakub@redhat.com>
* expr.c (expand_expr_real_1) <case CALL_EXPR>: Use get_callee_fndecl
instead of checking CALL_EXPR_FN directly to test for builtins.
If error or warning attributes are present, print
error resp. warning.
* c-common.c (handle_error_attribute): New function.
(c_common_attribute_table): Add error and warning
attributes.
* doc/extend.texi: Document error and warning attributes.
* gcc.dg/va-arg-pack-len-1.c: Use error and warning
attributes.
* gcc.dg/va-arg-pack-len-2.c: New test.
* g++.dg/ext/va-arg-pack-len-1.C: Use error and warning
attributes.
* g++.dg/ext/va-arg-pack-len-2.C: New test.
--- gcc/doc/extend.texi.jj 2007-09-25 15:04:15.000000000 +0200
+++ gcc/doc/extend.texi 2007-09-25 15:32:22.000000000 +0200
@@ -1589,8 +1589,8 @@ attributes are currently defined for fun
@code{section}, @code{constructor}, @code{destructor}, @code{used},
@code{unused}, @code{deprecated}, @code{weak}, @code{malloc},
@code{alias}, @code{warn_unused_result}, @code{nonnull},
-@code{gnu_inline}, @code{externally_visible} and @code{artificial}.
-Several other
+@code{gnu_inline}, @code{externally_visible}, @code{artificial},
+@code{error} and @code{warning}. Several other
attributes are defined for functions on particular target systems. Other
attributes, including @code{section} are supported for variables declarations
(@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}).
@@ -1688,6 +1688,30 @@ Whether the function itself is considere
the current inlining parameters. The @code{flatten} attribute only works
reliably in unit-at-a-time mode.
+@item error ("@var{message}")
+@cindex @code{error} function attribute
+If this attribute is used on a function declaration and a call to such a function
+is not eliminated through dead code elimination or other optimizations, an error
+which will include @var{message} will be diagnosed. This is useful
+for compile time checking, especially together with @code{__builtin_constant_p}
+and inline functions where checking the inline function arguments is not
+possible through @code{extern char [(condition) ? 1 : -1];} tricks.
+While it is possible to leave the function undefined and thus invoke
+a link failure, when using this attribute the problem will be diagnosed
+earlier and with exact location of the call even in presence of inline
+functions or when not emitting debugging information.
+
+@item warning ("@var{message}")
+@cindex @code{warning} function attribute
+If this attribute is used on a function declaration and a call to such a function
+is not eliminated through dead code elimination or other optimizations, a warning
+which will include @var{message} will be diagnosed. This is useful
+for compile time checking, especially together with @code{__builtin_constant_p}
+and inline functions. While it is possible to define the function with
+a message in @code{.gnu.warning*} section, when using this attribute the problem
+will be diagnosed earlier and with exact location of the call even in presence
+of inline functions or when not emitting debugging information.
+
@item cdecl
@cindex functions that do pop the argument stack on the 386
@opindex mrtd
--- gcc/expr.c.jj 2007-09-25 14:58:40.000000000 +0200
+++ gcc/expr.c 2007-09-25 15:19:15.000000000 +0200
@@ -7513,19 +7513,31 @@ expand_expr_real_1 (tree exp, rtx target
inlining. */
if (CALL_EXPR_VA_ARG_PACK (exp))
error ("invalid use of %<__builtin_va_arg_pack ()%>");
- /* Check for a built-in function. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL)
- && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- {
- if (DECL_BUILT_IN_CLASS (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == BUILT_IN_FRONTEND)
- return lang_hooks.expand_expr (exp, original_target,
- tmode, modifier,
- alt_rtl);
- else
- return expand_builtin (exp, target, subtarget, tmode, ignore);
+ {
+ tree fndecl = get_callee_fndecl (exp), attr;
+
+ if (fndecl
+ && (attr = lookup_attribute ("error",
+ DECL_ATTRIBUTES (fndecl))) != NULL)
+ error ("call to %qs declared with attribute error: %s",
+ lang_hooks.decl_printable_name (fndecl, 1),
+ TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ if (fndecl
+ && (attr = lookup_attribute ("warning",
+ DECL_ATTRIBUTES (fndecl))) != NULL)
+ warning (0, "call to %qs declared with attribute warning: %s",
+ lang_hooks.decl_printable_name (fndecl, 1),
+ TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+
+ /* Check for a built-in function. */
+ if (fndecl && DECL_BUILT_IN (fndecl))
+ {
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_FRONTEND)
+ return lang_hooks.expand_expr (exp, original_target,
+ tmode, modifier, alt_rtl);
+ else
+ return expand_builtin (exp, target, subtarget, tmode, ignore);
+ }
}
return expand_call (exp, target, ignore);
--- gcc/c-common.c.jj 2007-09-25 15:01:49.000000000 +0200
+++ gcc/c-common.c 2007-09-25 15:24:34.000000000 +0200
@@ -508,6 +508,7 @@ static tree handle_always_inline_attribu
static tree handle_gnu_inline_attribute (tree *, tree, tree, int, bool *);
static tree handle_artificial_attribute (tree *, tree, tree, int, bool *);
static tree handle_flatten_attribute (tree *, tree, tree, int, bool *);
+static tree handle_error_attribute (tree *, tree, tree, int, bool *);
static tree handle_used_attribute (tree *, tree, tree, int, bool *);
static tree handle_unused_attribute (tree *, tree, tree, int, bool *);
static tree handle_externally_visible_attribute (tree *, tree, tree, int,
@@ -641,6 +642,10 @@ const struct attribute_spec c_common_att
handle_warn_unused_result_attribute },
{ "sentinel", 0, 1, false, true, true,
handle_sentinel_attribute },
+ { "warning", 1, 1, true, false, false,
+ handle_error_attribute },
+ { "error", 1, 1, true, false, false,
+ handle_error_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};
@@ -4226,6 +4231,26 @@ handle_flatten_attribute (tree *node, tr
return NULL_TREE;
}
+/* Handle a "warning" or "error" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_error_attribute (tree *node, tree name, tree args,
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ || TREE_CODE (TREE_VALUE (args)) == STRING_CST)
+ /* Do nothing else, just set the attribute. We'll get at
+ it later with lookup_attribute. */
+ ;
+ else
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
/* Handle a "used" attribute; arguments as in
struct attribute_spec.handler. */
--- gcc/testsuite/gcc.dg/va-arg-pack-len-1.c.jj 2007-09-25 12:23:05.000000000 +0200
+++ gcc/testsuite/gcc.dg/va-arg-pack-len-1.c 2007-09-25 15:16:03.000000000 +0200
@@ -3,8 +3,10 @@
#include <stdarg.h>
-extern int warn_open_missing_mode (void);
-extern int warn_open_too_many_arguments (void);
+extern int error_open_missing_mode (void)
+ __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
+extern int warn_open_too_many_arguments (void)
+ __attribute__((__warning__ ("open called with more than 3 arguments")));
extern void abort (void);
char expected_char;
@@ -83,7 +85,7 @@ myopen (const char *path, int oflag, ...
{
if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
{
- warn_open_missing_mode ();
+ error_open_missing_mode ();
return myopen2 (path, oflag);
}
return myopenva (path, oflag, __builtin_va_arg_pack ());
--- gcc/testsuite/gcc.dg/va-arg-pack-len-2.c.jj 2007-09-25 15:16:03.000000000 +0200
+++ gcc/testsuite/gcc.dg/va-arg-pack-len-2.c 2007-09-25 15:16:03.000000000 +0200
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <stdarg.h>
+
+extern int error_open_missing_mode (void)
+ __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
+extern int warn_open_too_many_arguments (void)
+ __attribute__((__warning__ ("open called with more than 3 arguments")));
+
+extern int myopen2 (const char *path, int oflag);
+extern int myopenva (const char *path, int oflag, ...);
+
+extern inline __attribute__((always_inline, gnu_inline)) int
+myopen (const char *path, int oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ warn_open_too_many_arguments (); /* { dg-warning "called with more than 3" } */
+
+ if (__builtin_constant_p (oflag))
+ {
+ if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ error_open_missing_mode (); /* { dg-error "needs 3 arguments, only 2 were given" } */
+ return myopen2 (path, oflag);
+ }
+ return myopenva (path, oflag, __builtin_va_arg_pack ());
+ }
+
+ if (__builtin_va_arg_pack_len () < 1)
+ return myopen2 (path, oflag);
+
+ return myopenva (path, oflag, __builtin_va_arg_pack ());
+}
+
+int
+main (void)
+{
+ myopen ("h", 0x43);
+ myopen ("i", 0x43, 0644, 0655);
+ return 0;
+}
--- gcc/testsuite/g++.dg/ext/va-arg-pack-len-1.C.jj 2007-09-25 12:23:05.000000000 +0200
+++ gcc/testsuite/g++.dg/ext/va-arg-pack-len-1.C 2007-09-25 15:16:03.000000000 +0200
@@ -3,8 +3,10 @@
#include <stdarg.h>
-extern "C" int warn_open_missing_mode (void);
-extern "C" int warn_open_too_many_arguments (void);
+extern "C" int error_open_missing_mode (void)
+ __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
+extern "C" int warn_open_too_many_arguments (void)
+ __attribute__((__warning__ ("open called with more than 3 arguments")));
extern "C" void abort (void);
char expected_char;
@@ -83,7 +85,7 @@ myopen (const char *path, int oflag, ...
{
if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
{
- warn_open_missing_mode ();
+ error_open_missing_mode ();
return myopen2 (path, oflag);
}
return myopenva (path, oflag, __builtin_va_arg_pack ());
--- gcc/testsuite/g++.dg/ext/va-arg-pack-len-2.C.jj 2007-09-25 15:16:03.000000000 +0200
+++ gcc/testsuite/g++.dg/ext/va-arg-pack-len-2.C 2007-09-25 15:16:03.000000000 +0200
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+#include <stdarg.h>
+
+extern int error_open_missing_mode (void)
+ __attribute__((__error__ ("open with O_CREAT needs 3 arguments, only 2 were given")));
+extern int warn_open_too_many_arguments (void)
+ __attribute__((__warning__ ("open called with more than 3 arguments")));
+
+extern int myopen2 (const char *path, int oflag);
+extern int myopenva (const char *path, int oflag, ...);
+
+extern inline __attribute__((always_inline, gnu_inline)) int
+myopen (const char *path, int oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ warn_open_too_many_arguments (); // { dg-warning "called with more than 3" }
+
+ if (__builtin_constant_p (oflag))
+ {
+ if ((oflag & 0x40) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ error_open_missing_mode (); // { dg-error "needs 3 arguments, only 2 were given" }
+ return myopen2 (path, oflag);
+ }
+ return myopenva (path, oflag, __builtin_va_arg_pack ());
+ }
+
+ if (__builtin_va_arg_pack_len () < 1)
+ return myopen2 (path, oflag);
+
+ return myopenva (path, oflag, __builtin_va_arg_pack ());
+}
+
+int
+main (void)
+{
+ myopen ("h", 0x43);
+ myopen ("i", 0x43, 0644, 0655);
+ return 0;
+}

242
gcc41-jdwp.patch Normal file
View File

@ -0,0 +1,242 @@
2007-09-24 Keith Seitz <keiths@redhat.com>
* include/jvm.h (struct natThread): Add new field 'frame'.
* include/java-interp.h (_Jv_Frame): Use _Jv_ThreadStackPeek,
_Jv_ThreadStackPop, and _Jv_ThreadStackPush instead of
java.lang.Thread.frame.
(~_Jv_Frame): Use _Jv_ThreadStackPop.
* java/lang/natThread.cc (_Jv_ThreadStackPeek): New function.
(_Jv_ThreadStackPush): New function.
(_Jv_ThreadStackPop): New function.
* java/lang/Thread.java (frame): Remove field to restore
C++ ABI compatibility.
* gnu/classpath/jdwp/natVMVirtualMachine.cc (getFrames): Use
_Jv_ThreadStackPeek.
(getFrame): Likewise.
* gnu/classpath/jdwp/natVMFrame.cc (getFrameDepth): Likewise.
* jvmti.cc (getLocalFrame): Likewise.
(_Jv_JVMTI_GetFrameCount): Likewise.
(_Jv_JVMTI_GetThreadState): Likewise.
(_Jv_JVMTI_GetStackTrace): Likewise.
* interpret.cc (_Jv_ReportJVMTIExceptionThrow): Likewise.
* headers.txt (java/lang/Thread.h): Prepend declarations
for _Jv_ThreadStackPeek, _Jv_ThreadStackPush, and _Jv_ThreadStackPop.
Add as friend functions.
* jni.cc (_Jv_JNIMethod::call): Push a frame onto the stack when
calling a JNI method.
--- libjava/interpret.cc (revision 128603)
+++ libjava/interpret.cc (working copy)
@@ -1709,7 +1709,7 @@
_Jv_ReportJVMTIExceptionThrow (jthrowable ex)
{
jthread thread = ::java::lang::Thread::currentThread ();
- _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *frame = _Jv_ThreadStackPeek (thread);
jmethodID throw_meth = frame->self->get_method ();
jlocation throw_loc = -1;
if (frame->frame_type == frame_interpreter)
--- libjava/include/java-interp.h (revision 128603)
+++ libjava/include/java-interp.h (working copy)
@@ -391,14 +391,14 @@
{
self = s;
frame_type = type;
- next = (_Jv_Frame *) thr->frame;
- thr->frame = (gnu::gcj::RawData *) this;
+ next = _Jv_ThreadStackPeek (thr);
+ _Jv_ThreadStackPush (thr, this);
thread = thr;
}
~_Jv_Frame ()
{
- thread->frame = (gnu::gcj::RawData *) next;
+ _Jv_ThreadStackPop (thread);
}
int depth ()
--- libjava/include/jvm.h (revision 128603)
+++ libjava/include/jvm.h (working copy)
@@ -34,6 +34,8 @@
#include <sysdep/locks.h>
+class _Jv_Frame;
+
/* Macro for possible unused arguments. */
#define MAYBE_UNUSED __attribute__((__unused__))
@@ -767,6 +769,12 @@
// Each thread has its own JNI object.
_Jv_JNIEnv *jni_env;
+
+ // Describes the topmost frame in the thread's composite
+ // (interp + JNI) stack. Added here to maintain C++ ABI
+ // compatibility with previous versions. Newer versions
+ // of gcj put this in java/lang/Thread.java.
+ _Jv_Frame *frame;
};
#endif /* __JAVA_JVM_H__ */
--- libjava/jni.cc (revision 128603)
+++ libjava/jni.cc (working copy)
@@ -2343,6 +2343,10 @@
// Copy over passed-in arguments.
memcpy (&real_args[offset], args, _this->args_raw_size);
+ // Add a frame to the composite (interpreted + JNI) call stack
+ java::lang::Thread *thread = java::lang::Thread::currentThread ();
+ _Jv_NativeFrame nat_frame (_this, thread);
+
// The actual call to the JNI function.
#if FFI_NATIVE_RAW_API
ffi_raw_call (&_this->jni_cif, (void (*)()) _this->function,
--- libjava/jvmti.cc (revision 128603)
+++ libjava/jvmti.cc (working copy)
@@ -228,7 +228,7 @@
THREAD_CHECK_VALID (thread);
THREAD_CHECK_IS_ALIVE (thread);
- _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *frame = _Jv_ThreadStackPeek (thread);
for (int i = 0; i < depth; i++)
{
@@ -516,7 +516,7 @@
THREAD_CHECK_VALID (thread);
THREAD_CHECK_IS_ALIVE (thread);
- _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *frame = _Jv_ThreadStackPeek (thread);
(*frame_count) = frame->depth ();
return JVMTI_ERROR_NONE;
}
@@ -543,7 +543,7 @@
if (thread->isInterrupted ())
state |= JVMTI_THREAD_STATE_INTERRUPTED;
- _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *frame = _Jv_ThreadStackPeek (thread);
if (frame != NULL && frame->frame_type == frame_native)
state |= JVMTI_THREAD_STATE_IN_NATIVE;
@@ -1273,7 +1273,7 @@
ILLEGAL_ARGUMENT (start_depth >= (*frame_count));
ILLEGAL_ARGUMENT (start_depth < (-(*frame_count)));
- _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *frame = _Jv_ThreadStackPeek (thread);
// If start_depth is negative use this to determine at what depth to start
// the trace by adding it to the length of the call stack. This allows the
--- libjava/headers.txt (revision 128603)
+++ libjava/headers.txt (working copy)
@@ -6,6 +6,7 @@
class java/lang/Thread
prepend class _Jv_JNIEnv;
+prepend class _Jv_Frame;
prepend #define _JV_NOT_OWNER 1
prepend #define _JV_INTERRUPTED 2
prepend _Jv_JNIEnv * _Jv_GetCurrentJNIEnv ();
@@ -17,6 +18,9 @@
prepend jint _Jv_DetachCurrentThread ();
prepend struct _Jv_Thread_t;
prepend _Jv_Thread_t* _Jv_ThreadGetData (java::lang::Thread* thread);
+prepend _Jv_Frame *_Jv_ThreadStackPeek (java::lang::Thread *thread);
+prepend void _Jv_ThreadStackPush (java::lang::Thread *thread, _Jv_Frame *frame);
+prepend void _Jv_ThreadStackPop (java::lang::Thread *thread);
friend _Jv_JNIEnv * ::_Jv_GetCurrentJNIEnv ();
friend void ::_Jv_SetCurrentJNIEnv (_Jv_JNIEnv *env);
friend void ::_Jv_ThreadRun (java::lang::Thread* thread);
@@ -24,6 +28,9 @@
friend java::lang::Thread* ::_Jv_AttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
friend java::lang::Thread* ::_Jv_AttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);
friend jint (::_Jv_DetachCurrentThread) ();
+friend _Jv_Frame *::_Jv_ThreadStackPeek (java::lang::Thread *thread);
+friend void ::_Jv_ThreadStackPush (java::lang::Thread *thread, _Jv_Frame *frame);
+friend void ::_Jv_ThreadStackPop (java::lang::Thread *thread);
class java/lang/String
prepend jchar* _Jv_GetStringChars (jstring str);
--- libjava/gnu/classpath/jdwp/natVMFrame.cc (revision 128603)
+++ libjava/gnu/classpath/jdwp/natVMFrame.cc (working copy)
@@ -181,7 +181,7 @@
getFrameDepth (_Jv_Frame *frame)
{
jint depth = 0;
- _Jv_Frame *top_frame = (_Jv_Frame *) frame->thread->frame;
+ _Jv_Frame *top_frame = _Jv_ThreadStackPeek (frame->thread);
jint num_frames = VMVirtualMachine::getFrameCount (frame->thread);
while (frame != top_frame)
--- libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 128603)
+++ libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -553,7 +553,7 @@
frame_list = new ::java::util::ArrayList (num_frames);
- _Jv_Frame *vm_frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+ _Jv_Frame *vm_frame = _Jv_ThreadStackPeek (thread);
// Take start frames off the top of the stack
while (vm_frame != NULL && start > 0)
@@ -584,7 +584,7 @@
{
using namespace gnu::classpath::jdwp::exception;
- _Jv_Frame *vm_frame = (_Jv_Frame *) thread->frame;
+ _Jv_Frame *vm_frame = _Jv_ThreadStackPeek (thread);
jint depth = 0;
_Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (frameID);
--- libjava/java/lang/Thread.java (revision 128603)
+++ libjava/java/lang/Thread.java (working copy)
@@ -186,9 +186,6 @@
// This describes the top-most interpreter frame for this thread.
RawData interp_frame;
- // This describes the top most frame in the composite (interp + JNI) stack
- RawData frame;
-
// Current state.
volatile int state;
--- libjava/java/lang/natThread.cc (revision 128603)
+++ libjava/java/lang/natThread.cc (working copy)
@@ -15,6 +15,7 @@
#include <gcj/cni.h>
#include <jvm.h>
#include <java-threads.h>
+#include <java-interp.h>
#include <gnu/gcj/RawDataManaged.h>
#include <java/lang/Thread.h>
@@ -525,3 +526,25 @@
return 0;
}
+
+_Jv_Frame *
+_Jv_ThreadStackPeek (java::lang::Thread *thread)
+{
+ struct natThread *nt = (natThread *) thread->data;
+ return nt->frame;
+}
+
+void
+_Jv_ThreadStackPush (java::lang::Thread *thread, _Jv_Frame *frame)
+{
+ struct natThread *nt = (natThread *) thread->data;
+ nt->frame = frame;
+}
+
+void
+_Jv_ThreadStackPop (java::lang::Thread *thread)
+{
+ struct natThread *nt = (natThread *) thread->data;
+ _Jv_Frame *next = nt->frame->next;
+ nt->frame = next;
+}

View File

@ -1,186 +0,0 @@
2007-05-02 Jakub Jelinek <jakub@redhat.com>
* config/linux/proc.c: New file.
--- libgomp/config/linux/proc.c.jj 2007-05-02 13:50:37.000000000 +0200
+++ libgomp/config/linux/proc.c 2007-05-02 16:00:47.000000000 +0200
@@ -0,0 +1,179 @@
+/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ Libgomp 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 Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with libgomp; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with other files, some
+ of which are compiled with GCC, to produce an executable, this library
+ 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. */
+
+/* This file contains system specific routines related to counting
+ online processors and dynamic load balancing. */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#include "libgomp.h"
+#include <sched.h>
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_GETLOADAVG
+# ifdef HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+# endif
+#endif
+
+#ifdef HAVE_PTHREAD_AFFINITY_NP
+static unsigned long
+cpuset_popcount (cpu_set_t *cpusetp)
+{
+#ifdef CPU_COUNT
+ /* glibc 2.6 and above provide a macro for this. */
+ return CPU_COUNT (cpusetp);
+#else
+ size_t i;
+ unsigned long ret = 0;
+ extern int check[sizeof (cpusetp->__bits[0]) == sizeof (unsigned long int)];
+
+ (void) check;
+ for (i = 0; i < sizeof (*cpusetp) / sizeof (cpusetp->__bits[0]); i++)
+ {
+ unsigned long int mask = cpusetp->__bits[i];
+ if (mask == 0)
+ continue;
+ ret += __builtin_popcountl (mask);
+ }
+ return ret;
+#endif
+}
+#endif
+
+/* At startup, determine the default number of threads. It would seem
+ this should be related to the number of cpus online. */
+
+void
+gomp_init_num_threads (void)
+{
+#ifdef HAVE_PTHREAD_AFFINITY_NP
+ cpu_set_t cpuset;
+
+ if (pthread_getaffinity_np (pthread_self (), sizeof (cpuset), &cpuset) == 0)
+ {
+ /* Count only the CPUs this process can use. */
+ gomp_nthreads_var = cpuset_popcount (&cpuset);
+ if (gomp_nthreads_var == 0)
+ gomp_nthreads_var = 1;
+ return;
+ }
+#endif
+#ifdef _SC_NPROCESSORS_ONLN
+ gomp_nthreads_var = sysconf (_SC_NPROCESSORS_ONLN);
+#endif
+}
+
+static int
+get_num_procs (void)
+{
+#ifdef HAVE_PTHREAD_AFFINITY_NP
+ cpu_set_t cpuset;
+
+ if (gomp_cpu_affinity == NULL)
+ {
+ /* Count only the CPUs this process can use. */
+ if (pthread_getaffinity_np (pthread_self (), sizeof (cpuset),
+ &cpuset) == 0)
+ {
+ int ret = cpuset_popcount (&cpuset);
+ return ret != 0 ? ret : 1;
+ }
+ }
+ else
+ {
+ size_t idx;
+ static int affinity_cpus;
+
+ /* We can't use pthread_getaffinity_np in this case
+ (we have changed it ourselves, it binds to just one CPU).
+ Count instead the number of different CPUs we are
+ using. */
+ CPU_ZERO (&cpuset);
+ if (affinity_cpus == 0)
+ {
+ int cpus = 0;
+ for (idx = 0; idx < gomp_cpu_affinity_len; idx++)
+ if (! CPU_ISSET (gomp_cpu_affinity[idx], &cpuset))
+ {
+ cpus++;
+ CPU_SET (gomp_cpu_affinity[idx], &cpuset);
+ }
+ affinity_cpus = cpus;
+ }
+ return affinity_cpus;
+ }
+#endif
+#ifdef _SC_NPROCESSORS_ONLN
+ return sysconf (_SC_NPROCESSORS_ONLN);
+#else
+ return gomp_nthreads_var;
+#endif
+}
+
+/* When OMP_DYNAMIC is set, at thread launch determine the number of
+ threads we should spawn for this team. */
+/* ??? I have no idea what best practice for this is. Surely some
+ function of the number of processors that are *still* online and
+ the load average. Here I use the number of processors online
+ minus the 15 minute load average. */
+
+unsigned
+gomp_dynamic_max_threads (void)
+{
+ unsigned n_onln, loadavg;
+
+ n_onln = get_num_procs ();
+ if (n_onln > gomp_nthreads_var)
+ n_onln = gomp_nthreads_var;
+
+ loadavg = 0;
+#ifdef HAVE_GETLOADAVG
+ {
+ double dloadavg[3];
+ if (getloadavg (dloadavg, 3) == 3)
+ {
+ /* Add 0.1 to get a kind of biased rounding. */
+ loadavg = dloadavg[2] + 0.1;
+ }
+ }
+#endif
+
+ if (loadavg >= n_onln)
+ return 1;
+ else
+ return n_onln - loadavg;
+}
+
+int
+omp_get_num_procs (void)
+{
+ return get_num_procs ();
+}
+
+ialias (omp_get_num_procs)

View File

@ -1,104 +0,0 @@
--- libcpp/configure.ac.jj 2005-10-28 23:13:40.000000000 +0200
+++ libcpp/configure.ac 2005-11-25 14:34:31.000000000 +0100
@@ -112,6 +112,8 @@ fi
m4_changequote(,)
case $target in
+ powerpc-*-linux*)
+ need_64bit_hwint=no ;;
alpha*-*-* | \
arm*-*-*eabi* | \
arm*-*-symbianelf* | \
--- libcpp/configure.jj 2005-10-28 23:13:40.000000000 +0200
+++ libcpp/configure 2005-11-25 14:34:40.000000000 +0100
@@ -8217,6 +8217,8 @@ fi
case $target in
+ powerpc-*-linux*)
+ need_64bit_hwint=no ;;
alpha*-*-* | \
arm*-*-*eabi* | \
arm*-*-symbianelf* | \
--- gcc/config.gcc.jj 2005-11-19 09:27:16.000000000 +0100
+++ gcc/config.gcc 2005-11-25 14:29:30.000000000 +0100
@@ -294,7 +294,10 @@ mips*-*-*)
powerpc*-*-*)
cpu_type=rs6000
extra_headers="ppc-asm.h altivec.h spe.h"
- need_64bit_hwint=yes
+ case ${target} in
+ powerpc-*-linux*) ;;
+ *) need_64bit_hwint=yes ;;
+ esac
case x$with_cpu in
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345]|xrs64a)
cpu_is_64bit=yes
--- gcc/gcc.c.jj 2005-11-19 21:16:39.000000000 +0100
+++ gcc/gcc.c 2005-11-28 13:00:58.000000000 +0100
@@ -3154,6 +3154,8 @@ process_command (int argc, const char **
const char *spec_lang = 0;
int last_language_n_infiles;
int lang_n_infiles = 0;
+ int hack32 = 1;
+ int used_B = 0;
#ifdef MODIFY_TARGET_NAME
int is_modify_target_name;
int j;
@@ -3680,6 +3682,7 @@ warranty; not even for MERCHANTABILITY o
PREFIX_PRIORITY_B_OPT, 0, 0);
add_prefix (&include_prefixes, value, NULL,
PREFIX_PRIORITY_B_OPT, 0, 0);
+ used_B = 1;
n_switches++;
}
break;
@@ -3742,6 +3745,21 @@ warranty; not even for MERCHANTABILITY o
#endif
goto normal_switch;
+ /* HACK START */
+ case 'm':
+ if ((p[1] == '6' && p[2] == '4')
+ || (p[1] == 'a' && strncmp (p + 2, "ltivec", 6) == 0)
+ || (p[1] == 'c' && strncmp (p + 2, "pu=", 3) == 0
+ && (strncmp (p + 5, "7400", 4) == 0
+ || strncmp (p + 5, "7450", 4) == 0
+ || strncmp (p + 5, "G4", 2) == 0
+ || strncmp (p + 5, "970", 3) == 0
+ || strncmp (p + 5, "G5", 2) == 0))
+ || (p[1] == 'p' && strncmp (p + 2, "owerpc64", 8) == 0))
+ hack32 = 0;
+ /* FALLTHROUGH */
+ /* HACK END */
+
default:
normal_switch:
@@ -3812,6 +3830,26 @@ warranty; not even for MERCHANTABILITY o
/* Use 2 as fourth arg meaning try just the machine as a suffix,
as well as trying the machine and the version. */
#ifndef OS2
+ /* HACK START */
+ if (hack32 && !used_B && !strncmp (spec_machine, "sparc64-", 8))
+ {
+ const char *sparc32_exec_prefix =
+ concat (standard_libexec_prefix, "sparc-", spec_machine + 8,
+ dir_separator_str, spec_version, dir_separator_str, NULL);
+ add_prefix (&exec_prefixes, sparc32_exec_prefix, "GCC",
+ PREFIX_PRIORITY_LAST, 0, 0);
+ }
+ /* HACK END */
+ /* HACK START */
+ if (hack32 && !used_B && !strncmp (spec_machine, "ppc64-", 6))
+ {
+ const char *ppc32_exec_prefix =
+ concat (standard_libexec_prefix, "ppc-", spec_machine + 6,
+ dir_separator_str, spec_version, dir_separator_str, NULL);
+ add_prefix (&exec_prefixes, ppc32_exec_prefix, "GCC",
+ PREFIX_PRIORITY_LAST, 0, 0);
+ }
+ /* HACK END */
add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 1, 0);
add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",

View File

@ -1,28 +0,0 @@
2006-04-06 Jakub Jelinek <jakub@redhat.com>
* objc/compile/20060406-1.m: New test.
--- gcc/testsuite/objc/compile/20060406-1.m.jj 2006-04-06 17:25:59.000000000 +0200
+++ gcc/testsuite/objc/compile/20060406-1.m 2006-04-06 17:20:48.000000000 +0200
@@ -0,0 +1,21 @@
+typedef struct
+{
+ void *p;
+} *S;
+
+@protocol O
+- (unsigned)j;
+@end
+
+@interface I
++ (unsigned char)T:(S<O>[2])p v:(S<O>)h;
+@end
+
+@implementation I
++ (unsigned char)T:(S<O>[2])p v:(S<O>)h
+{
+ p[0] = (S) 0;
+ p[1] = (S) 0;
+ return 0;
+}
+@end

View File

@ -0,0 +1,86 @@
2007-08-27 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (rs6000_elf_end_indicate_exec_stack): New.
* config/rs6000/linux64.h (TARGET_ASM_FILE_END): Use
rs6000_elf_end_indicate_exec_stack.
* config/ia64/ia64.c (ia64_linux_file_end): new.
* config/ia64/linux.h (TARGET_ASM_FILE_END): Use ia64_linux_file_end.
--- gcc/config/rs6000/rs6000.c.jj 2007-06-27 12:10:19.000000000 +0200
+++ gcc/config/rs6000/rs6000.c 2007-08-27 19:27:24.000000000 +0200
@@ -638,6 +638,7 @@ static void rs6000_file_start (void);
static unsigned int rs6000_elf_section_type_flags (tree, const char *, int);
static void rs6000_elf_asm_out_constructor (rtx, int);
static void rs6000_elf_asm_out_destructor (rtx, int);
+static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;
static void rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
static void rs6000_elf_unique_section (tree, int);
static void rs6000_elf_select_rtx_section (enum machine_mode, rtx,
@@ -18896,6 +18897,20 @@ rs6000_elf_declare_function_name (FILE *
}
ASM_OUTPUT_LABEL (file, name);
}
+
+static void
+rs6000_elf_end_indicate_exec_stack (void)
+{
+ if (TARGET_32BIT)
+ file_end_indicate_exec_stack ();
+ else
+ {
+ int saved_trampolines_created = trampolines_created;
+ trampolines_created = 0;
+ file_end_indicate_exec_stack ();
+ trampolines_created = saved_trampolines_created;
+ }
+}
#endif
#if TARGET_XCOFF
--- gcc/config/rs6000/linux64.h.jj 2006-11-08 17:53:15.000000000 +0100
+++ gcc/config/rs6000/linux64.h 2007-08-27 19:25:09.000000000 +0200
@@ -549,7 +549,7 @@ while (0)
#undef DRAFT_V4_STRUCT_RET
#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
-#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
#define TARGET_POSIX_IO
--- gcc/config/ia64/linux.h.jj 2006-07-14 18:00:58.000000000 +0200
+++ gcc/config/ia64/linux.h 2007-08-27 19:21:12.000000000 +0200
@@ -5,7 +5,7 @@
#define TARGET_VERSION fprintf (stderr, " (IA-64) Linux");
-#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+#define TARGET_ASM_FILE_END ia64_linux_file_end
/* This is for -profile to use -lc_p instead of -lc. */
#undef CC1_SPEC
--- gcc/config/ia64/ia64.c.jj 2007-01-05 23:54:11.000000000 +0100
+++ gcc/config/ia64/ia64.c 2007-08-27 19:21:43.000000000 +0200
@@ -246,6 +246,8 @@ static void ia64_hpux_add_extern_decl (t
ATTRIBUTE_UNUSED;
static void ia64_hpux_file_end (void)
ATTRIBUTE_UNUSED;
+static void ia64_linux_file_end (void)
+ ATTRIBUTE_UNUSED;
static void ia64_init_libfuncs (void)
ATTRIBUTE_UNUSED;
static void ia64_hpux_init_libfuncs (void)
@@ -9096,4 +9098,13 @@ ia64_invalid_binary_op (int op ATTRIBUTE
return NULL;
}
+static void
+ia64_linux_file_end (void)
+{
+ int saved_trampolines_created = trampolines_created;
+ trampolines_created = 0;
+ file_end_indicate_exec_stack ();
+ trampolines_created = saved_trampolines_created;
+}
+
#include "gt-ia64.h"

59
gcc41-pr20880.patch Normal file
View File

@ -0,0 +1,59 @@
2006-11-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20880
* parse.c (parse_interface): Error if procedure name is that of
encompassing scope.
* gfortran.dg/interface_3a.f90: New test.
--- gcc/fortran/parse.c (revision 119172)
+++ gcc/fortran/parse.c (revision 119173)
@@ -1694,6 +1694,7 @@ parse_interface (void)
gfc_interface_info save;
gfc_state_data s1, s2;
gfc_statement st;
+ locus proc_locus;
accept_statement (ST_INTERFACE);
@@ -1781,6 +1782,7 @@ loop:
accept_statement (st);
prog_unit = gfc_new_block;
prog_unit->formal_ns = gfc_current_ns;
+ proc_locus = gfc_current_locus;
decl:
/* Read data declaration statements. */
@@ -1796,8 +1798,15 @@ decl:
current_interface = save;
gfc_add_interface (prog_unit);
-
pop_state ();
+
+ if (current_interface.ns
+ && current_interface.ns->proc_name
+ && strcmp (current_interface.ns->proc_name->name,
+ prog_unit->name) == 0)
+ gfc_error ("INTERFACE procedure '%s' at %L has the same name as the "
+ "enclosing procedure", prog_unit->name, &proc_locus);
+
goto loop;
done:
--- gcc/testsuite/gfortran.dg/interface_3a.f90
+++ gcc/testsuite/gfortran.dg/interface_3a.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+!
+! This was found whilst investigating => segfault
+subroutine thy_sub (a)
+ interface
+ subroutine thy_sub (a) ! { dg-error "enclosing procedure" }
+ real a
+ end subroutine
+ end interface
+ real a
+ print *, a
+end subroutine

View File

@ -1,302 +0,0 @@
2006-12-21 Jakub Jelinek <jakub@redhat.com>
Revert:
2006-12-16 Joseph Myers <joseph@codesourcery.com>
David Edelsohn <edelsohn@gnu.org>
PR target/24036
* doc/tm.texi (HARD_REGNO_NREGS_HAS_PADDING,
HARD_REGNO_NREGS_WITH_PADDING): Document new target macros.
* defaults.h (HARD_REGNO_NREGS_HAS_PADDING,
HARD_REGNO_NREGS_WITH_PADDING): Define.
* config/i386/i386.h (HARD_REGNO_NREGS_HAS_PADDING,
HARD_REGNO_NREGS_WITH_PADDING): Define.
* rtlanal.c (subreg_regno_offset, subreg_offset_representable_p):
Use new macros to detect modes with holes; do not look at integer
units.
(subreg_offset_representable_p): Check for and disallow cases
where the modes use different numbers of bits from registers.
* config/rs6000/rs6000.c (rs6000_emit_move): Handle TFmode
constant for soft-float.
(rs6000_hard_regno_nregs): Use UNITS_PER_FP_WORD for e500 GPRs
containing doubles.
(rs6000_split_multireg_move): Use DFmode reg_mode for TFmode moves
in E500 double case.
* config/rs6000/rs6000.md (movtf): Allow soft-float.
(movtf_softfloat): New.
--- gcc/doc/tm.texi (revision 119967)
+++ gcc/doc/tm.texi (revision 119966)
@@ -1937,33 +1937,6 @@ definition of this macro is
@end smallexample
@end defmac
-@defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode})
-A C expression that is nonzero if a value of mode @var{mode}, stored
-in memory, ends with padding that causes it to take up more space than
-in registers starting at register number @var{regno} (as determined by
-multiplying GCC's notion of the size of the register when containing
-this mode by the number of registers returned by
-@code{HARD_REGNO_NREGS}). By default this is zero.
-
-For example, if a floating-point value is stored in three 32-bit
-registers but takes up 128 bits in memory, then this would be
-nonzero.
-
-This macros only needs to be defined if there are cases where
-@code{subreg_regno_offset} and @code{subreg_offset_representable_p}
-would otherwise wrongly determine that a @code{subreg} can be
-represented by an offset to the register number, when in fact such a
-@code{subreg} would contain some of the padding not stored in
-registers and so not be representable.
-@end defmac
-
-@defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode})
-For values of @var{regno} and @var{mode} for which
-@code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression
-returning the greater number of registers required to hold the value
-including any padding. In the example above, the value would be four.
-@end defmac
-
@defmac REGMODE_NATURAL_SIZE (@var{mode})
Define this macro if the natural size of registers that hold values
of mode @var{mode} is not the word size. It is a C expression that
--- gcc/defaults.h (revision 119967)
+++ gcc/defaults.h (revision 119966)
@@ -867,9 +867,4 @@ Software Foundation, 51 Franklin Street,
#define INCOMING_FRAME_SP_OFFSET 0
#endif
-#ifndef HARD_REGNO_NREGS_HAS_PADDING
-#define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) 0
-#define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) -1
-#endif
-
#endif /* ! GCC_DEFAULTS_H */
--- gcc/rtlanal.c (revision 119967)
+++ gcc/rtlanal.c (revision 119966)
@@ -3138,15 +3138,34 @@ unsigned int
subreg_regno_offset (unsigned int xregno, enum machine_mode xmode,
unsigned int offset, enum machine_mode ymode)
{
- int nregs_xmode, nregs_ymode;
+ int nregs_xmode, nregs_ymode, nregs_xmode_unit_int;
int mode_multiple, nregs_multiple;
int y_offset;
+ enum machine_mode xmode_unit, xmode_unit_int;
gcc_assert (xregno < FIRST_PSEUDO_REGISTER);
+ if (GET_MODE_INNER (xmode) == VOIDmode)
+ xmode_unit = xmode;
+ else
+ xmode_unit = GET_MODE_INNER (xmode);
+
+ if (FLOAT_MODE_P (xmode_unit))
+ {
+ xmode_unit_int = int_mode_for_mode (xmode_unit);
+ if (xmode_unit_int == BLKmode)
+ /* It's probably bad to be here; a port should have an integer mode
+ that's the same size as anything of which it takes a SUBREG. */
+ xmode_unit_int = xmode_unit;
+ }
+ else
+ xmode_unit_int = xmode_unit;
+
+ nregs_xmode_unit_int = hard_regno_nregs[xregno][xmode_unit_int];
+
/* Adjust nregs_xmode to allow for 'holes'. */
- if (HARD_REGNO_NREGS_HAS_PADDING (xregno, xmode))
- nregs_xmode = HARD_REGNO_NREGS_WITH_PADDING (xregno, xmode);
+ if (nregs_xmode_unit_int != hard_regno_nregs[xregno][xmode_unit])
+ nregs_xmode = nregs_xmode_unit_int * GET_MODE_NUNITS (xmode);
else
nregs_xmode = hard_regno_nregs[xregno][xmode];
@@ -3184,31 +3203,38 @@ bool
subreg_offset_representable_p (unsigned int xregno, enum machine_mode xmode,
unsigned int offset, enum machine_mode ymode)
{
- int nregs_xmode, nregs_ymode;
+ int nregs_xmode, nregs_ymode, nregs_xmode_unit, nregs_xmode_unit_int;
int mode_multiple, nregs_multiple;
int y_offset;
- int regsize_xmode, regsize_ymode;
+ enum machine_mode xmode_unit, xmode_unit_int;
gcc_assert (xregno < FIRST_PSEUDO_REGISTER);
+ if (GET_MODE_INNER (xmode) == VOIDmode)
+ xmode_unit = xmode;
+ else
+ xmode_unit = GET_MODE_INNER (xmode);
+
+ if (FLOAT_MODE_P (xmode_unit))
+ {
+ xmode_unit_int = int_mode_for_mode (xmode_unit);
+ if (xmode_unit_int == BLKmode)
+ /* It's probably bad to be here; a port should have an integer mode
+ that's the same size as anything of which it takes a SUBREG. */
+ xmode_unit_int = xmode_unit;
+ }
+ else
+ xmode_unit_int = xmode_unit;
+
+ nregs_xmode_unit = hard_regno_nregs[xregno][xmode_unit];
+ nregs_xmode_unit_int = hard_regno_nregs[xregno][xmode_unit_int];
+
/* If there are holes in a non-scalar mode in registers, we expect
that it is made up of its units concatenated together. */
- if (HARD_REGNO_NREGS_HAS_PADDING (xregno, xmode))
+ if (nregs_xmode_unit != nregs_xmode_unit_int)
{
- enum machine_mode xmode_unit;
-
- nregs_xmode = HARD_REGNO_NREGS_WITH_PADDING (xregno, xmode);
- if (GET_MODE_INNER (xmode) == VOIDmode)
- xmode_unit = xmode;
- else
- xmode_unit = GET_MODE_INNER (xmode);
- gcc_assert (HARD_REGNO_NREGS_HAS_PADDING (xregno, xmode_unit));
- gcc_assert (nregs_xmode
- == (GET_MODE_NUNITS (xmode)
- * HARD_REGNO_NREGS_WITH_PADDING (xregno, xmode_unit)));
- gcc_assert (hard_regno_nregs[xregno][xmode]
- == (hard_regno_nregs[xregno][xmode_unit]
- * GET_MODE_NUNITS (xmode)));
+ gcc_assert (nregs_xmode_unit * GET_MODE_NUNITS (xmode)
+ == hard_regno_nregs[xregno][xmode]);
/* You can only ask for a SUBREG of a value with holes in the middle
if you don't cross the holes. (Such a SUBREG should be done by
@@ -3218,12 +3244,15 @@ subreg_offset_representable_p (unsigned
3 for each part, but in memory it's two 128-bit parts.
Padding is assumed to be at the end (not necessarily the 'high part')
of each unit. */
- if ((offset / GET_MODE_SIZE (xmode_unit) + 1
- < GET_MODE_NUNITS (xmode))
- && (offset / GET_MODE_SIZE (xmode_unit)
+ if (nregs_xmode_unit != nregs_xmode_unit_int
+ && (offset / GET_MODE_SIZE (xmode_unit_int) + 1
+ < GET_MODE_NUNITS (xmode))
+ && (offset / GET_MODE_SIZE (xmode_unit_int)
!= ((offset + GET_MODE_SIZE (ymode) - 1)
- / GET_MODE_SIZE (xmode_unit))))
+ / GET_MODE_SIZE (xmode_unit_int))))
return false;
+
+ nregs_xmode = nregs_xmode_unit_int * GET_MODE_NUNITS (xmode);
}
else
nregs_xmode = hard_regno_nregs[xregno][xmode];
@@ -3237,15 +3266,6 @@ subreg_offset_representable_p (unsigned
? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
return true;
- /* If registers store different numbers of bits in the different
- modes, we cannot generally form this subreg. */
- regsize_xmode = GET_MODE_SIZE (xmode) / nregs_xmode;
- regsize_ymode = GET_MODE_SIZE (ymode) / nregs_ymode;
- if (regsize_xmode > regsize_ymode && nregs_ymode > 1)
- return false;
- if (regsize_ymode > regsize_xmode && nregs_xmode > 1)
- return false;
-
/* Lowpart subregs are otherwise valid. */
if (offset == subreg_lowpart_offset (ymode, xmode))
return true;
--- gcc/config/i386/i386.h (revision 119967)
+++ gcc/config/i386/i386.h (revision 119966)
@@ -827,15 +827,6 @@ do { \
? (TARGET_64BIT ? 4 : 6) \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
-#define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) \
- ((TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT) \
- ? (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \
- ? 0 \
- : ((MODE) == XFmode || (MODE) == XCmode)) \
- : 0)
-
-#define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) ((MODE) == XFmode ? 4 : 8)
-
#define VALID_SSE2_REG_MODE(MODE) \
((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \
|| (MODE) == V2DImode || (MODE) == DFmode)
--- gcc/config/rs6000/rs6000.c (revision 119967)
+++ gcc/config/rs6000/rs6000.c (revision 119966)
@@ -3573,6 +3573,9 @@ rs6000_hard_regno_nregs (int regno, enum
if (FP_REGNO_P (regno))
return (GET_MODE_SIZE (mode) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD;
+ if (TARGET_E500_DOUBLE && mode == DFmode)
+ return 1;
+
if (SPE_SIMD_REGNO_P (regno) && TARGET_SPE && SPE_VECTOR_MODE (mode))
return (GET_MODE_SIZE (mode) + UNITS_PER_SPE_WORD - 1) / UNITS_PER_SPE_WORD;
@@ -3580,14 +3583,6 @@ rs6000_hard_regno_nregs (int regno, enum
return
(GET_MODE_SIZE (mode) + UNITS_PER_ALTIVEC_WORD - 1) / UNITS_PER_ALTIVEC_WORD;
- /* The value returned for SCmode in the E500 double case is 2 for
- ABI compatibility; storing an SCmode value in a single register
- would require function_arg and rs6000_spe_function_arg to handle
- SCmode so as to pass the value correctly in a pair of
- registers. */
- if (TARGET_E500_DOUBLE && FLOAT_MODE_P (mode) && mode != SCmode)
- return (GET_MODE_SIZE (mode) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD;
-
return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
}
@@ -3956,7 +3951,8 @@ rs6000_emit_move (rtx dest, rtx source,
/* 128-bit constant floating-point values on Darwin should really be
loaded as two parts. */
- if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128
+ if (!TARGET_IEEEQUAD
+ && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
&& mode == TFmode && GET_CODE (operands[1]) == CONST_DOUBLE)
{
/* DImode is used, not DFmode, because simplify_gen_subreg doesn't
@@ -12402,8 +12398,6 @@ rs6000_split_multireg_move (rtx dst, rtx
reg_mode = DFmode;
else if (ALTIVEC_REGNO_P (reg))
reg_mode = V16QImode;
- else if (TARGET_E500_DOUBLE && mode == TFmode)
- reg_mode = DFmode;
else
reg_mode = word_mode;
reg_mode_size = GET_MODE_SIZE (reg_mode);
--- gcc/config/rs6000/rs6000.md (revision 119967)
+++ gcc/config/rs6000/rs6000.md (revision 119966)
@@ -7789,7 +7789,8 @@ (define_insn "*movdf_softfloat64"
(define_expand "movtf"
[(set (match_operand:TF 0 "general_operand" "")
(match_operand:TF 1 "any_operand" ""))]
- "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
+ "!TARGET_IEEEQUAD
+ && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
"{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
; It's important to list the o->f and f->o moves before f->f because
@@ -7808,19 +7809,6 @@ (define_insn_and_split "*movtf_internal"
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
[(set_attr "length" "8,8,8,20,20,16")])
-(define_insn_and_split "*movtf_softfloat"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=r,Y,r")
- (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
- "!TARGET_IEEEQUAD
- && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
- && (gpc_reg_operand (operands[0], TFmode)
- || gpc_reg_operand (operands[1], TFmode))"
- "#"
- "&& reload_completed"
- [(pc)]
-{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
- [(set_attr "length" "20,20,16")])
-
(define_expand "extenddftf2"
[(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
(float_extend:TF (match_operand:DF 1 "input_operand" "")))

View File

@ -1,439 +0,0 @@
2006-09-01 Jakub Jelinek <jakub@redhat.com>
PR middle-end/27567
* builtins.c (fold_builtin_memcpy, fold_builtin_memmove): Remove.
(fold_builtin_mempcpy): Rename to...
(fold_builtin_memory_op): ... this. Optimize one element copy
into an assignment.
(fold_builtin_memset, fold_builtin_bzero, fold_builtin_bcopy): New
functions.
(expand_builtin_strcpy, expand_builtin_strncpy): Handle COMPOUND_EXPR.
(expand_builtin_memcpy, expand_builtin_mempcpy,
expand_builtin_memmove): Likewise. Use fold_builtin_memory_op.
(fold_builtin_1): Handle BUILT_IN_MEMSET, BUILT_IN_BZERO and
BUILT_IN_BCOPY. Use fold_builtin_memory_op for
BUILT_IN_MEM{CPY,PCPY,MOVE}.
--- gcc/builtins.c.jj 2006-08-28 13:00:23.000000000 +0200
+++ gcc/builtins.c 2006-09-01 11:55:51.000000000 +0200
@@ -160,9 +160,7 @@ static tree fold_builtin_ceil (tree, tre
static tree fold_builtin_round (tree, tree);
static tree fold_builtin_int_roundingfn (tree, tree);
static tree fold_builtin_bitop (tree, tree);
-static tree fold_builtin_memcpy (tree, tree);
-static tree fold_builtin_mempcpy (tree, tree, int);
-static tree fold_builtin_memmove (tree, tree);
+static tree fold_builtin_memory_op (tree, tree, bool, int);
static tree fold_builtin_strchr (tree, tree);
static tree fold_builtin_memcmp (tree);
static tree fold_builtin_strcmp (tree);
@@ -2890,10 +2888,19 @@ expand_builtin_memcpy (tree exp, rtx tar
unsigned int dest_align
= get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
rtx dest_mem, src_mem, dest_addr, len_rtx;
- tree result = fold_builtin_memcpy (fndecl, arglist);
+ tree result = fold_builtin_memory_op (arglist, TREE_TYPE (TREE_TYPE (fndecl)),
+ false, /*endp=*/0);
if (result)
- return expand_expr (result, target, mode, EXPAND_NORMAL);
+ {
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
+ }
/* If DEST is not a pointer type, call the normal function. */
if (dest_align == 0)
@@ -2979,11 +2986,19 @@ expand_builtin_mempcpy (tree arglist, tr
unsigned int dest_align
= get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
rtx dest_mem, src_mem, len_rtx;
- tree result = fold_builtin_mempcpy (arglist, type, endp);
+ tree result = fold_builtin_memory_op (arglist, type, false, endp);
if (result)
- return expand_expr (result, target, mode, EXPAND_NORMAL);
-
+ {
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
+ }
+
/* If either SRC or DEST is not a pointer type, don't do this
operation in-line. */
if (dest_align == 0 || src_align == 0)
@@ -3053,10 +3068,18 @@ expand_builtin_memmove (tree arglist, tr
unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
unsigned int dest_align
= get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
- tree result = fold_builtin_memmove (arglist, type);
+ tree result = fold_builtin_memory_op (arglist, type, false, /*endp=*/3);
if (result)
- return expand_expr (result, target, mode, EXPAND_NORMAL);
+ {
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
+ }
/* If DEST is not a pointer type, call the normal function. */
if (dest_align == 0)
@@ -3204,7 +3227,15 @@ expand_builtin_strcpy (tree fndecl, tree
{
tree result = fold_builtin_strcpy (fndecl, arglist, 0);
if (result)
- return expand_expr (result, target, mode, EXPAND_NORMAL);
+ {
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
+ }
return expand_movstr (TREE_VALUE (arglist),
TREE_VALUE (TREE_CHAIN (arglist)),
@@ -3330,7 +3361,15 @@ expand_builtin_strncpy (tree exp, rtx ta
tree result = fold_builtin_strncpy (fndecl, arglist, slen);
if (result)
- return expand_expr (result, target, mode, EXPAND_NORMAL);
+ {
+ while (TREE_CODE (result) == COMPOUND_EXPR)
+ {
+ expand_expr (TREE_OPERAND (result, 0), const0_rtx, VOIDmode,
+ EXPAND_NORMAL);
+ result = TREE_OPERAND (result, 1);
+ }
+ return expand_expr (result, target, mode, EXPAND_NORMAL);
+ }
/* We must be passed a constant len and src parameter. */
if (!host_integerp (len, 1) || !slen || !host_integerp (slen, 1))
@@ -7982,78 +8021,121 @@ fold_builtin_exponent (tree fndecl, tree
return 0;
}
-/* Fold function call to builtin memcpy. Return
+/* Fold function call to builtin memset. Return
NULL_TREE if no simplification can be made. */
static tree
-fold_builtin_memcpy (tree fndecl, tree arglist)
+fold_builtin_memset (tree arglist, tree type, bool ignore)
{
- tree dest, src, len;
+ tree dest, c, len, var, ret;
+ unsigned HOST_WIDE_INT length, cval;
if (!validate_arglist (arglist,
- POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
+ POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0;
dest = TREE_VALUE (arglist);
- src = TREE_VALUE (TREE_CHAIN (arglist));
+ c = TREE_VALUE (TREE_CHAIN (arglist));
len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+ if (! host_integerp (len, 1))
+ return 0;
+
/* If the LEN parameter is zero, return DEST. */
if (integer_zerop (len))
- return omit_one_operand (TREE_TYPE (TREE_TYPE (fndecl)), dest, src);
+ return omit_one_operand (type, dest, c);
- /* If SRC and DEST are the same (and not volatile), return DEST. */
- if (operand_equal_p (src, dest, 0))
- return omit_one_operand (TREE_TYPE (TREE_TYPE (fndecl)), dest, len);
+ if (! host_integerp (c, 1) || TREE_SIDE_EFFECTS (dest))
+ return 0;
- return 0;
+ var = dest;
+ STRIP_NOPS (var);
+ if (TREE_CODE (var) != ADDR_EXPR)
+ return 0;
+
+ var = TREE_OPERAND (var, 0);
+ if (TREE_THIS_VOLATILE (var))
+ return 0;
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (var))
+ && !POINTER_TYPE_P (TREE_TYPE (var)))
+ return 0;
+
+ length = tree_low_cst (len, 1);
+ if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (var))) != length
+ || get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
+ < (int) length)
+ return 0;
+
+ if (length > HOST_BITS_PER_WIDE_INT / BITS_PER_UNIT)
+ return 0;
+
+ if (integer_zerop (c))
+ cval = 0;
+ else
+ {
+ if (CHAR_BIT != 8 || BITS_PER_UNIT != 8 || HOST_BITS_PER_WIDE_INT > 64)
+ return 0;
+
+ cval = tree_low_cst (c, 1);
+ cval &= 0xff;
+ cval |= cval << 8;
+ cval |= cval << 16;
+ cval |= (cval << 31) << 1;
+ }
+
+ ret = build_int_cst_type (TREE_TYPE (var), cval);
+ ret = build2 (MODIFY_EXPR, TREE_TYPE (var), var, ret);
+ if (ignore)
+ return ret;
+
+ return omit_one_operand (type, dest, ret);
}
-/* Fold function call to builtin mempcpy. Return
+/* Fold function call to builtin memset. Return
NULL_TREE if no simplification can be made. */
static tree
-fold_builtin_mempcpy (tree arglist, tree type, int endp)
+fold_builtin_bzero (tree arglist, bool ignore)
{
- if (validate_arglist (arglist,
- POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
- {
- tree dest = TREE_VALUE (arglist);
- tree src = TREE_VALUE (TREE_CHAIN (arglist));
- tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+ tree dest, size, newarglist;
- /* If the LEN parameter is zero, return DEST. */
- if (integer_zerop (len))
- return omit_one_operand (type, dest, src);
+ if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
+ return 0;
- /* If SRC and DEST are the same (and not volatile), return DEST+LEN. */
- if (operand_equal_p (src, dest, 0))
- {
- if (endp == 0)
- return omit_one_operand (type, dest, len);
+ if (!ignore)
+ return 0;
- if (endp == 2)
- len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len,
- ssize_int (1));
-
- len = fold_convert (TREE_TYPE (dest), len);
- len = fold_build2 (PLUS_EXPR, TREE_TYPE (dest), dest, len);
- return fold_convert (type, len);
- }
- }
- return 0;
+ dest = TREE_VALUE (arglist);
+ size = TREE_VALUE (TREE_CHAIN (arglist));
+
+ /* New argument list transforming bzero(ptr x, int y) to
+ memset(ptr x, int 0, size_t y). This is done this way
+ so that if it isn't expanded inline, we fallback to
+ calling bzero instead of memset. */
+
+ newarglist = build_tree_list (NULL_TREE, fold_convert (sizetype, size));
+ newarglist = tree_cons (NULL_TREE, integer_zero_node, newarglist);
+ newarglist = tree_cons (NULL_TREE, dest, newarglist);
+ return fold_builtin_memset (newarglist, void_type_node, ignore);
}
-/* Fold function call to builtin memmove. Return
- NULL_TREE if no simplification can be made. */
+/* Fold function call to builtin mem{{,p}cpy,move}. Return
+ NULL_TREE if no simplification can be made.
+ If ENDP is 0, return DEST (like memcpy).
+ If ENDP is 1, return DEST+LEN (like mempcpy).
+ If ENDP is 2, return DEST+LEN-1 (like stpcpy).
+ If ENDP is 3, return DEST, additionally *SRC and *DEST may overlap
+ (memmove). */
static tree
-fold_builtin_memmove (tree arglist, tree type)
+fold_builtin_memory_op (tree arglist, tree type, bool ignore, int endp)
{
- tree dest, src, len;
+ tree dest, src, len, destvar, srcvar, expr;
+ unsigned HOST_WIDE_INT length;
- if (!validate_arglist (arglist,
- POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
+ if (! validate_arglist (arglist,
+ POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0;
dest = TREE_VALUE (arglist);
@@ -8064,11 +8146,115 @@ fold_builtin_memmove (tree arglist, tree
if (integer_zerop (len))
return omit_one_operand (type, dest, src);
- /* If SRC and DEST are the same (and not volatile), return DEST. */
+ /* If SRC and DEST are the same (and not volatile), return
+ DEST{,+LEN,+LEN-1}. */
if (operand_equal_p (src, dest, 0))
- return omit_one_operand (type, dest, len);
+ expr = len;
+ else
+ {
+ if (! host_integerp (len, 1))
+ return 0;
- return 0;
+ if (TREE_SIDE_EFFECTS (dest) || TREE_SIDE_EFFECTS (src))
+ return 0;
+
+ destvar = dest;
+ STRIP_NOPS (destvar);
+ if (TREE_CODE (destvar) != ADDR_EXPR)
+ return 0;
+
+ destvar = TREE_OPERAND (destvar, 0);
+ if (TREE_THIS_VOLATILE (destvar))
+ return 0;
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (destvar))
+ && !POINTER_TYPE_P (TREE_TYPE (destvar))
+ && !SCALAR_FLOAT_TYPE_P (TREE_TYPE (destvar)))
+ return 0;
+
+ srcvar = src;
+ STRIP_NOPS (srcvar);
+ if (TREE_CODE (srcvar) != ADDR_EXPR)
+ return 0;
+
+ srcvar = TREE_OPERAND (srcvar, 0);
+ if (TREE_THIS_VOLATILE (srcvar))
+ return 0;
+
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (srcvar))
+ && !POINTER_TYPE_P (TREE_TYPE (srcvar))
+ && !SCALAR_FLOAT_TYPE_P (TREE_TYPE (srcvar)))
+ return 0;
+
+ length = tree_low_cst (len, 1);
+ if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (destvar))) != length
+ || get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
+ < (int) length
+ || GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (srcvar))) != length
+ || get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
+ < (int) length)
+ return 0;
+
+ if ((INTEGRAL_TYPE_P (TREE_TYPE (srcvar))
+ || POINTER_TYPE_P (TREE_TYPE (srcvar)))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (destvar))
+ || POINTER_TYPE_P (TREE_TYPE (destvar))))
+ expr = fold_convert (TREE_TYPE (destvar), srcvar);
+ else
+ expr = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (destvar), srcvar);
+ expr = build2 (MODIFY_EXPR, TREE_TYPE (destvar), destvar, expr);
+ }
+
+ if (ignore)
+ return expr;
+
+ if (endp == 0 || endp == 3)
+ return omit_one_operand (type, dest, expr);
+
+ if (expr == len)
+ expr = 0;
+
+ if (endp == 2)
+ len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len,
+ ssize_int (1));
+
+ len = fold_convert (TREE_TYPE (dest), len);
+ dest = fold_build2 (PLUS_EXPR, TREE_TYPE (dest), dest, len);
+ dest = fold_convert (type, dest);
+ if (expr)
+ dest = omit_one_operand (type, dest, expr);
+ return dest;
+}
+
+/* Fold function call to builtin bcopy. Return NULL_TREE if no
+ simplification can be made. */
+
+static tree
+fold_builtin_bcopy (tree arglist, bool ignore)
+{
+ tree src, dest, size, newarglist;
+
+ if (!validate_arglist (arglist,
+ POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
+ return 0;
+
+ if (! ignore)
+ return 0;
+
+ src = TREE_VALUE (arglist);
+ dest = TREE_VALUE (TREE_CHAIN (arglist));
+ size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+
+ /* New argument list transforming bcopy(ptr x, ptr y, int z) to
+ memmove(ptr y, ptr x, size_t z). This is done this way
+ so that if it isn't expanded inline, we fallback to
+ calling bcopy instead of memmove. */
+
+ newarglist = build_tree_list (NULL_TREE, fold_convert (sizetype, size));
+ newarglist = tree_cons (NULL_TREE, src, newarglist);
+ newarglist = tree_cons (NULL_TREE, dest, newarglist);
+
+ return fold_builtin_memory_op (newarglist, void_type_node, true, /*endp=*/3);
}
/* Fold function call to builtin strcpy. If LEN is not NULL, it represents
@@ -9039,14 +9225,23 @@ fold_builtin_1 (tree fndecl, tree arglis
case BUILT_IN_PARITYLL:
return fold_builtin_bitop (fndecl, arglist);
+ case BUILT_IN_MEMSET:
+ return fold_builtin_memset (arglist, type, ignore);
+
case BUILT_IN_MEMCPY:
- return fold_builtin_memcpy (fndecl, arglist);
+ return fold_builtin_memory_op (arglist, type, ignore, /*endp=*/0);
case BUILT_IN_MEMPCPY:
- return fold_builtin_mempcpy (arglist, type, /*endp=*/1);
+ return fold_builtin_memory_op (arglist, type, ignore, /*endp=*/1);
case BUILT_IN_MEMMOVE:
- return fold_builtin_memmove (arglist, type);
+ return fold_builtin_memory_op (arglist, type, ignore, /*endp=*/3);
+
+ case BUILT_IN_BZERO:
+ return fold_builtin_bzero (arglist, ignore);
+
+ case BUILT_IN_BCOPY:
+ return fold_builtin_bcopy (arglist, ignore);
case BUILT_IN_SIGNBIT:
case BUILT_IN_SIGNBITF:

View File

@ -1,19 +0,0 @@
2007-05-02 Jakub Jelinek <jakub@redhat.com>
PR libgomp/28482
* configure.tgt: Don't link with -Wl,-z,nodlopen even on Linux.
--- libgomp/configure.tgt.jj 2007-04-20 12:55:40.000000000 +0200
+++ libgomp/configure.tgt 2007-05-02 17:32:15.000000000 +0200
@@ -11,11 +11,8 @@
# XLDFLAGS Add extra link flags to use.
# Optimize TLS usage by avoiding the overhead of dynamic allocation.
-# This does require that the library be present during process
-# startup, so mark the library as not to be dlopened.
if test $have_tls = yes && test "$with_gnu_ld" = "yes"; then
XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
- XLDFLAGS="${XLDFLAGS} -Wl,-z,nodlopen"
fi
# Since we require POSIX threads, assume a POSIX system by default.

155
gcc41-pr28690.patch Normal file
View File

@ -0,0 +1,155 @@
2007-06-26 Jakub Jelinek <jakub@redhat.com>
* defaults.h (TARGET_INDEX_OPERAND_FIRST): Define.
* config/rs6000/rs6000.h (TARGET_INDEX_OPERAND_FIRST): Define.
* optabs.c (emit_cmp_and_jump_insns): Don't call swap_operand
twice.
* rtlanal.c (commutative_operand_precedence): Only prefer
REG_POINTER and MEM_POINTER operands over REG and MEM operands
if TARGET_INDEX_OPERAND_FIRST.
(swap_commutative_operands_p): Only sort on REGNO if
TARGET_INDEX_OPERAND_FIRST.
* tree-ssa-address.c (gen_addr_rtx): Only use simplify_gen_binary
instead of gen_rtx_PLUS if TARGET_INDEX_OPERAND_FIRST.
2007-06-20 Peter Bergner <bergner@vnet.ibm.com>
PR middle-end/28690
* optabs.c (emit_cmp_and_jump_insns): Allow EQ compares.
* rtlanal.c (commutative_operand_precedence): Prefer both REG_POINTER
and MEM_POINTER operands over REG and MEM operands.
(swap_commutative_operands_p): In case of a tie, sort on REGNO.
* tree-ssa-address.c (gen_addr_rtx): Use simplify_gen_binary
instead of gen_rtx_PLUS.
--- gcc/defaults.h.jj 2007-02-20 22:39:12.000000000 +0100
+++ gcc/defaults.h 2007-06-26 00:32:16.000000000 +0200
@@ -785,6 +785,10 @@ Software Foundation, 51 Franklin Street,
#define TARGET_C99_FUNCTIONS 0
#endif
+#ifndef TARGET_INDEX_OPERAND_FIRST
+#define TARGET_INDEX_OPERAND_FIRST 0
+#endif
+
/* Indicate that CLZ and CTZ are undefined at zero. */
#ifndef CLZ_DEFINED_VALUE_AT_ZERO
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0
--- gcc/config/rs6000/rs6000.h.jj 2007-02-20 22:39:00.000000000 +0100
+++ gcc/config/rs6000/rs6000.h 2007-06-26 00:33:32.000000000 +0200
@@ -57,6 +57,8 @@
#define PPC405_ERRATUM77 0
#endif
+#define TARGET_INDEX_OPERAND_FIRST (rs6000_cpu == PROCESSOR_POWER6)
+
/* Common ASM definitions used by ASM_SPEC among the various targets
for handling -mcpu=xxx switches. */
#define ASM_CPU_SPEC \
--- gcc/optabs.c.jj 2007-02-20 22:39:12.000000000 +0100
+++ gcc/optabs.c 2007-06-26 00:30:27.000000000 +0200
@@ -3673,12 +3673,16 @@ emit_cmp_and_jump_insns (rtx x, rtx y, e
/* Swap operands and condition to ensure canonical RTL. */
if (swap_commutative_operands_p (x, y))
{
- /* If we're not emitting a branch, this means some caller
- is out of sync. */
- gcc_assert (label);
+ enum rtx_code swapped_comparison = swap_condition (comparison);
+
+ /* If we're not emitting a branch, callers are required to pass
+ operands in an order conforming to canonical RTL. We relax this
+ for commutative comparsions so callers using EQ don't need to do
+ swapping by hand. */
+ gcc_assert (label || swapped_comparison == comparison);
op0 = y, op1 = x;
- comparison = swap_condition (comparison);
+ comparison = swapped_comparison;
}
#ifdef HAVE_cc0
--- gcc/rtlanal.c.jj 2007-02-20 22:39:12.000000000 +0100
+++ gcc/rtlanal.c 2007-06-26 00:28:56.000000000 +0200
@@ -2890,9 +2890,9 @@ commutative_operand_precedence (rtx op)
/* Constants always come the second operand. Prefer "nice" constants. */
if (code == CONST_INT)
- return -7;
+ return -10;
if (code == CONST_DOUBLE)
- return -6;
+ return -9;
op = avoid_constant_pool_reference (op);
code = GET_CODE (op);
@@ -2900,26 +2900,31 @@ commutative_operand_precedence (rtx op)
{
case RTX_CONST_OBJ:
if (code == CONST_INT)
- return -5;
+ return -8;
if (code == CONST_DOUBLE)
- return -4;
- return -3;
+ return -7;
+ return -6;
case RTX_EXTRA:
/* SUBREGs of objects should come second. */
if (code == SUBREG && OBJECT_P (SUBREG_REG (op)))
- return -2;
+ return -5;
if (!CONSTANT_P (op))
return 0;
else
/* As for RTX_CONST_OBJ. */
- return -3;
+ return -6;
case RTX_OBJ:
/* Complex expressions should be the first, so decrease priority
of objects. */
- return -1;
+ if (!TARGET_INDEX_OPERAND_FIRST)
+ return -1;
+ if (REG_P (op))
+ return (REG_POINTER (op)) ? -1 : -3;
+ else
+ return (MEM_P (op) && MEM_POINTER (op)) ? -2 : -4;
case RTX_COMM_ARITH:
/* Prefer operands that are themselves commutative to be first.
@@ -2949,8 +2954,16 @@ commutative_operand_precedence (rtx op)
int
swap_commutative_operands_p (rtx x, rtx y)
{
- return (commutative_operand_precedence (x)
- < commutative_operand_precedence (y));
+ int result = (commutative_operand_precedence (x)
+ - commutative_operand_precedence (y));
+ if (!TARGET_INDEX_OPERAND_FIRST || result)
+ return result < 0;
+
+ /* Group together equal REGs to do more simplification. */
+ if (REG_P (x) && REG_P (y))
+ return REGNO (x) > REGNO (y);
+
+ return 0;
}
/* Return 1 if X is an autoincrement side effect and the register is
--- gcc/tree-ssa-address.c.jj 2007-02-20 22:39:12.000000000 +0100
+++ gcc/tree-ssa-address.c 2007-06-26 00:29:49.000000000 +0200
@@ -124,7 +124,9 @@ gen_addr_rtx (rtx symbol, rtx base, rtx
if (base)
{
if (*addr)
- *addr = gen_rtx_PLUS (Pmode, *addr, base);
+ *addr = (TARGET_INDEX_OPERAND_FIRST
+ ? simplify_gen_binary (PLUS, Pmode, base, *addr)
+ : gen_rtx_PLUS (Pmode, *addr, base));
else
*addr = base;
}

View File

@ -1,84 +0,0 @@
2006-08-16 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/28709
* macro.c (paste_tokens): Do error reporting here, use BUF with the
spelled LHS token as opposed to spelling it again.
(paste_all_tokens): Don't report errors here, just break on failure.
* gcc.dg/cpp/paste14.c: New test.
--- libcpp/macro.c.jj 2006-06-09 23:07:54.000000000 +0200
+++ libcpp/macro.c 2006-08-16 17:30:17.000000000 +0200
@@ -430,15 +430,14 @@ stringify_arg (cpp_reader *pfile, macro_
static bool
paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs)
{
- unsigned char *buf, *end;
+ unsigned char *buf, *end, *lhsend;
const cpp_token *lhs;
unsigned int len;
- bool valid;
lhs = *plhs;
len = cpp_token_len (lhs) + cpp_token_len (rhs) + 1;
buf = (unsigned char *) alloca (len);
- end = cpp_spell_token (pfile, lhs, buf, false);
+ end = lhsend = cpp_spell_token (pfile, lhs, buf, false);
/* Avoid comment headers, since they are still processed in stage 3.
It is simpler to insert a space here, rather than modifying the
@@ -455,10 +454,22 @@ paste_tokens (cpp_reader *pfile, const c
/* Set pfile->cur_token as required by _cpp_lex_direct. */
pfile->cur_token = _cpp_temp_token (pfile);
*plhs = _cpp_lex_direct (pfile);
- valid = pfile->buffer->cur == pfile->buffer->rlimit;
- _cpp_pop_buffer (pfile);
+ if (pfile->buffer->cur != pfile->buffer->rlimit)
+ {
+ _cpp_pop_buffer (pfile);
+ _cpp_backup_tokens (pfile, 1);
+ *lhsend = '\0';
- return valid;
+ /* Mandatory error for all apart from assembler. */
+ if (CPP_OPTION (pfile, lang) != CLK_ASM)
+ cpp_error (pfile, CPP_DL_ERROR,
+ "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
+ buf, cpp_token_as_text (pfile, rhs));
+ return false;
+ }
+
+ _cpp_pop_buffer (pfile);
+ return true;
}
/* Handles an arbitrarily long sequence of ## operators, with initial
@@ -490,17 +501,7 @@ paste_all_tokens (cpp_reader *pfile, con
abort ();
if (!paste_tokens (pfile, &lhs, rhs))
- {
- _cpp_backup_tokens (pfile, 1);
-
- /* Mandatory error for all apart from assembler. */
- if (CPP_OPTION (pfile, lang) != CLK_ASM)
- cpp_error (pfile, CPP_DL_ERROR,
- "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
- cpp_token_as_text (pfile, lhs),
- cpp_token_as_text (pfile, rhs));
- break;
- }
+ break;
}
while (rhs->flags & PASTE_LEFT);
--- gcc/testsuite/gcc.dg/cpp/paste14.c.jj 2006-08-16 16:51:45.000000000 +0200
+++ gcc/testsuite/gcc.dg/cpp/paste14.c 2006-08-16 16:53:30.000000000 +0200
@@ -0,0 +1,7 @@
+/* PR preprocessor/28709 */
+/* { dg-do preprocess } */
+
+#define foo - ## >>
+foo /* { dg-error "pasting \"-\" and \">>\"" } */
+#define bar = ## ==
+bar /* { dg-error "pasting \"=\" and \"==\"" } */

View File

@ -1,76 +0,0 @@
2006-09-16 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/29059
* tree-ssa-propagate.c (set_rhs): Reject MODIFY_EXPR right
away for the expr argument.
* gcc.c-torture/compile/strcpy-1.c: New test.
* gcc.c-torture/compile/strcpy-2.c: New test.
* gcc.c-torture/compile/memcpy-1.c: New test.
* gcc.c-torture/compile/memcpy-2.c: New test.
--- gcc/tree-ssa-propagate.c (revision 116996)
+++ gcc/tree-ssa-propagate.c (revision 116997)
@@ -588,7 +588,8 @@ set_rhs (tree *stmt_p, tree expr)
&& !is_gimple_val (TREE_OPERAND (TREE_OPERAND (expr, 0), 1)))
return false;
}
- else if (code == COMPOUND_EXPR)
+ else if (code == COMPOUND_EXPR
+ || code == MODIFY_EXPR)
return false;
switch (TREE_CODE (stmt))
--- gcc/testsuite/gcc.c-torture/compile/strcpy-1.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/strcpy-1.c (revision 116997)
@@ -0,0 +1,15 @@
+
+
+typedef struct
+{
+ char str[20];
+}STACK;
+STACK stack[15];
+int level;
+rezero ()
+{
+ level = 0;
+ __builtin_strcpy (stack[level].str, "");
+}
+
+
--- gcc/testsuite/gcc.c-torture/compile/strcpy-2.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/strcpy-2.c (revision 116997)
@@ -0,0 +1,7 @@
+char wrkstr_un[270];
+extern void
+LoadUserAlph (char *s)
+{
+ s = &wrkstr_un[0];
+ __builtin_strcpy (s, "");
+};
--- gcc/testsuite/gcc.c-torture/compile/memcpy-1.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/memcpy-1.c (revision 116997)
@@ -0,0 +1,9 @@
+static const char OggFLAC__MAPPING_VERSION_MAJOR = 1;
+void f(void)
+{
+ char synthetic_first_packet_body[10];
+ char *b = &synthetic_first_packet_body[4];
+ __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u));
+}
+
+
--- gcc/testsuite/gcc.c-torture/compile/memcpy-2.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/memcpy-2.c (revision 116997)
@@ -0,0 +1,10 @@
+static const char OggFLAC__MAPPING_VERSION_MAJOR = 1;
+void f(void)
+{
+ char synthetic_first_packet_body[10];
+ char *b = synthetic_first_packet_body;
+ b+=4u;
+ __builtin_memcpy (b, &OggFLAC__MAPPING_VERSION_MAJOR, (1u));
+}
+
+

View File

@ -1,110 +0,0 @@
2006-09-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/29272
* builtins.c (fold_builtin_memset, fold_builtin_memory_op): Restrict
single entry optimization to variables and components thereof.
* gcc.c-torture/execute/20060930-1.c: New test.
--- gcc/builtins.c.jj 2006-09-22 10:29:55.000000000 +0200
+++ gcc/builtins.c 2006-09-28 20:31:30.000000000 +0200
@@ -7905,7 +7905,7 @@ fold_builtin_exponent (tree fndecl, tree
static tree
fold_builtin_memset (tree arglist, tree type, bool ignore)
{
- tree dest, c, len, var, ret;
+ tree dest, c, len, var, ret, inner;
unsigned HOST_WIDE_INT length, cval;
if (!validate_arglist (arglist,
@@ -7939,6 +7939,15 @@ fold_builtin_memset (tree arglist, tree
&& !POINTER_TYPE_P (TREE_TYPE (var)))
return 0;
+ /* If var is a VAR_DECL or a component thereof,
+ we can use its alias set, otherwise we'd need to make
+ sure we go through alias set 0. */
+ inner = var;
+ while (handled_component_p (inner))
+ inner = TREE_OPERAND (inner, 0);
+ if (! SSA_VAR_P (inner))
+ return 0;
+
length = tree_low_cst (len, 1);
if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (var))) != length
|| get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
@@ -8009,7 +8018,7 @@ fold_builtin_bzero (tree arglist, bool i
static tree
fold_builtin_memory_op (tree arglist, tree type, bool ignore, int endp)
{
- tree dest, src, len, destvar, srcvar, expr;
+ tree dest, src, len, destvar, srcvar, expr, inner;
unsigned HOST_WIDE_INT length;
if (! validate_arglist (arglist,
@@ -8050,6 +8059,15 @@ fold_builtin_memory_op (tree arglist, tr
&& !SCALAR_FLOAT_TYPE_P (TREE_TYPE (destvar)))
return 0;
+ /* If destvar is a VAR_DECL or a component thereof,
+ we can use its alias set, otherwise we'd need to make
+ sure we go through alias set 0. */
+ inner = destvar;
+ while (handled_component_p (inner))
+ inner = TREE_OPERAND (inner, 0);
+ if (! SSA_VAR_P (inner))
+ return 0;
+
srcvar = src;
STRIP_NOPS (srcvar);
if (TREE_CODE (srcvar) != ADDR_EXPR)
@@ -8064,6 +8082,15 @@ fold_builtin_memory_op (tree arglist, tr
&& !SCALAR_FLOAT_TYPE_P (TREE_TYPE (srcvar)))
return 0;
+ /* If srcvar is a VAR_DECL or a component thereof,
+ we can use its alias set, otherwise we'd need to make
+ sure we go through alias set 0. */
+ inner = srcvar;
+ while (handled_component_p (inner))
+ inner = TREE_OPERAND (inner, 0);
+ if (! SSA_VAR_P (inner))
+ return 0;
+
length = tree_low_cst (len, 1);
if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (destvar))) != length
|| get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
--- gcc/testsuite/gcc.c-torture/execute/20060930-1.c.jj 2006-09-30 21:10:17.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20060930-1.c 2006-09-30 21:09:33.000000000 +0200
@@ -0,0 +1,31 @@
+/* PR middle-end/29272 */
+
+extern void abort (void);
+
+struct S { struct S *s; } s;
+struct T { struct T *t; } t;
+
+static inline void
+foo (void *s)
+{
+ struct T *p = s;
+ __builtin_memcpy (&p->t, &t.t, sizeof (t.t));
+}
+
+void *
+__attribute__((noinline))
+bar (void *p, struct S *q)
+{
+ q->s = &s;
+ foo (p);
+ return q->s;
+}
+
+int
+main (void)
+{
+ t.t = &t;
+ if (bar (&s, &s) != (void *) &t)
+ abort ();
+ return 0;
+}

View File

@ -1,93 +0,0 @@
2006-10-18 Jan Hubicka <jh@suse.cz>
PR middle-end/29299
* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
are used.
2006-10-15 Jan Hubicka <jh@suse.cz>
Richard Guenther <rguenther@suse.de>
PR middle-end/29299
* cgraphunit.c (cgraph_finalize_compilation_unit): Call
process_function_and_variable_attributes on all variables, including
those discovered during cgraph construction phase.
* gcc.dg/pr29299.c: New testcase.
--- gcc/cgraphunit.c (revision 117745)
+++ gcc/cgraphunit.c (revision 117863)
@@ -1055,6 +1055,7 @@ cgraph_finalize_compilation_unit (void)
/* Keep track of already processed nodes when called multiple times for
intermodule optimization. */
static struct cgraph_node *first_analyzed;
+ struct cgraph_node *first_processed = first_analyzed;
static struct cgraph_varpool_node *first_analyzed_var;
if (errorcount || sorrycount)
@@ -1077,7 +1078,10 @@ cgraph_finalize_compilation_unit (void)
}
timevar_push (TV_CGRAPH);
- process_function_and_variable_attributes (first_analyzed, first_analyzed_var);
+ process_function_and_variable_attributes (first_processed,
+ first_analyzed_var);
+ first_processed = cgraph_nodes;
+ first_analyzed_var = cgraph_varpool_nodes;
cgraph_varpool_analyze_pending_decls ();
if (cgraph_dump_file)
{
@@ -1119,11 +1123,16 @@ cgraph_finalize_compilation_unit (void)
if (!edge->callee->reachable)
cgraph_mark_reachable_node (edge->callee);
+ /* We finalize local static variables during constructing callgraph
+ edges. Process their attributes too. */
+ process_function_and_variable_attributes (first_processed,
+ first_analyzed_var);
+ first_processed = cgraph_nodes;
+ first_analyzed_var = cgraph_varpool_nodes;
cgraph_varpool_analyze_pending_decls ();
}
/* Collect entry points to the unit. */
-
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "Unit entry points:");
@@ -1163,7 +1172,6 @@ cgraph_finalize_compilation_unit (void)
dump_cgraph (cgraph_dump_file);
}
first_analyzed = cgraph_nodes;
- first_analyzed_var = cgraph_varpool_nodes;
ggc_collect ();
timevar_pop (TV_CGRAPH);
}
--- gcc/cfgexpand.c (revision 117745)
+++ gcc/cfgexpand.c (revision 117863)
@@ -764,7 +764,12 @@ expand_used_vars_for_block (tree block,
/* Expand all variables at this level. */
for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t))
- if (TREE_USED (t))
+ if (TREE_USED (t)
+ /* Force local static variables to be output when marked by
+ used attribute. For unit-at-a-time, cgraph code already takes
+ care of this. */
+ || (!flag_unit_at_a_time && TREE_STATIC (t)
+ && DECL_PRESERVE_P (t)))
expand_one_var (t, toplevel);
this_sv_num = stack_vars_num;
--- gcc/testsuite/gcc.dg/pr29299.c (revision 0)
+++ gcc/testsuite/gcc.dg/pr29299.c (revision 117863)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+static int bof __attribute__((used));
+int foo()
+{
+ static int barbarbarbar __attribute__((used));
+};
+
+/* { dg-final { scan-assembler "barbarbarbar" } } */

View File

@ -1,113 +0,0 @@
2007-03-30 Jason Merrill <jason@redhat.com>
PR c++/31187
* typeck.c (cp_type_readonly): New fn.
* cp-tree.h: Declare it.
* decl.c (start_decl): Set implicit DECL_THIS_STATIC here.
(cp_finish_decl): Not here.
2007-04-02 Jason Merrill <jason@redhat.com>
PR c++/31187
* g++.dg/ext/visibility/anon3.C: New test.
--- gcc/cp/typeck.c (revision 123431)
+++ gcc/cp/typeck.c (revision 123432)
@@ -6897,6 +6897,16 @@ cp_type_quals (tree type)
return TYPE_QUALS (type);
}
+/* Returns nonzero if the TYPE is const from a C++ perspective: look inside
+ arrays. */
+
+bool
+cp_type_readonly (tree type)
+{
+ type = strip_array_types (type);
+ return TYPE_READONLY (type);
+}
+
/* Returns nonzero if the TYPE contains a mutable member. */
bool
--- gcc/cp/decl.c (revision 123431)
+++ gcc/cp/decl.c (revision 123432)
@@ -3817,6 +3817,7 @@ start_decl (const cp_declarator *declara
tree decl;
tree type, tem;
tree context;
+ bool was_public;
*pushed_scope_p = NULL_TREE;
@@ -3969,6 +3970,8 @@ start_decl (const cp_declarator *declara
decl);
}
+ was_public = TREE_PUBLIC (decl);
+
/* Enter this declaration into the symbol table. */
tem = maybe_push_decl (decl);
@@ -3988,6 +3991,17 @@ start_decl (const cp_declarator *declara
&& (flag_conserve_space || ! TREE_PUBLIC (tem)));
#endif
+ if (TREE_CODE (tem) == VAR_DECL
+ && DECL_NAMESPACE_SCOPE_P (tem) && !TREE_PUBLIC (tem) && !was_public
+ && !DECL_THIS_STATIC (tem) && !DECL_ARTIFICIAL (tem))
+ {
+ /* This is a const variable with implicit 'static'. Set
+ DECL_THIS_STATIC so we can tell it from variables that are
+ !TREE_PUBLIC because of the anonymous namespace. */
+ gcc_assert (cp_type_readonly (TREE_TYPE (tem)));
+ DECL_THIS_STATIC (tem) = 1;
+ }
+
if (! processing_template_decl)
start_decl_1 (tem);
@@ -5320,14 +5334,6 @@ cp_finish_decl (tree decl, tree init, bo
{
layout_var_decl (decl);
maybe_commonize_var (decl);
- if (DECL_NAMESPACE_SCOPE_P (decl) && !TREE_PUBLIC (decl)
- && !DECL_THIS_STATIC (decl) && !DECL_ARTIFICIAL (decl))
- {
- /* This is a const variable with implicit 'static'. Set
- DECL_THIS_STATIC so we can tell it from variables that are
- !TREE_PUBLIC because of the anonymous namespace. */
- DECL_THIS_STATIC (decl) = 1;
- }
}
make_rtl_for_nonlocal_decl (decl, init, asmspec);
--- gcc/cp/cp-tree.h (revision 123431)
+++ gcc/cp/cp-tree.h (revision 123432)
@@ -4742,6 +4742,7 @@ extern bool comp_ptr_ttypes_const (tree
extern int ptr_reasonably_similar (tree, tree);
extern tree build_ptrmemfunc (tree, tree, int, bool);
extern int cp_type_quals (tree);
+extern bool cp_type_readonly (tree);
extern bool cp_has_mutable_p (tree);
extern bool at_least_as_qualified_p (tree, tree);
extern void cp_apply_type_quals_to_decl (int, tree);
--- gcc/testsuite/g++.dg/ext/visibility/anon3.C (revision 0)
+++ gcc/testsuite/g++.dg/ext/visibility/anon3.C (revision 123432)
@@ -0,0 +1,16 @@
+// PR c++/31187
+// Bug: the repeated declaration was confusing the compiler into
+// thinking that foo1 had language internal linkage.
+
+class foo { };
+
+namespace
+{
+ extern foo foo1;
+ foo foo1;
+}
+
+template< foo * >
+class bar { };
+
+bar< &foo1 > bar1;

View File

@ -1,43 +0,0 @@
2007-05-01 Jakub Jelinek <jakub@redhat.com>
PR c++/31748
* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
DECL_P in not a variable and appears more than once error messages.
* g++.dg/gomp/pr31748.C: New test.
--- gcc/cp/semantics.c.jj 2007-04-26 09:30:58.000000000 +0200
+++ gcc/cp/semantics.c 2007-05-01 14:22:58.000000000 +0200
@@ -3376,14 +3376,17 @@ finish_omp_clauses (tree clauses)
{
if (processing_template_decl)
break;
- error ("%qE is not a variable in clause %qs", t, name);
+ if (DECL_P (t))
+ error ("%qD is not a variable in clause %qs", t, name);
+ else
+ error ("%qE is not a variable in clause %qs", t, name);
remove = true;
}
else if (bitmap_bit_p (&generic_head, DECL_UID (t))
|| bitmap_bit_p (&firstprivate_head, DECL_UID (t))
|| bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
{
- error ("%qE appears more than once in data clauses", t);
+ error ("%qD appears more than once in data clauses", t);
remove = true;
}
else
--- gcc/testsuite/g++.dg/gomp/pr31748.C.jj 2007-05-01 14:26:13.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/pr31748.C 2007-05-01 14:26:07.000000000 +0200
@@ -0,0 +1,10 @@
+// PR c++/31748
+
+struct A;
+
+void
+foo ()
+{
+#pragma omp parallel private(A) // { dg-error "struct A.*is not a variable" }
+ ;
+}

58
gcc41-pr32139.patch Normal file
View File

@ -0,0 +1,58 @@
2007-06-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/32139
* c-typeck.c (common_pointer_type): Set TYPE_READONLY
and TYPE_VOLATILE on the merged pointed to FUNCTION_TYPE
only if both pointed_to_1 and pointed_to_2 are TYPE_READONLY
resp. TYPE_VOLATILE.
* gcc.c-torture/compile/20070531-1.c: New test.
--- gcc/c-typeck.c.jj 2007-04-25 10:13:52.000000000 +0200
+++ gcc/c-typeck.c 2007-06-01 10:51:53.000000000 +0200
@@ -499,6 +499,7 @@ common_pointer_type (tree t1, tree t2)
tree pointed_to_1, mv1;
tree pointed_to_2, mv2;
tree target;
+ int type_quals;
/* Save time if the two types are the same. */
@@ -526,10 +527,19 @@ common_pointer_type (tree t1, tree t2)
if (TREE_CODE (mv2) != ARRAY_TYPE)
mv2 = TYPE_MAIN_VARIANT (pointed_to_2);
target = composite_type (mv1, mv2);
- t1 = build_pointer_type (c_build_qualified_type
- (target,
- TYPE_QUALS (pointed_to_1) |
- TYPE_QUALS (pointed_to_2)));
+ type_quals = TYPE_QUALS (pointed_to_1) | TYPE_QUALS (pointed_to_2);
+ if (TREE_CODE (pointed_to_1) == FUNCTION_TYPE)
+ {
+ /* TYPE_READONLY and TYPE_VOLATILE on FUNCTION_TYPE should be
+ logically ANDed, not ORed, as if one function is
+ __attribute__((const)) and the other is not, the common type
+ must be conservatively not __attribute__((const))
+ and similarly for __attribute__((noreturn)). */
+ type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
+ type_quals |= (TYPE_QUALS (pointed_to_1) & TYPE_QUALS (pointed_to_2))
+ & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
+ }
+ t1 = build_pointer_type (c_build_qualified_type (target, type_quals));
return build_type_attribute_variant (t1, attributes);
}
--- gcc/testsuite/gcc.c-torture/compile/20070531-1.c.jj 2007-05-31 13:47:22.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/20070531-1.c 2007-06-01 10:57:15.000000000 +0200
@@ -0,0 +1,11 @@
+/* PR tree-optimization/32139 */
+int foo (void);
+int bar (void) __attribute__ ((const));
+
+int
+test (int x)
+{
+ int a = (x == 10000 ? foo : bar) ();
+ int b = (x == 10000 ? foo : bar) ();
+ return a + b;
+}

46
gcc41-pr32694.patch Normal file
View File

@ -0,0 +1,46 @@
2007-09-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/32694
2006-11-08 Roger Sayle <roger@eyesopen.com>
* tree-ssa-propagate.c (set_rhs): Verify tcc_comparison the same way
as tcc_binary.
* gcc.c-torture/compile/20070925-1.c: New test.
--- gcc/tree-ssa-propagate.c.jj 2007-09-23 19:43:36.000000000 +0200
+++ gcc/tree-ssa-propagate.c 2007-09-25 09:30:50.000000000 +0200
@@ -570,7 +570,8 @@ set_rhs (tree *stmt_p, tree expr)
ssa_op_iter iter;
/* Verify the constant folded result is valid gimple. */
- if (TREE_CODE_CLASS (code) == tcc_binary)
+ if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison)
{
if (!is_gimple_val (TREE_OPERAND (expr, 0))
|| !is_gimple_val (TREE_OPERAND (expr, 1)))
--- gcc/testsuite/gcc.c-torture/compile/20070925-1.c.jj 2007-09-25 09:28:37.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/20070925-1.c 2007-09-25 09:29:41.000000000 +0200
@@ -0,0 +1,22 @@
+/* PR tree-optimization/32694 */
+
+typedef signed long long int WordS64;
+typedef unsigned long long int Word64;
+
+int
+foo (Word64 * p)
+{
+ while (1)
+ {
+ WordS64 c = 0x1llu;
+ WordS64 x = *p;
+ if (c >= 0)
+ {
+ if (x > (WordS64) 0x7FFFFFFFFFFFFFFFll - c)
+ return 6;
+ }
+ else if (x < (WordS64) 0x8000000000000000ll - c)
+ return 7;
+ p++;
+ }
+}

168
gcc41-pr33506.patch Normal file
View File

@ -0,0 +1,168 @@
2007-09-21 Jakub Jelinek <jakub@redhat.com>
PR c++/33506
* langhooks.h (struct lang_hooks_for_types): Add type_hash_eq
field.
* langhooks.c (lhd_type_hash_eq): New function.
* langhooks-def.h (lhd_type_hash_eq): New prototype.
(LANG_HOOKS_TYPE_HASH_EQ): Define.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_TYPE_HASH_EQ.
* tree.c (type_hash_eq): For FUNCTION_TYPE use
lang_hooks.type.type_hash_eq in addition to generic tests.
* cp-tree.h (cxx_type_hash_eq): New prototype.
* cp-objcp-common.h (LANG_HOOKS_TYPE_HASH_EQ): Redefine.
* tree.c (cxx_type_hash_eq): New function.
* g++.dg/ext/attrib29.C: New test.
--- gcc/langhooks.h.jj 2007-02-20 16:39:12.000000000 -0500
+++ gcc/langhooks.h 2007-09-22 03:46:10.000000000 -0400
@@ -148,6 +148,10 @@ struct lang_hooks_for_types
firstprivate variables. */
void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
+ /* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
+ Called only after doing all language independent checks. */
+ bool (*type_hash_eq) (tree, tree);
+
/* Nonzero if types that are identical are to be hashed so that only
one copy is kept. If a language requires unique types for each
user-specified type, such as Ada, this should be set to TRUE. */
--- gcc/langhooks.c.jj 2007-02-20 16:39:12.000000000 -0500
+++ gcc/langhooks.c 2007-09-22 03:46:10.000000000 -0400
@@ -411,6 +411,16 @@ lhd_tree_dump_type_quals (tree t)
/* lang_hooks.expr_size: Determine the size of the value of an expression T
in a language-specific way. Returns a tree for the size in bytes. */
+/* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
+ Called only after doing all language independent checks. */
+
+bool
+lhd_type_hash_eq (tree typea ATTRIBUTE_UNUSED,
+ tree typeb ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
tree
lhd_expr_size (tree exp)
{
--- gcc/langhooks-def.h.jj 2007-02-20 16:39:13.000000000 -0500
+++ gcc/langhooks-def.h 2007-09-22 03:46:56.000000000 -0400
@@ -70,6 +70,7 @@ extern tree lhd_expr_size (tree);
extern size_t lhd_tree_size (enum tree_code);
extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
+extern bool lhd_type_hash_eq (tree, tree);
/* Declarations of default tree inlining hooks. */
extern tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
@@ -220,6 +221,7 @@ extern tree lhd_make_node (enum tree_cod
#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree
#define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
lhd_omp_firstprivatize_type_sizes
+#define LANG_HOOKS_TYPE_HASH_EQ lhd_type_hash_eq
#define LANG_HOOKS_HASH_TYPES true
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
@@ -234,6 +236,7 @@ extern tree lhd_make_node (enum tree_cod
LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
LANG_HOOKS_TYPE_MAX_SIZE, \
LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \
+ LANG_HOOKS_TYPE_HASH_EQ, \
LANG_HOOKS_HASH_TYPES \
}
--- gcc/tree.c.jj 2007-04-03 07:18:26.000000000 -0400
+++ gcc/tree.c 2007-09-22 03:46:10.000000000 -0400
@@ -4168,17 +4168,21 @@ type_hash_eq (const void *va, const void
TYPE_FIELDS (b->type))));
case FUNCTION_TYPE:
- return (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
- || (TYPE_ARG_TYPES (a->type)
- && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
- && TYPE_ARG_TYPES (b->type)
- && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
- && type_list_equal (TYPE_ARG_TYPES (a->type),
- TYPE_ARG_TYPES (b->type))));
+ if (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
+ || (TYPE_ARG_TYPES (a->type)
+ && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
+ && TYPE_ARG_TYPES (b->type)
+ && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
+ && type_list_equal (TYPE_ARG_TYPES (a->type),
+ TYPE_ARG_TYPES (b->type))))
+ break;
+ return 0;
default:
return 0;
}
+
+ return lang_hooks.types.type_hash_eq (a->type, b->type);
}
/* Return the cached hash value. */
--- gcc/cp/cp-tree.h.jj 2007-06-26 07:57:09.000000000 -0400
+++ gcc/cp/cp-tree.h 2007-09-22 03:50:22.000000000 -0400
@@ -4421,7 +4421,8 @@ extern tree cp_add_pending_fn_decls (vo
extern int cp_auto_var_in_fn_p (tree,tree);
extern tree fold_if_not_in_template (tree);
extern tree rvalue (tree);
-
+extern bool cxx_type_hash_eq (tree, tree);
+
/* in typeck.c */
extern int string_conv_p (tree, tree, int);
extern tree cp_truthvalue_conversion (tree);
--- gcc/cp/cp-objcp-common.h.jj 2007-02-20 16:37:34.000000000 -0500
+++ gcc/cp/cp-objcp-common.h 2007-09-22 03:49:38.000000000 -0400
@@ -85,6 +85,8 @@ extern tree objcp_tsubst_copy_and_build
#define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
#undef LANG_HOOKS_COMDAT_GROUP
#define LANG_HOOKS_COMDAT_GROUP cxx_comdat_group
+#undef LANG_HOOKS_TYPE_HASH_EQ
+#define LANG_HOOKS_TYPE_HASH_EQ cxx_type_hash_eq
#undef LANG_HOOKS_FUNCTION_INIT
#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
--- gcc/cp/tree.c.jj 2007-03-12 03:28:01.000000000 -0400
+++ gcc/cp/tree.c 2007-09-22 03:46:10.000000000 -0400
@@ -1959,6 +1959,22 @@ cp_build_type_attribute_variant (tree ty
return new_type;
}
+/* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
+ Called only after doing all language independent checks. Only
+ to check TYPE_RAISES_EXCEPTIONS for FUNCTION_TYPE, the rest is already
+ compared in type_hash_eq. */
+
+bool
+cxx_type_hash_eq (tree typea, tree typeb)
+{
+ if (TREE_CODE (typea) != FUNCTION_TYPE
+ || TYPE_RAISES_EXCEPTIONS (typea) == TYPE_RAISES_EXCEPTIONS (typeb))
+ return true;
+
+ return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
+ TYPE_RAISES_EXCEPTIONS (typeb), 1);
+}
+
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal. Called from walk_tree. */
--- gcc/testsuite/g++.dg/ext/attrib29.C.jj 2007-09-22 03:46:10.000000000 -0400
+++ gcc/testsuite/g++.dg/ext/attrib29.C 2007-09-22 03:46:10.000000000 -0400
@@ -0,0 +1,10 @@
+// PR c++/33506
+// { dg-do compile }
+
+extern int f1 (char *) __attribute__ ((warn_unused_result));
+extern int f2 (char *) throw () __attribute__ ((warn_unused_result));
+extern int f2 (char *) throw ();
+
+extern int f3 (char *) __attribute__ ((nonnull (1)));
+extern int f4 (char *) throw () __attribute__ ((nonnull (1)));
+extern int f4 (char *) throw ();

View File

@ -1,73 +0,0 @@
2007-01-24 Steve LoBasso <slobasso@yahoo.com>
Paolo Carlini <pcarlini@suse.de>
* include/bits/deque.tcc (deque<>::erase(iterator, iterator)):
Fix condition.
* testsuite/23_containers/deque/modifiers/erase/3.cc: New.
--- libstdc++-v3/include/bits/deque.tcc (revision 121146)
+++ libstdc++-v3/include/bits/deque.tcc (revision 121147)
@@ -142,7 +142,7 @@ namespace _GLIBCXX_STD
const difference_type __n = __last - __first;
const difference_type __elems_before = (__first
- this->_M_impl._M_start);
- if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
+ if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)
{
std::copy_backward(this->_M_impl._M_start, __first, __last);
iterator __new_start = this->_M_impl._M_start + __n;
--- libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc (revision 0)
+++ libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc (revision 121147)
@@ -0,0 +1,52 @@
+// Copyright (C) 2007 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.
+
+// 23.2.1.3 deque modifiers
+
+#include <deque>
+#include <testsuite_hooks.h>
+
+void erase(size_t num_elm, size_t elm_strt, size_t elm_end)
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::copy_tracker;
+ using __gnu_test::assignment_operator;
+
+ std::deque<copy_tracker> x(num_elm);
+ copy_tracker::reset();
+
+ x.erase(x.begin() + elm_strt, x.begin() + elm_end);
+
+ const size_t min_num_cpy = std::min(elm_strt, num_elm - elm_end);
+ VERIFY( assignment_operator::count() == min_num_cpy );
+}
+
+// http://gcc.gnu.org/ml/libstdc++/2007-01/msg00098.html
+void test01()
+{
+ for (size_t num_elm = 0; num_elm <= 10; ++num_elm)
+ for (size_t elm_strt = 0; elm_strt <= num_elm; ++elm_strt)
+ for (size_t elm_end = elm_strt; elm_end <= num_elm; ++elm_end)
+ erase(num_elm, elm_strt, elm_end);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}

42
gcc41-rh247256.patch Normal file
View File

@ -0,0 +1,42 @@
2007-07-10 Jakub Jelinek <jakub@redhat.com>
* simplify-rtx.c (simplify_plus_minus_op_data_cmp): If both operands
are REGs and TARGET_INDEX_OPERAND_FIRST, sort lower REGNOs first.
* gcc.dg/20070710-1.c: New test.
--- gcc/simplify-rtx.c.jj 2006-08-11 17:32:05.000000000 +0200
+++ gcc/simplify-rtx.c 2007-07-09 22:53:26.000000000 +0200
@@ -2608,6 +2608,12 @@ simplify_plus_minus_op_data_cmp (const v
- commutative_operand_precedence (d1->op));
if (result)
return result;
+
+ /* Group together equal REGs to do more simplification. */
+ if (TARGET_INDEX_OPERAND_FIRST && REG_P (d1->op) && REG_P (d2->op)
+ && REGNO (d1->op) != REGNO (d2->op))
+ return REGNO (d1->op) - REGNO (d2->op);
+
return d1->ix - d2->ix;
}
--- gcc/testsuite/gcc.dg/20070710-1.c.jj 2007-07-10 09:32:43.000000000 +0200
+++ gcc/testsuite/gcc.dg/20070710-1.c 2007-07-10 09:31:39.000000000 +0200
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern float sqrtf (float);
+
+float
+foo (const float *m)
+{
+ float x = m[0] + m[1] + m[2] + 1.0f;
+ float s;
+
+ if (x > 0.001)
+ s = 0.5f / sqrtf (x);
+ else
+ s = 2.0f * sqrtf (1.0f + m[0] - m[1] - m[2]);
+ return s;
+}

View File

@ -1,93 +0,0 @@
2006-09-18 Jakub Jelinek <jakub@redhat.com>
* builtins.c (expand_builtin, maybe_emit_chk_warning): Handle
BUILT_IN_STRNCAT_CHK.
* gcc.dg/builtin-strncat-chk-1.c: New test.
--- gcc/builtins.c.jj 2006-09-02 08:54:22.000000000 +0200
+++ gcc/builtins.c 2006-09-18 16:54:57.000000000 +0200
@@ -6437,6 +6437,7 @@ expand_builtin (tree exp, rtx target, rt
case BUILT_IN_STPCPY_CHK:
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
+ case BUILT_IN_STRNCAT_CHK:
case BUILT_IN_SNPRINTF_CHK:
case BUILT_IN_VSNPRINTF_CHK:
maybe_emit_chk_warning (exp, fcode);
@@ -10128,6 +10129,11 @@ maybe_emit_chk_warning (tree exp, enum b
arg_mask = 6;
is_strlen = 1;
break;
+ case BUILT_IN_STRNCAT_CHK:
+ /* For __strncat_chk the warning will be emitted only if overflowing
+ by at least strlen (dest) + 1 bytes. */
+ arg_mask = 12;
+ break;
case BUILT_IN_STRNCPY_CHK:
arg_mask = 12;
break;
@@ -10165,6 +10171,22 @@ maybe_emit_chk_warning (tree exp, enum b
if (! len || ! host_integerp (len, 1) || tree_int_cst_lt (len, size))
return;
}
+ else if (fcode == BUILT_IN_STRNCAT_CHK)
+ {
+ tree src = TREE_VALUE (TREE_CHAIN (arglist));
+ if (! src || ! host_integerp (len, 1) || tree_int_cst_lt (len, size))
+ return;
+ src = c_strlen (src, 1);
+ if (! src || ! host_integerp (src, 1))
+ {
+ locus = EXPR_LOCATION (exp);
+ warning (0, "%Hcall to %D might overflow destination buffer",
+ &locus, get_callee_fndecl (exp));
+ return;
+ }
+ else if (tree_int_cst_lt (src, size))
+ return;
+ }
else if (! host_integerp (len, 1) || ! tree_int_cst_lt (size, len))
return;
--- gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c.jj 2006-09-18 13:07:54.000000000 +0200
+++ gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c 2006-09-18 16:55:09.000000000 +0200
@@ -0,0 +1,38 @@
+/* Test whether buffer overflow warnings for __strncat_chk builtin
+ are emitted properly. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=gnu99" } */
+
+extern void abort (void);
+
+#include "../gcc.c-torture/execute/builtins/chk.h"
+
+char buf1[20];
+char *q;
+
+void
+test (int arg, ...)
+{
+ char *p = &buf1[10];
+
+ *p = 0;
+ strncat (p, "abcdefg", 9);
+ *p = 0;
+ strncat (p, "abcdefghi", 9);
+ *p = 0;
+ strncat (p, "abcdefghij", 9);
+ *p = 0;
+ strncat (p, "abcdefghi", 10);
+ *p = 0;
+ strncat (p, "abcdefghij", 10); /* { dg-warning "will always overflow" } */
+ *p = 0;
+ strncat (p, "abcdefgh", 11);
+ *p = 0;
+ strncat (p, "abcdefghijkl", 11); /* { dg-warning "will always overflow" } */
+ *p = 0;
+ strncat (p, q, 9);
+ *p = 0;
+ strncat (p, q, 10); /* { dg-warning "might overflow" } */
+ *p = 0;
+ strncat (p, q, 11); /* { dg-warning "might overflow" } */
+}

View File

@ -1,392 +0,0 @@
2006-12-08 Jakub Jelinek <jakub@redhat.com>
* g++.dg/debug/vartrack1.C: New test.
* g++.dg/opt/ifcvt1.C: New test.
2006-12-08 Alexandre Oliva <aoliva@redhat.com>
* g++.dg/template/array17.C: New test.
2006-05-05 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tls/opt-13.c: New test.
2006-04-25 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20060425-2.c: New test.
* g++.dg/opt/pr15054-2.C: New test.
2006-04-20 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20060420-1.c: New test.
2006-04-12 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20060412-1.c: New test.
2006-02-25 Alexandre Oliva <aoliva@redhat.com>
* gcc.target/powerpc/altivec-23.c: New test.
--- gcc/testsuite/gcc.target/powerpc/altivec-23.c 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.target/powerpc/altivec-23.c 2006-02-25 04:10:36.000000000 -0300
@@ -0,0 +1,25 @@
+/* Verify that it is possible to define variables of composite types
+ containing vector types. We used to crash handling the
+ initializer of automatic ones. */
+
+/* { dg-do compile } */
+/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "-maltivec" } { "" } } */
+/* { dg-options "-maltivec -mabi=altivec" } */
+
+#include <altivec.h>
+
+typedef int bt;
+typedef vector bt vt;
+typedef struct { vt x; bt y[sizeof(vt) / sizeof (bt)]; } st;
+#define INIT { 1, 2, 3, 4 }
+
+void f ()
+{
+ vt x = INIT;
+ vt y[1] = { INIT };
+ st s = { INIT, INIT };
+}
+
+vt x = INIT;
+vt y[1] = { INIT };
+st s = { INIT, INIT };
--- gcc/testsuite/gcc.c-torture/execute/20060420-1.c.jj 2006-04-20 18:47:19.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20060420-1.c 2006-04-20 19:07:20.000000000 +0200
@@ -0,0 +1,71 @@
+extern void abort (void);
+
+typedef float v4flt __attribute__ ((vector_size (16)));
+
+void __attribute__ ((noinline)) foo (float *dst, float **src, int a, int n)
+{
+ int i, j;
+ int z = sizeof (v4flt) / sizeof (float);
+ unsigned m = sizeof (v4flt) - 1;
+
+ for (j = 0; j < n && (((unsigned long) dst + j) & m); ++j)
+ {
+ float t = src[0][j];
+ for (i = 1; i < a; ++i)
+ t += src[i][j];
+ dst[j] = t;
+ }
+
+ for (; j < (n - (4 * z - 1)); j += 4 * z)
+ {
+ v4flt t0 = *(v4flt *) (src[0] + j + 0 * z);
+ v4flt t1 = *(v4flt *) (src[0] + j + 1 * z);
+ v4flt t2 = *(v4flt *) (src[0] + j + 2 * z);
+ v4flt t3 = *(v4flt *) (src[0] + j + 3 * z);
+ for (i = 1; i < a; ++i)
+ {
+ t0 += *(v4flt *) (src[i] + j + 0 * z);
+ t1 += *(v4flt *) (src[i] + j + 1 * z);
+ t2 += *(v4flt *) (src[i] + j + 2 * z);
+ t3 += *(v4flt *) (src[i] + j + 3 * z);
+ }
+ *(v4flt *) (dst + j + 0 * z) = t0;
+ *(v4flt *) (dst + j + 1 * z) = t1;
+ *(v4flt *) (dst + j + 2 * z) = t2;
+ *(v4flt *) (dst + j + 3 * z) = t3;
+ }
+ for (; j < n; ++j)
+ {
+ float t = src[0][j];
+ for (i = 1; i < a; ++i)
+ t += src[i][j];
+ dst[j] = t;
+ }
+}
+
+float buffer[64];
+
+int
+main (void)
+{
+ int i;
+ float *dst, *src[2];
+
+ dst = buffer;
+ dst += (-(long int) buffer & (16 * sizeof (float) - 1)) / sizeof (float);
+ src[0] = dst + 16;
+ src[1] = dst + 32;
+ for (i = 0; i < 16; ++i)
+ {
+ src[0][i] = (float) i + 11 * (float) i;
+ src[1][i] = (float) i + 12 * (float) i;
+ }
+ foo (dst, src, 2, 16);
+ for (i = 0; i < 16; ++i)
+ {
+ float e = (float) i + 11 * (float) i + (float) i + 12 * (float) i;
+ if (dst[i] != e)
+ abort ();
+ }
+ return 0;
+}
--- gcc/testsuite/gcc.c-torture/execute/20060412-1.c.jj 2006-04-03 11:04:53.758553500 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20060412-1.c 2006-04-12 10:54:20.000000000 +0200
@@ -0,0 +1,33 @@
+extern void abort (void);
+
+struct S
+{
+ long o;
+};
+
+struct T
+{
+ long o;
+ struct S m[82];
+};
+
+struct T t;
+
+int
+main ()
+{
+ struct S *p, *q;
+
+ p = (struct S *) &t;
+ p = &((struct T *) p)->m[0];
+ q = p + 82;
+ while (--q > p)
+ q->o = -1;
+ q->o = 0;
+
+ if (q > p)
+ abort ();
+ if (q - p > 0)
+ abort ();
+ return 0;
+}
--- gcc/testsuite/g++.dg/opt/pr15054-2.C 2006-04-19 19:21:31.748476000 +0200
+++ gcc/testsuite/g++.dg/opt/pr15054-2.C 2006-04-25 15:55:07.000000000 +0200
@@ -0,0 +1,39 @@
+// PR middle-end/15054
+
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+void
+__attribute__((noinline))
+check (long x, long y)
+{
+ if (x != y)
+ abort ();
+}
+
+struct A
+{
+ A() : a(2) { check (a, 2); }
+ ~A() { check (a, 2); }
+private:
+ long a;
+};
+
+class B {
+ long b;
+ B& operator =(const B& );
+public:
+ B (long p) : b(p) { check (b, 6); }
+ B (const B& p) : b(p.b) { check (b, 6); }
+ ~B () { check (b, 6); A obj; check (b, 6); }
+ B foo() { return B(*this); }
+};
+
+int main ()
+{
+ B o(6);
+ o.foo().foo();
+ return 0;
+}
--- gcc/testsuite/gcc.dg/20060425-2.c 2004-06-24 14:04:38.000000000 -0400
+++ gcc/testsuite/gcc.dg/20060425-2.c 2006-04-25 09:15:04.000000000 -0400
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+double
+crashme (double v, double *p)
+{
+ if (v < 0. && *p == 1.)
+ v = 0.;
+ return v;
+}
--- gcc/testsuite/gcc.dg/tls/opt-13.c 2006-04-19 19:21:31.748476000 +0200
+++ gcc/testsuite/gcc.dg/tls/opt-13.c 2006-05-05 11:01:33.000000000 +0200
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+
+__thread struct
+{
+ int a;
+ char b[32];
+} thr;
+
+int
+main ()
+{
+ __builtin_strcpy (thr.b, "abcd");
+ return 0;
+}
--- gcc/testsuite/g++.dg/debug/vartrack1.C 2004-06-24 14:04:38.000000000 -0400
+++ gcc/testsuite/g++.dg/debug/vartrack1.C 2006-12-08 05:29:41.000000000 -0500
@@ -0,0 +1,99 @@
+// This testcase used to hang the compiler in vt_find_locations.
+// { dg-do compile }
+// { dg-options "-O2 -g" }
+
+struct S
+{
+ int a;
+ S *b, *c, *d;
+};
+
+struct T
+{
+ void f1 (S *x);
+ void f2 (S *x);
+ void f3 (S *x, S *y);
+ S *e;
+};
+
+void
+T::f3 (S *x, S *y)
+{
+ while (x != this->e && (!x || x->a == 1))
+ {
+ if (x == y->c)
+ {
+ S *w = y->d;
+ if (w && w->a == 0)
+ {
+ w->a = 1;
+ y->a = 0;
+ f2 (y);
+ w = y->d;
+ }
+ if (w && (!w->c || w->c->a == 1) && (!w->d || w->d->a == 1))
+ {
+ w->a = 0;
+ x = y;
+ y = x->b;
+ }
+ else
+ {
+ if (w && (!w->d || w->d->a == 1))
+ {
+ if (w->c)
+ w->c->a = 1;
+ w->a = 0;
+ f1 (w);
+ w = y->d;
+ }
+ if (w)
+ {
+ w->a = y->a;
+ if (w->d)
+ w->d->a = 1;
+ }
+ y->a = 1;
+ f2 (y);
+ x = e;
+ }
+ }
+ else
+ {
+ S *w = y->c;
+ if (w && w->a == 0)
+ {
+ w->a = 1;
+ y->a = 0;
+ f1 (y);
+ w = y->c;
+ }
+ if (w && (!w->c || w->c->a == 1) && (!w->d || w->d->a == 1))
+ {
+ w->a = 0;
+ x = y;
+ y = x->b;
+ }
+ else
+ {
+ if (w && (!w->c || w->c->a == 1))
+ {
+ w->a = 0;
+ if (w->d)
+ w->d->a = 1;
+ f2 (w);
+ w = y->c;
+ }
+ if (w)
+ {
+ w->a = y->a;
+ if (w->c)
+ w->c->a = 1;
+ }
+ y->a = 1;
+ f1 (y);
+ x = e;
+ }
+ }
+ }
+}
--- gcc/testsuite/g++.dg/opt/ifcvt1.C 2006-10-04 16:28:56.502613000 +0200
+++ gcc/testsuite/g++.dg/opt/ifcvt1.C 2006-12-08 12:23:23.000000000 +0100
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+struct S { ~S () throw () {} };
+double bar ();
+
+int
+foo ()
+{
+ S a;
+ int i = 0;
+ double c = bar ();
+ c = c < 0 ? -c : c;
+ if (c <= 1.e-8)
+ i += 24;
+ return i;
+}
--- gcc/testsuite/g++.dg/template/array17.C 2006-10-04 16:28:56.502613000 +0200
+++ gcc/testsuite/g++.dg/template/array17.C 2006-12-08 12:38:27.000000000 +0100
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+template <typename T>
+struct V {
+ T& operator[](int);
+};
+
+struct S {
+ S operator +(int);
+ template <typename T> T value();
+};
+
+template <typename T>
+void R (T v)
+{
+ v[(S() + 0).template value<int>()][0] = 0;
+}
+
+int
+main ()
+{
+ R(V<V<int> >());
+}

View File

@ -1,33 +0,0 @@
2007-05-03 Jakub Jelinek <jakub@redhat.com>
* varasm.c (align_variable): Don't increase alignment for
DECL_THREAD_LOCAL_P variables above BITS_PER_WORD through
DATA_ALIGNMENT or CONSTANT_ALIGNMENT.
--- gcc/varasm.c.jj 2007-04-14 14:55:25.000000000 +0200
+++ gcc/varasm.c 2007-05-03 11:23:56.000000000 +0200
@@ -1097,11 +1097,22 @@ align_variable (tree decl, bool dont_out
if (! DECL_USER_ALIGN (decl))
{
#ifdef DATA_ALIGNMENT
- align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
+ unsigned int data_align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
+ /* Don't increase alignment too much for TLS variables - TLS space
+ is too precious. */
+ if (! DECL_THREAD_LOCAL_P (decl) || data_align <= BITS_PER_WORD)
+ align = data_align;
#endif
#ifdef CONSTANT_ALIGNMENT
if (DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != error_mark_node)
- align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);
+ {
+ unsigned int const_align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl),
+ align);
+ /* Don't increase alignment too much for TLS variables - TLS space
+ is too precious. */
+ if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)
+ align = const_align;
+ }
#endif
}

View File

@ -1,6 +1,6 @@
%define DATE 20070503
%define DATE 20070925
%define gcc_version 4.1.2
%define gcc_release 12
%define gcc_release 27
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%define include_gappletviewer 1
@ -25,8 +25,11 @@
Summary: Various compilers (C, C++, Objective-C, Java, ...)
Name: gcc
Version: %{gcc_version}
Release: %{gcc_release}
License: GPL
Release: %{gcc_release}%{?dist}
# libgcc, libgfortran, libmudflap and crtstuff have an exception which allows
# linking it into any kind of programs or shared libraries without
# restrictions.
License: GPLv2+ and GPLv2+ with exceptions
Group: Development/Languages
Source0: gcc-%{version}-%{DATE}.tar.bz2
Source1: libgcc_post_upgrade.c
@ -118,35 +121,34 @@ Patch6: gcc41-ada-pr18302.patch
Patch7: gcc41-ada-tweaks.patch
Patch8: gcc41-java-slow_pthread_self.patch
Patch9: gcc41-ppc32-retaddr.patch
Patch10: gcc41-amdfam10.patch
Patch11: gcc41-dsohandle.patch
Patch12: gcc41-rh184446.patch
Patch13: gcc41-pr20297-test.patch
Patch14: gcc41-objc-rh185398.patch
Patch15: gcc41-tests.patch
Patch16: gcc41-hash-style-gnu.patch
Patch17: gcc41-java-libdotdotlib.patch
Patch18: gcc41-pr28709.patch
Patch19: gcc41-pr28755.patch
Patch20: gcc41-pr27898.patch
Patch21: gcc41-pr27567.patch
Patch22: gcc41-pr29272.patch
Patch23: gcc41-pr29059.patch
Patch24: gcc41-strncat-chk.patch
Patch25: gcc41-pr29299.patch
Patch26: gcc41-java-bogus-debugline.patch
Patch27: gcc41-libjava-visibility.patch
Patch28: gcc41-pr31187.patch
Patch29: gcc41-dtor-relro.patch
Patch30: gcc41-rh234515.patch
Patch31: gcc41-libgomp-ncpus.patch
Patch32: gcc41-rh236895.patch
Patch33: gcc41-pr28482.patch
Patch34: gcc41-rh235008.patch
Patch35: gcc41-pr31748.patch
Patch36: gcc41-tls-data-alignment.patch
Patch10: gcc41-dsohandle.patch
Patch11: gcc41-rh184446.patch
Patch12: gcc41-pr20297-test.patch
Patch13: gcc41-hash-style-gnu.patch
Patch14: gcc41-java-libdotdotlib.patch
Patch15: gcc41-pr28755.patch
Patch16: gcc41-pr27898.patch
Patch17: gcc41-java-bogus-debugline.patch
Patch18: gcc41-libjava-visibility.patch
Patch19: gcc41-pr32139.patch
Patch20: gcc41-rh236895.patch
Patch21: gcc41-rh235008.patch
Patch22: gcc41-build-id.patch
Patch23: gcc41-pr28690.patch
Patch24: gcc41-rh247256.patch
Patch25: gcc41-ppc64-ia64-GNU-stack.patch
Patch26: gcc41-pr33506.patch
Patch27: gcc41-artificial-attrib.patch
Patch28: gcc41-error-attrib.patch
Patch29: gcc41-jdwp.patch
Patch30: gcc41-pr20880.patch
Patch31: gcc41-pr32694.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
%ifnarch %{arm}
%define _gnu %{nil}
%endif
%ifarch sparc
%define gcc_target_platform sparc64-%{_vendor}-%{_target_os}
%endif
@ -433,33 +435,28 @@ which are required to run programs compiled with the GNAT.
%patch7 -p0 -b .ada-tweaks~
%patch8 -p0 -b .java-slow_pthread_self~
%patch9 -p0 -b .ppc32-retaddr~
%patch10 -p0 -b .amdfam10~
%patch11 -p0 -b .dsohandle~
%patch12 -p0 -b .rh184446~
%patch13 -p0 -E -b .pr20297-test~
%patch14 -p0 -b .objc-rh185398~
%patch15 -p0 -b .tests~
%patch16 -p0 -b .hash-style-gnu~
%patch17 -p0 -b .java-libdotdotlib~
%patch18 -p0 -b .pr28709~
%patch19 -p0 -b .pr28755~
%patch20 -p0 -b .pr27898~
%patch21 -p0 -b .pr27567~
%patch22 -p0 -b .pr29272~
%patch23 -p0 -b .pr29059~
%patch24 -p0 -b .strncat-chk~
%patch25 -p0 -b .pr29299~
%patch26 -p0 -b .java-bogus-debugline~
%patch27 -p0 -b .libjava-visibility~
%patch28 -p0 -b .pr31187~
%patch29 -p0 -b .dtor-relro~
%patch30 -p0 -b .rh234515~
%patch31 -p0 -b .libgomp-ncpus~
%patch32 -p0 -b .rh236895~
%patch33 -p0 -b .pr28482~
%patch34 -p0 -b .rh235008~
%patch35 -p0 -b .pr31748~
%patch36 -p0 -b .tls-data-alignment~
%patch10 -p0 -b .dsohandle~
%patch11 -p0 -b .rh184446~
%patch12 -p0 -E -b .pr20297-test~
%patch13 -p0 -b .hash-style-gnu~
%patch14 -p0 -b .java-libdotdotlib~
%patch15 -p0 -b .pr28755~
%patch16 -p0 -b .pr27898~
%patch17 -p0 -b .java-bogus-debugline~
%patch18 -p0 -b .libjava-visibility~
%patch19 -p0 -b .pr32139~
%patch20 -p0 -b .rh236895~
%patch21 -p0 -b .rh235008~
#%patch22 -p0 -b .build-id~
%patch23 -p0 -b .pr28690~
%patch24 -p0 -b .rh247256~
%patch25 -p0 -b .ppc64-ia64-GNU-stack~
%patch26 -p0 -b .pr33506~
%patch27 -p0 -b .artificial-attrib~
%patch28 -p0 -b .error-attrib~
%patch29 -p0 -b .jdwp~
%patch30 -p0 -b .pr20880~
%patch31 -p0 -b .pr32694~
sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@ -752,6 +749,17 @@ EOF
fi
done
# Nuke bits/stdc++.h.gch dirs
# 1) there is no bits/stdc++.h header installed, so when gch file can't be
# used, compilation fails
# 2) sometimes it is hard to match the exact options used for building
# libstdc++-v3 or they aren't desirable
# 3) there are multilib issues, conflicts etc. with this
# 4) it is huge
# People can always precompile on their own whatever they want, but
# shipping this for everybody is unnecessary.
rm -rf $RPM_BUILD_ROOT%{_prefix}/include/c++/%{gcc_version}/%{gcc_target_platform}/bits/stdc++.h.gch
%ifarch sparc sparc64
ln -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target_platform}-gcc \
$RPM_BUILD_ROOT%{_prefix}/bin/sparc-%{_vendor}-%{_target_os}-gcc
@ -873,7 +881,7 @@ mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgfortran.*a .
mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgfortranbegin.*a .
mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libobjc.*a .
mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgomp.*a .
mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libmudflap{,th}.*a .
mv -f $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libmudflap{,th}.*a $FULLLPATH/
mv -f $RPM_BUILD_ROOT%{_prefix}/include/mf-runtime.h include/
%ifarch sparc ppc
@ -895,9 +903,12 @@ mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libgfortran.*a 64/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libgfortranbegin.*a 64/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libobjc.*a 64/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libgomp.*a 64/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib64/libmudflap{,th}.*a 64/
ln -sf lib32/libstdc++.a libstdc++.a
ln -sf ../lib64/libstdc++.a 64/libstdc++.a
ln -sf lib32/libmudflap.a libmudflap.a
ln -sf ../lib64/libmudflap.a 64/libmudflap.a
ln -sf lib32/libmudflapth.a libmudflapth.a
ln -sf ../lib64/libmudflapth.a 64/libmudflapth.a
%endif
%ifarch %{multilib_64_archs}
mkdir -p 32
@ -917,11 +928,14 @@ mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libgfortran.*a 32/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libgfortranbegin.*a 32/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libobjc.*a 32/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libgomp.*a 32/
mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libmudflap{,th}.*a 32/
%endif
%ifarch sparc64 ppc64
ln -sf ../lib32/libstdc++.a 32/libstdc++.a
ln -sf lib64/libstdc++.a libstdc++.a
ln -sf ../lib32/libmudflap.a 32/libmudflap.a
ln -sf lib64/libmudflap.a libmudflap.a
ln -sf ../lib32/libmudflapth.a 32/libmudflapth.a
ln -sf lib64/libmudflapth.a libmudflapth.a
%if %{build_java}
ln -sf ../lib32/libgcj_bc.so 32/libgcj_bc.so
ln -sf lib64/libgcj_bc.so libgcj_bc.so
@ -929,6 +943,8 @@ ln -sf lib64/libgcj_bc.so libgcj_bc.so
%else
%ifarch %{multilib_64_archs}
ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_version}/libstdc++.a 32/libstdc++.a
ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_version}/libmudflap.a 32/libmudflap.a
ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_version}/libmudflapth.a 32/libmudflapth.a
%if %{build_java}
ln -sf ../../../%{multilib_32_arch}-%{_vendor}-%{_target_os}/%{gcc_version}/libgcj_bc.so 32/libgcj_bc.so
%endif
@ -1205,6 +1221,10 @@ fi
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libgcc_s.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libgomp.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libgomp.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflapth.so
%endif
%ifarch %{multilib_64_archs}
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32
@ -1215,6 +1235,16 @@ fi
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libgcc_s.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libgomp.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libgomp.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflapth.so
%endif
%ifarch sparc sparc64 ppc ppc64
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflapth.so
%endif
%dir %{_prefix}/libexec/getconf
%{_prefix}/libexec/getconf/default
@ -1562,27 +1592,120 @@ fi
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/include/mf-runtime.h
%ifarch sparc ppc
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib32
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib32/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib32/libmudflapth.a
%endif
%ifarch sparc64 ppc64
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib64
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib64/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/lib64/libmudflapth.a
%endif
%ifnarch sparc sparc64 ppc ppc64
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/libmudflapth.so
%ifarch sparc ppc
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/64/libmudflapth.so
%endif
%ifarch %{multilib_64_archs}
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflap.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflapth.a
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflap.so
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/32/libmudflapth.so
%endif
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
* Tue Sep 25 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-27.fc7
- update from gcc-4_1-branch (-r127672:128736)
- PRs bootstrap/33418, c++/31941, c++/32113, java/31842, target/33256,
tree-optimization/33142
- add support for artificial, error and warning attributes
- restore Java CNI ABI compatibility broken by JDWP changes (Keith Seitz)
- fix ICE with set_rhs allowing non-gimple (Roger Sayle, #247407,
PR tree-optimization/32694)
- fix ICE on Fortran interface-body declaring current subroutine name
(Paul Thomas, #300851, PR fortran/20880)
- don't ignore throw specification of function types in type hashing
(PR c++/33506)
- handle makeinfo version >= 4.10 in gcc configury
* Mon Sep 17 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-24.fc7
- fix ICE on __builtin_mem*_chk if it couldn't be folded until
expand time and at that point it can avoid a call (PR middle-end/33423)
- handle the upcoming POSIX 'm' *scanf allocation modifier in
GCC format checking, fix up some details about %as/%aS/%a[
* Fri Sep 14 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-23.fc7
- backport __builtin_va_arg_pack_len () support
- fix Fortran error recovery with DATA (Jerry DeLisle, #281331,
PR fortran/27954)
* Fri Sep 7 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-22.fc7
- fix __builtin_va_arg_pack () support for C++
* Thu Sep 6 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-21.fc7
- backport __builtin_va_arg_pack () support
- make sure __builtin_{,v}{,f}{print,scan}f, __builtin_{,f}printf_unlocked
and __builtin___{,v}{,f}printf_chk can throw
- handle __*_chk builtins without __builtin_ in the name as anticipated in
C++
* Sat Sep 1 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-20.fc7
- fix libmudflap-devel multilib conflict on ppc/ppc64 and sparc/sparc64
(#270281)
- backport __attribute__((__gnu_inline__)) support for C++
- fix ppc/ppc64 __sync_* builtins with aligned 8 or 16-bit values
- don't set executable flag on .note.GNU-stack on ppc64/ia64 even
when trampolines are used - trampolines on those architectures
don't need executable stack
* Mon Aug 27 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-18.fc7
- update from gcc-4_1-branch (-r124365:127672)
- PRs c++/32112, c++/17763, rtl-optimization/32450, target/31331,
target/32641, target/32660, tree-optimization/32681,
boehm-gc/21940, boehm-gc/21942, target/28307, target/32506,
tree-optimization/31966, tree-optimization/32533,
inline-asm/32109, rtl-optimization/28011, target/32389,
libfortran/31409, libfortran/31880, libfortran/31964,
rtl-optimization/31691, target/31022, target/31480, target/31701,
target/31876, target/32163, tree-optimization/26998
- fix ppc32 libgcc.a(tramp.o), so that binaries using trampolines
aren't forced to use bss PLT
- fix a fortran charlen sharing bug (#253102)
- fix ICE with X|~X or X^~X with vectors (PR middle-end/32912)
- nuke bits/stdc++.gch directories from libstdc++-devel (#253304)
- fix fortran Tx format handling (Jerry DeLisle, #252152,
PR libgfortran/32678)
- add support for Sun UltraSPARC T1 chips - -mcpu=niagara (David S. Miller)
- don't NRV optimize fields inside anonymous unions (PR c++/32992)
- fortran debuginfo improvements for constant bound arrays (#248541,
PR fortran/22244)
- update License tag
- backport ARM fixes from trunk (#246800)
- PRs middle-end/24998, target/28516, target/30486
- fix simplify_plus_minus with ppc{,64} power6 tuning (regression from
4.1.1-52.el5.2, #247256)
- fix OpenMP handling of Fortran POINTER non-array vars (PR fortran/32550)
- gomp update from gcc-4_2-branch (-r125917:125918)
- PR middle-end/32362
- on ppc{,64} when tuning for power6{,x}, try to put the base
register as first operand in instructions to improve
performance (Peter Bergner, #225425, PR middle-end/28690)
- on ppc64 emit nop after a call and disallow sibling calls
if the target function is not defined in the same object file
(David Edelsohn, #245424)
- gomp parallel sections fix and fix for checking whether combined
parallel can be used (PR libgomp/32468)
- gomp updates from the trunk (-r125541:125542, -r125543:125544) and
from gcc-4_2-branch (-r125184:125185)
- PRs tree-optimization/31769, c++/32177
- don't set TREE_READONLY on C++ objects that need runtime initialization
(PRs c++/31806, c++/31809)
- fix computation of common pointer type (PR tree-optimization/32139)
- precompute const and pure fn calls inside another fn call arguments
with accumulating outgoing args
(PRs middle-end/32285, tree-optimization/30493)
- fix handling of RESULT_DECLs in points-to analysis
(#243438, PR tree-optimization/32353)
- work around java.lang.reflect.Modifier.INTERPRETED clash with
java.lang.reflect.Modifier.SYNTHETIC (Andrew Haley, #240720)
* Thu May 3 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-12
- update from gcc-4_1-branch (-r124100:124365)
- PRs c++/30016, c++/30221, middle-end/30761, target/18989,

View File

@ -387,6 +387,35 @@ register void *__thread_self __asm ("g7");
: inline_syscall_clobbers, "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#elif defined __arm__ && defined __ARM_EABI__
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
# define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
register int _r0 __asm__("r0"); \
register int _nr __asm__("r7"); \
LOAD_ARGS_##nr(args) \
_nr = __NR_##name; \
asm volatile ("swi\t0\t@ syscall " #name "\n\t" \
: "=r" (_r0) \
: "r" (_nr) ASM_ARGS_##nr \
: "memory"); \
_r0; })
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
# define ASM_ARGS_0
# define ASM_ARGS_1 , "r" (_r0)
# define ASM_ARGS_2 , "r" (_r0), "r" (_r1)
# define ASM_ARGS_3 , "r" (_r0), "r" (_r1), "r" (_r2)
# define LOAD_ARGS_0()
# define LOAD_ARGS_1(r0) \
_r0 = (int)r0;
# define LOAD_ARGS_2(r0, r1) \
_r0 = (int)r0; \
register int _r1 __asm__("r1") = (int)r1;
# define LOAD_ARGS_3(r0, r1, r2) \
_r0 = (int)r0; \
register int _r1 __asm__("r1") = (int)r1; \
register int _r2 __asm__("r2") = (int)r2;
#endif
int main (int argc, char **argv)

View File

@ -1 +1 @@
f592f2e4d5779b970a7050a864131e69 gcc-4.1.2-20070503.tar.bz2
562ab2446c60a9145da385ac56cf7715 gcc-4.1.2-20070925.tar.bz2