Re: [4.7][google] Use sysroot from --with-build-sysroot during 'make check' (issue4248059)

2011-03-07 Thread Simon Baldwin
On 4 March 2011 22:50, Diego Novillo  wrote:
> ...
> I forgot to add.  Simon, this still shows up some failures in
> google/integration, but these failures are the same we have in trunk.
>
> For our builds, we have been XFAILing these failures, right?  Do you
> want me to mark them XFAIL to avoid problems with the auto builds?


No, it's okay to leave them failing for now.  I'll go through and
address each individually once the overall framework is settled.

--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902


[libgo] Use _nuname on 32-bit Solaris 2/x86

2011-03-07 Thread Rainer Orth
The libgo os test used to fail on 32-bit Solaris 2/x86 only:

--- FAIL: os_test.TestHostname
   Hostname() = "", want "fuego"

Running the test under gdb, I find that syscall.Uname is entered with
errno = 4 and left the same, even if I reset errno = ENONE on entry.
Further investigation led to this snippet from :

#if defined(__i386) && !defined(__amd64)

static int
uname(struct utsname *_buf)
{
return (_nuname(_buf));
}

#endif

The following patch reflects this and fixes the testcase.

Rainer


2011-03-05  Rainer Orth  

* syscalls/syscall_solaris_386.go (libc_uname): Declare.
* syscalls/syscall_unix.go (libc_uname): Move ...
* syscalls/syscall_uname.go: ... here.
New file.
* Makefile.am (syscall_uname_file) [!LIBGO_IS_SOLARIS &&
!LIBGO_IS_386]: Use it.
(go_syscall_files): Use it.
* Makefile.in: Regenerate.

diff -r cd964439e0b3 libgo/Makefile.am
--- a/libgo/Makefile.am Sat Mar 05 20:51:22 2011 +0100
+++ b/libgo/Makefile.am Sat Mar 05 23:32:30 2011 +0100
@@ -1205,6 +1205,18 @@
 syscall_socket_epoll_file =
 endif
 
+# Support for uname.
+if LIBGO_IS_SOLARIS
+if LIBGO_IS_386
+# 32-bit Solaris 2/x86 needs _nuname, handled in syscall_solaris_386.go.
+syscall_uname_file =
+else # !LIBGO_IS_386 && LIBGO_IS_SOLARIS
+syscall_uname_file = syscalls/syscall_uname.go
+endif
+else # !LIBGO_IS_SOLARIS
+syscall_uname_file = syscalls/syscall_uname.go
+endif
+
 syscall_arch.go: s-syscall_arch; @true
 s-syscall_arch: Makefile
rm -f syscall_arch.go.tmp
@@ -1226,6 +1238,7 @@
$(syscall_socket_os_file) \
$(syscall_socket_epoll_file) \
$(syscall_syscall_file) \
+   $(syscall_uname_file) \
syscalls/syscall_unix.go \
syscalls/stringbyte.go \
syscalls/syscall_$(GOOS).go \
diff -r cd964439e0b3 libgo/syscalls/syscall_solaris_386.go
--- a/libgo/syscalls/syscall_solaris_386.go Sat Mar 05 20:51:22 2011 +0100
+++ b/libgo/syscalls/syscall_solaris_386.go Sat Mar 05 23:32:30 2011 +0100
@@ -15,3 +15,6 @@
 
 var dummy *byte
 const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))
+
+// 32-bit Solaris 2/x86 needs to use _nuname internally, cf. .
+func libc_uname(buf *Utsname) (errno int) __asm__("_nuname")
diff -r cd964439e0b3 libgo/syscalls/syscall_uname.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/libgo/syscalls/syscall_uname.go   Sat Mar 05 23:32:30 2011 +0100
@@ -0,0 +1,7 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+func libc_uname(buf *Utsname) (errno int) __asm__("uname")
diff -r cd964439e0b3 libgo/syscalls/syscall_unix.go
--- a/libgo/syscalls/syscall_unix.goSat Mar 05 20:51:22 2011 +0100
+++ b/libgo/syscalls/syscall_unix.goSat Mar 05 23:32:30 2011 +0100
@@ -15,8 +15,6 @@
 func GetErrno() int
 func SetErrno(int)
 
-func libc_uname(buf *Utsname) (errno int) __asm__("uname")
-
 func Uname(buf *Utsname) (errno int) {
r := libc_uname(buf)
if r < 0 {


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[libgo] Omit /bin in os_test.go

2011-03-07 Thread Rainer Orth
/bin is a directory on Solaris 2, which causes the libgo os test to
fail:

FAIL: os
--- FAIL: os_test.TestChdirAndGetwd
Getwd returned "/usr/bin" want "/bin"

This patch fixes this by simply removing /bin.  One could probably
replace it by /sbin instead, which is a directory on every Unix I know.

Rainer


2011-03-05  Rainer Orth  

* go/os/os_test.go (TestChdirAndGetwd): Remove /bin from dirs.

diff -r 805097eb6ad2 libgo/go/os/os_test.go
--- a/libgo/go/os/os_test.goSat Mar 05 23:32:32 2011 +0100
+++ b/libgo/go/os/os_test.goSat Mar 05 23:39:00 2011 +0100
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009, 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
@@ -609,7 +609,7 @@
}
// These are chosen carefully not to be symlinks on a Mac
// (unlike, say, /var, /etc, and /tmp).
-   dirs := []string{"/bin", "/", "/usr/bin"}
+   dirs := []string{"/", "/usr/bin"}
for mode := 0; mode < 2; mode++ {
for _, d := range dirs {
if mode == 0 {


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[libgo] Don't check gopher, http ports

2011-03-07 Thread Rainer Orth
The gopher (sort of understandable) and http (unexpected and strange)
ports are missing form Solaris 2 /etc/services as far back as Solaris 8,
which causes the libgo net test to fail:

--- FAIL: net.TestLookupPort
LookupPort("tcp", "gopher") = 0, unknown port tcp/gopher; want 70
LookupPort("tcp", "http") = 0, unknown port tcp/http; want 80

Since having those two ports above all the others adds no extra value,
I've simply removed them to fix the test.

Rainer


2011-03-05  Rainer Orth  

* go/net/port_test.go (porttests): Remove gopher, http.

diff -r d7e61c7ee1b8 libgo/go/net/port_test.go
--- a/libgo/go/net/port_test.go Sat Mar 05 23:39:02 2011 +0100
+++ b/libgo/go/net/port_test.go Sat Mar 05 23:46:42 2011 +0100
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009, 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
@@ -27,9 +27,7 @@
{"tcp", "smtp", 25, true},
{"tcp", "time", 37, true},
{"tcp", "domain", 53, true},
-   {"tcp", "gopher", 70, true},
{"tcp", "finger", 79, true},
-   {"tcp", "http", 80, true},
 
{"udp", "echo", 7, true},
{"udp", "tftp", 69, true},


-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[MELT] Fixing compilation issues

2011-03-07 Thread Alexandre Lissy
Hello,

Sorry for the delay, but I had no time to perform this small change while
attending ROADEF 2011 :).
So, here we go, same patches again, with ChangeLog.MELT updated.



[PATCH 1/4] Fix RPM compilation

2011-03-07 Thread Alexandre Lissy
The GCC's options -pipe and -Wp,-D_FORTIFY_SOURCE=2 are passed by
default by Mandriva's GCC RPM spec file, and end up in some parts of
MELT CFLAGS. But they should not end up there.
---
 gcc/Makefile.in |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 3f1ffa0..f841776 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -5341,6 +5341,7 @@ MELT_RAW_CFLAGS= \
 ## since the generated routines are no more huge (since the
 ## initialization code is split in several chunks).. Likewise, avoid
 ## passing -gtoggle and -g
+## Also remove -pipe and -Wp,-D_FORTIFY_SOURCE=2
 MELTHERE_CFLAGS= $(filter-out -g, $(filter-out -gtoggle, $(MELT_RAW_CFLAGS)))
 export MELTHERE_CFLAGS
 
@@ -5430,7 +5431,10 @@ melt_make_source_dir=$(srcdir)/melt
 melt_make_module_dir=$(objdir)
 melt_make_move=$(SHELL) $(srcdir)/../move-if-change
 ## Don't use := definitions here!
-melt_make_cc1flags= -I. $(MELTHERE_CFLAGS) -I $(melt_build_include_dir)
+## CC1 forbids -pipe and -Wp,-D_FORTIFY_SOURCE=2
+comma= ,
+MELTHERE_CC1_CFLAGS=$(filter-out -pipe -Wp$(comma)-D_FORTIFY_SOURCE=2, 
$(MELTHERE_CFLAGS))
+melt_make_cc1flags= -I. $(MELTHERE_CC1_CFLAGS) -I $(melt_build_include_dir)
 melt_cflags=  -I. $(MELTHERE_CFLAGS) -I $(melt_build_include_dir)
 export melt_cflags
 ## extra cflags are for compiling applicative MELT files, e.g. xtramelt*.c
-- 
1.7.4.1



[PATCH 4/4] Updating MELT ChangeLog

2011-03-07 Thread Alexandre Lissy
---
 ChangeLog.MELT |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index b18e8ff..0e52116 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,3 +1,7 @@
+2011-03-07 Alexandre Lissy 
+
+   * Fixing issues in compilation process for RPM packaging
+   * Regenerating melt-build.mk
 
 2011-02-07 Basile Starynkevitch  
 MELT branch merged with trunk rev 169877 [probably!]
-- 
1.7.4.1



[PATCH 2/4] Fix double '/' in MELT build process

2011-03-07 Thread Alexandre Lissy
Double slashes while building are a problem for RPM's debugedit tool,
which seems to be 'well-known', while never fixed. The only solution is
to fix the build process. Also, remove any trailing slash from
MELTMODULE_SRCDIR variable, since slashes are added when used.
---
 gcc/melt-build.tpl |8 
 gcc/melt-module.mk |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/melt-build.tpl b/gcc/melt-build.tpl
index 20c0012..4666990 100644
--- a/gcc/melt-build.tpl
+++ b/gcc/melt-build.tpl
@@ -107,7 +107,7 @@ melt-stage0-static/[+base+]-0.so: 
$(MELT_GENERATED_[+mkvarsuf+]_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/[+base+]-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/[+base+]-0
@@ -117,7 +117,7 @@ melt-stage0-dynamic/[+base+]-0.d.so: 
$(MELT_GENERATED_[+mkvarsuf+]_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/[+base+]-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/[+base+]-0
@@ -181,7 +181,7 @@ $(MELT_STAGE_ZERO):
   melt-run.h melt-runtime.h melt-predef.h \
   $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=[+melt_stage+]/ \
+  GCCMELT_MODULE_WORKSPACE=[+melt_stage+] \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  GCCMELT_MODULE_SOURCE=[+melt_stage+]/[+ (. outbase)+]-[+(. 
stageindex)+].c \
   GCCMELT_MODULE_BINARY=[+melt_stage+]/[+(. outbase)+]-[+(. 
stageindex)+]
@@ -191,7 +191,7 @@ $(MELT_STAGE_ZERO):
   melt-run.h melt-runtime.h melt-predef.h \
   $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_withoutline \
-  GCCMELT_MODULE_WORKSPACE=[+melt_stage+]/ \
+  GCCMELT_MODULE_WORKSPACE=[+melt_stage+] \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  GCCMELT_MODULE_SOURCE=[+melt_stage+]/[+ (. outbase)+]-[+(. 
stageindex)+].c \
   GCCMELT_MODULE_BINARY=[+melt_stage+]/[+(. outbase)+]-[+(. 
stageindex)+]
diff --git a/gcc/melt-module.mk b/gcc/melt-module.mk
index 38dad9b..3f45736 100644
--- a/gcc/melt-module.mk
+++ b/gcc/melt-module.mk
@@ -46,7 +46,7 @@ endif
 
 MELTMODULE_BASENAME:=$(basename $(GCCMELT_MODULE_SOURCE))
 MELTMODULE_PLAIN:=$(notdir $(MELTMODULE_BASENAME))
-MELTMODULE_SRCDIR:=$(dir $(GCCMELT_MODULE_SOURCE))
+MELTMODULE_SRCDIR:=$(patsubst %/, %, $(dir $(GCCMELT_MODULE_SOURCE)))
 
 
 ## The .d.so & .n.so suffixes are wired in melt-runtime.c!
-- 
1.7.4.1



[PATCH 3/4] Regenerating melt-build.mk

2011-03-07 Thread Alexandre Lissy
---
 gcc/melt-build.mk |  128 ++--
 1 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/gcc/melt-build.mk b/gcc/melt-build.mk
index f00e43b..e75229e 100644
--- a/gcc/melt-build.mk
+++ b/gcc/melt-build.mk
@@ -164,7 +164,7 @@ melt-stage0-static/warmelt-first-0.so: 
$(MELT_GENERATED_FIRST_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-first-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-first-0
@@ -174,7 +174,7 @@ melt-stage0-dynamic/warmelt-first-0.d.so: 
$(MELT_GENERATED_FIRST_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-first-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-first-0
@@ -188,7 +188,7 @@ melt-stage0-static/warmelt-base-0.so: 
$(MELT_GENERATED_BASE_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-base-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-base-0
@@ -198,7 +198,7 @@ melt-stage0-dynamic/warmelt-base-0.d.so: 
$(MELT_GENERATED_BASE_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-base-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-base-0
@@ -212,7 +212,7 @@ melt-stage0-static/warmelt-debug-0.so: 
$(MELT_GENERATED_DEBUG_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-debug-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-debug-0
@@ -222,7 +222,7 @@ melt-stage0-dynamic/warmelt-debug-0.d.so: 
$(MELT_GENERATED_DEBUG_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-debug-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-debug-0
@@ -236,7 +236,7 @@ melt-stage0-static/warmelt-macro-0.so: 
$(MELT_GENERATED_MACRO_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-static/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-static \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-macro-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-static/warmelt-macro-0
@@ -246,7 +246,7 @@ melt-stage0-dynamic/warmelt-macro-0.d.so: 
$(MELT_GENERATED_MACRO_C_FILES) \
  melt-run.h melt-runtime.h melt-runtime.c \
  melt-predef.h $(melt_make_cc1_dependency)
+$(MELT_MAKE_MODULE) melt_module_dynamic \
-  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic/ \
+  GCCMELT_MODULE_WORKSPACE=melt-stage0-dynamic \
  GCCMELT_CFLAGS="$(melt_cflags)" \
  
GCCMELT_MODULE_SOURCE=$(melt_make_source_dir)/generated/warmelt-macro-0.c \
   GCCMELT_MODULE_BINARY=melt-stage0-dynamic/warmelt-macro-0
@@ -260,7 +260

[STORMY16] Hookize PRINT_OPERAND and TARGET_PRINT_OPERAND_ADDRESS

2011-03-07 Thread Anatoly Sokolov
  Hi.

  This patch removes obsolete PRINT_OPERAND and PRINT_OPERAND_ADDRESS
macros from the STORMY16 back end in the GCC and introduces equivalent
TARGET_PRINT_OPERAND and TARGET_PRINT_OPERAND_ADDRESS target hooks.

  Regression tested on xstormy16-unknown-elf.

  OK to install?

* config/stormy16/stormy16.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS):
Remove.
* config/stormy16/stormy16-protos.h (xstormy16_print_operand,
xstormy16_print_operand_address): Remove.
* config/stormy16/stormy16.c (xstormy16_print_operand,
xstormy16_print_operand_address): Make static.
(TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.


Index: gcc/config/stormy16/stormy16.c
===
--- gcc/config/stormy16/stormy16.c  (revision 170660)
+++ gcc/config/stormy16/stormy16.c  (working copy)
@@ -1642,9 +1642,11 @@
   assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 
-/* Print a memory address as an operand to reference that memory location.  */
+/* Worker function for TARGET_PRINT_OPERAND_ADDRESS.
 
-void
+   Print a memory address as an operand to reference that memory location.  */
+
+static void
 xstormy16_print_operand_address (FILE *file, rtx address)
 {
   HOST_WIDE_INT offset;
@@ -1692,9 +1694,11 @@
   fputc (')', file);
 }
 
-/* Print an operand to an assembler instruction.  */
+/* Worker function for TARGET_PRINT_OPERAND.
 
-void
+   Print an operand to an assembler instruction.  */
+
+static void
 xstormy16_print_operand (FILE *file, rtx x, int code)
 {
   switch (code)
@@ -2608,6 +2612,11 @@
 #undef  TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
 
+#undef  TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND xstormy16_print_operand
+#undef  TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS xstormy16_print_operand_address
+
 #undef  TARGET_MEMORY_MOVE_COST
 #define TARGET_MEMORY_MOVE_COST xstormy16_memory_move_cost
 #undef  TARGET_RTX_COSTS
Index: gcc/config/stormy16/stormy16.h
===
--- gcc/config/stormy16/stormy16.h  (revision 170660)
+++ gcc/config/stormy16/stormy16.h  (working copy)
@@ -440,10 +440,6 @@
   { { "r14", 14 }, \
 { "r15", 15 } }
 
-#define PRINT_OPERAND(STREAM, X, CODE) xstormy16_print_operand (STREAM, X, 
CODE)
-
-#define PRINT_OPERAND_ADDRESS(STREAM, X) xstormy16_print_operand_address 
(STREAM, X)
-
 #define REGISTER_PREFIX ""
 #define LOCAL_LABEL_PREFIX "."
 #define USER_LABEL_PREFIX ""
Index: gcc/config/stormy16/stormy16-protos.h
===
--- gcc/config/stormy16/stormy16-protos.h   (revision 170660)
+++ gcc/config/stormy16/stormy16-protos.h   (working copy)
@@ -44,9 +44,6 @@
 extern char *xstormy16_output_cbranch_hi (rtx, const char *, int, rtx);
 extern char *xstormy16_output_cbranch_si (rtx, const char *, int, rtx);
 
-extern void xstormy16_print_operand (FILE *, rtx, int);
-extern void xstormy16_print_operand_address (FILE *, rtx);
-
 extern void xstormy16_expand_casesi (rtx, rtx, rtx, rtx, rtx);
 extern void xstormy16_output_addr_vec (FILE *, rtx, rtx);
 extern void xstormy16_expand_call (rtx, rtx, rtx);


Anatoly.



Ping Re: [PATCH, ARM] Fix PR 43872, incorrectly aligned VLAs

2011-03-07 Thread Chung-Lin Tang
Ping.

On 2011/2/17 06:01 PM, Chung-Lin Tang wrote:
> Hi,
> this PR is a case where we have a leaf function with a zero-size frame,
> that calls alloca() (here through a C99 VLA).
> 
> The ARM backend recognizes the leaf-and-no-frame opportunity to save an
> unneeded stack alignment. But when calling alloca(), the allocated block
> is of BIGGEST_ALIGNMENT, which is 8-bytes under current AAPCS. Thus a
> stack align may still be needed to place the alloca() returned block
> properly.
> 
> This patch adjusts the early return condition with !cfun->calls_alloca.
> Tested without regressions on ARM-Linux, okay for trunk?
> 
> Also related, the BIGGEST_ALIGNMENT defined for ARM is currently
> ABI-based; 64-bits for AAPCS targets, and 32 for old ABI.  Should this
> also consider arch-level as well? i.e. anything >= ARMv5TE (with ldrd)
> should have this set to 64.
> 
> Thanks,
> Chung-Lin
> 
> 2011-02-17  Chung-Lin Tang  
> 
>   PR target/43872
>   * config/arm/arm.c (arm_get_frame_offsets): Adjust early
>   return condition with !cfun->calls_alloca.



Ping Re: [patch, ARM] ICE in get_arm_condition_code()

2011-03-07 Thread Chung-Lin Tang
Ping.

On 2011/1/26 11:09 AM, Chung-Lin Tang wrote:
> Ping.
> (I'll fix the minor nits before actually committing, thanks Ramana :)
> 
> On 2011/1/13 08:24, Chung-Lin Tang wrote:
>> Hi,
>> there's an ICE in arm.c:get_arm_condition_code(), from here:
>> https://bugs.launchpad.net/gcc-linaro/+bug/689887
>>
>> The report was on a 4.5 based compiler, but I verified it also occurs on
>> current trunk, under Thumb-2.
>>
>> The problem as I found, happens in RTL ifcvt after the combine pass.
>> ifcvt.c:noce_emit_cmove() creates this:
>> (insn 58 57 59 4 (parallel [
>> (set (reg:CC_NCV 24 cc)
>> (compare:CC_NCV (reg:DI 140)
>> (reg:DI 147)))
>> (clobber (scratch:SI))
>> ]) p.c:13 202 {*arm_cmpdi_insn}
>>  (nil))
>>
>> (insn 59 58 60 4 (set (reg:SI 146)
>>  (if_then_else:SI (gt (reg:CC_NCV 24 cc)
>> (const_int 0 [0]))
>> (reg:SI 145)
>> (reg:SI 144))) p.c:13 701 {*thumb2_movsicc_insn}
>>  (nil))
>>
>> which is wrong; the GT comparison requires testing of the Z, C, and V
>> flags, which CC_NCV does not satisfy. The ICE happens later when the asm
>> emitting actually hits assert fail in get_arm_condition_code().
>>
>> This patch fixes this by stratifying the "arm_comparison_operator"
>> predicate, by leveraging the current logic in get_arm_condition_code().
>> I abstracted out the body into a new arm_comparison_to_cond_code()
>> function, which returns an invalid code instead of assert fail, and used
>> it to add a check to the comparison RTX in "arm_comparison_operator".
>> This way, invalid comparisons like the above would be blocked from emitting.
>>
>> Tests were run with no regressions found. Okay for trunk?
>>
>> Thanks,
>> Chung-Lin
>>
>> 2011-01-12  Chung-Lin Tang  
>>
>> * config/arm/arm.h (enum arm_cond_code): Add ARM_COND_INVALID.
>> * config/arm/arm.c (arm_comparison_to_cond_code): Renamed from
>> get_arm_condition_code(), change gcc_unreachable()s to return
>> ARM_COND_INVALID.
>> (get_arm_condition_code): Implement by calling
>> arm_comparison_to_cond_code(), with result test by gcc_assert().
>> (arm_valid_comparison_p): New function to test for valid ARM
>> comparison RTX.
>> * config/arm/arm-protos.h (arm_valid_comparison_p): Add
>>  prototype.
>> * config/arm/predicates.md (arm_comparison_operator): Add
>>  additional check based on arm_valid_comparison_p().
>>
>> testsuite/
>> * gcc.target/arm/20110112-1.c: New test.
>>
>>
>>
> 



Ping Re: [PATCH, ARM] Fix PR44557, Thumb-1 ICE

2011-03-07 Thread Chung-Lin Tang
Ping.

On 2011/1/26 11:07 AM, Chung-Lin Tang wrote:
> On 2011/1/1 19:21, Chung-Lin Tang wrote:
>> On 2010/12/21 02:03, Richard Earnshaw wrote:
>>>
>>> On Thu, 2010-12-09 at 14:08 +0800, Chung-Lin Tang wrote:
 Hi,
 this patch fixes the ICE in PR44557. It now occurs on trunk only under 
 quite specific option conditions, but debugging this PR leaded to quite 
 obvious Thumb-1 fixes.

 Also added a simplified testcase, derived from the one on bugzilla. 
 Tested without regressions, okay to commit to trunk?

 Thanks,
 Chung-Lin

 2010-12-09  Chung-Lin Tang  

PR target/44557
* config/arm/arm.h (PREFERRED_RELOAD_CLASS): Add CORE_REGS to
Thumb-1 return LO_REGS case.
* config/arm/arm.md (reload_inhi): Change scratch constraint
from 'r' to 'l'.

testsuite/
* gcc.target/arm/pr44557.c: New.

>>>
>>> Changing the scratch constraint to 'l' is going to pessimize thumb2 code
>>> reload generation which can quite reasonably take an 'r' class here.  
>>>
>>> I'm not sure there's an easy way to fix this without going the whole hog
>>> and getting rid of reload_inhi entirely (which would be a good thing,
>>> TM) and replacing it with the new reload infrastructure that Joern wrote
>>> a few years back.
>>>
>>> Before approving this I want to be sure that it doesn't cause major
>>> problems on Thumb-2.  What testing have you done for that configuration?
>>>
>>> R.
>>>
>>> PS: Maybe another way to fix this would be to introduce a new register
>>> class that expands to GENERAL_REGS on 32-bit cores and LO_REGS on
>>> Thumb-1 only.
>>>
>>
>> Hi Richard,
>>
>> My testing was for Thumb-1 (-march=armv5te -mthumb), as that was what
>> the ICE was about. I later tried another test run with Thumb-2 as you
>> suggested, to be sure, and saw no regressions too.
>>
>> I've then been looking into the secondary reload logic. The ARM
>> backend's SECONDARY_INPUT/OUTPUT_RELOAD_CLASS macros already returns
>> NO_REGS under TARGET_32BIT for integer modes (no secondary reloads
>> needed). Looking at the default_secondary_reload() function, this means
>> that the reload_in/outhi patterns are never used for Thumb-2.
>>
>> So this patch should only affect Thumb-1, and the Thumb-2 considerations
>> should be unneeded.
> 
> Hi Richard, pinging this patch.
> I think I've explained the effects of this fix, and it should be Thumb-1
> only. Is this patch okay?
> 
> Thanks,
> Chung-Lin



[MIPS] Hookize PREFERRED_RELOAD_CLASS

2011-03-07 Thread Anatoly Sokolov
  Hi.

  This patch removes obsolete PREFERRED_RELOAD_CLASS macro from the MIPS back 
end in the GCC and introduces equivalent TARGET_PREFERRED_RELOAD_CLASS target 
hook.

  Bootstrapped and regression tested on mips64el-unknown-linux-gnu.

* config/mips/mips.h (PREFERRED_RELOAD_CLASS): Remove macro.
* config/mips/mips-protos.h (mips_preferred_reload_class): Remove.
* config/mips/mips.c (mips_preferred_reload_class): Make static.
Change 'rclass' argument and result type to reg_class_t.
(TARGET_PREFERRED_RELOAD_CLASS): Define.

Index: gcc/config/mips/mips-protos.h
===
--- gcc/config/mips/mips-protos.h   (revision 170216)
+++ gcc/config/mips/mips-protos.h   (working copy)
@@ -283,7 +283,6 @@
   enum machine_mode, enum reg_class);
 extern bool mips_dangerous_for_la25_p (rtx);
 extern bool mips_modes_tieable_p (enum machine_mode, enum machine_mode);
-extern enum reg_class mips_preferred_reload_class (rtx, enum reg_class);
 extern enum reg_class mips_secondary_reload_class (enum reg_class,
   enum machine_mode,
   rtx, bool);
Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  (revision 170216)
+++ gcc/config/mips/mips.c  (working copy)
@@ -10804,10 +10804,10 @@
  && !mips_mode_ok_for_mov_fmt_p (mode2)));
 }
 
-/* Implement PREFERRED_RELOAD_CLASS.  */
+/* Implement TARGET_PREFERRED_RELOAD_CLASS.  */
 
-enum reg_class
-mips_preferred_reload_class (rtx x, enum reg_class rclass)
+static reg_class_t
+mips_preferred_reload_class (rtx x, reg_class_t rclass)
 {
   if (mips_dangerous_for_la25_p (x) && reg_class_subset_p (LEA_REGS, rclass))
 return LEA_REGS;
@@ -16487,6 +16487,9 @@
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG mips_reorg
 
+#undef  TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS mips_preferred_reload_class
+
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START mips_file_start
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
Index: gcc/config/mips/mips.h
===
--- gcc/config/mips/mips.h  (revision 170216)
+++ gcc/config/mips/mips.h  (working copy)
@@ -2028,9 +2028,6 @@
 #define SMALL_INT_UNSIGNED(X) SMALL_OPERAND_UNSIGNED (INTVAL (X))
 #define LUI_INT(X) LUI_OPERAND (INTVAL (X))
 
-#define PREFERRED_RELOAD_CLASS(X,CLASS)
\
-  mips_preferred_reload_class (X, CLASS)
-
 /* The HI and LO registers can only be reloaded via the general
registers.  Condition code registers can only be loaded to the
general registers, and from the floating point registers.  */


Anatoly.



Re: [PATCH] PR45413 - require nonpic target

2011-03-07 Thread Dominique Dhumieres
Would it be possible to have this patch commited before 4.6 is
released?

TIA

Dominique


Re: [PATCH 4/4] Updating MELT ChangeLog

2011-03-07 Thread Basile Starynkevitch
On Mon,  7 Mar 2011 12:35:24 +0100
Alexandre Lissy  wrote:

> ---
>  ChangeLog.MELT |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/ChangeLog.MELT b/ChangeLog.MELT
> index b18e8ff..0e52116 100644
> --- a/ChangeLog.MELT
> +++ b/ChangeLog.MELT
> @@ -1,3 +1,7 @@
> +2011-03-07 Alexandre Lissy 
> +
> + * Fixing issues in compilation process for RPM packaging
> + * Regenerating melt-build.mk


Thanks. The ChangeLog entries above are slightly incorrect (they should mention 
files and when appropriate, functions). I improved them as


2011-03-07  Alexandre Lissy  

* melt-build.tpl: Fix issues in compilation process for RPM
packaging on GCCMELT_MODULE_WORKSPACE.

* Makefile.in (MELTHERE_CC1_CFLAGS, mekt_make_cc1flags): Ditto.

* melt-build.mk: Regenerate.


And so I committed revision 170736 of the MELT branch.

Regards.

-- 
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basilestarynkevitchnet mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


Re: [4.7][google] Use sysroot from --with-build-sysroot during 'make check' (issue4248059)

2011-03-07 Thread Diego Novillo
On Fri, Mar 4, 2011 at 20:07, Mike Stump  wrote:

>> -     @echo "set GCC_UNDER_TEST \"$(GCC_FOR_TARGET)\"" >> ./tmp0
>
> ?  What's this?  GCC_UNDER_TEST is kinda important to testing.  I feel like 
> I'm missing something trivial.

This is an artifact of the branch.  We used to force GCC_UNDER_TEST,
but we don't need to anymore.  It will become clear when I send the
patch against trunk.  I'm testing it now.  I will send it as soon as I
finish testing all the variants.

>
>> +     @echo "set TEST_SYSROOT \"$(SYSROOT_CFLAGS_FOR_TARGET)\"" >> ./tmp0
>
>> +    if [info exists TEST_SYSROOT] {
>> +     lappend options "additional_flags=$TEST_SYSROOT"
>> +    }
>
> So, this will cause a certain ordering on the command line.  If there is a 
> testcase in the
> testsuite that tests that flag, this might cause the option under test to be 
> overridden
> unless the TEST_SYSROOT option comes first on the command line.  You can 
> glance
> at the .log file, and ensure that this option comes before the -O2 say, of 
> the multilib
> options in a torture suite.

Thanks.  I see that I'm emitting it fairly late in the options.  I
will move it so this is added early in the command line.


Diego.


Re: [4.7][google] Use sysroot from --with-build-sysroot during 'make check' (issue4248059)

2011-03-07 Thread Diego Novillo
On Mon, Mar 7, 2011 at 05:44, Simon Baldwin  wrote:
> On 4 March 2011 22:50, Diego Novillo  wrote:
>> ...
>> I forgot to add.  Simon, this still shows up some failures in
>> google/integration, but these failures are the same we have in trunk.
>>
>> For our builds, we have been XFAILing these failures, right?  Do you
>> want me to mark them XFAIL to avoid problems with the auto builds?
>
>
> No, it's okay to leave them failing for now.  I'll go through and
> address each individually once the overall framework is settled.

OK, thanks.


Diego.


[gomp3.1] Handle list form of OMP_NUM_THREADS

2011-03-07 Thread Jakub Jelinek
Hi!

While the standard talks about list form of nthreads-var everywhere, given
that omp_set_num_threads only affects the first element of the list,
only the first element is also used everywhere but during parallel creation
of new implicit tasks, I think this patch is equivalent to it.

Regtested on x86_64-linux, committed to gomp-3_1-branch.

2011-03-07  Jakub Jelinek  

* libgomp.h (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New
externs.
* env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New
variables.
(parse_unsigned_long_list): New function.
(initialize_env): Use it for OMP_NUM_THREADS.
* team.c (gomp_team_start): Override new task's nthreads_var icv
if list form OMP_NUM_THREADS has been used and it has value for
the new nesting level.

--- libgomp/libgomp.h.jj2011-02-24 14:11:10.0 +0100
+++ libgomp/libgomp.h   2011-03-07 15:57:44.0 +0100
@@ -226,6 +226,7 @@ extern gomp_mutex_t gomp_remaining_threa
 extern unsigned long gomp_max_active_levels_var;
 extern unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
 extern unsigned long gomp_available_cpus, gomp_managed_threads;
+extern unsigned long *gomp_nthreads_var_list, gomp_nthreads_var_list_len;
 
 enum gomp_task_kind
 {
--- libgomp/env.c.jj2011-02-24 14:11:10.0 +0100
+++ libgomp/env.c   2011-03-07 16:14:03.0 +0100
@@ -67,6 +67,7 @@ gomp_mutex_t gomp_remaining_threads_lock
 #endif
 unsigned long gomp_available_cpus = 1, gomp_managed_threads = 1;
 unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
+unsigned long *gomp_nthreads_var_list, gomp_nthreads_var_list_len;
 
 /* Parse the OMP_SCHEDULE environment variable.  */
 
@@ -178,6 +179,95 @@ parse_unsigned_long (const char *name, u
   return false;
 }
 
+/* Parse an unsigned long list environment variable.  Return true if one was
+   present and it was successfully parsed.  */
+
+static bool
+parse_unsigned_long_list (const char *name, unsigned long *p1stvalue,
+ unsigned long **pvalues,
+ unsigned long *pnvalues)
+{
+  char *env, *end;
+  unsigned long value, *values = NULL;
+
+  env = getenv (name);
+  if (env == NULL)
+return false;
+
+  while (isspace ((unsigned char) *env))
+++env;
+  if (*env == '\0')
+goto invalid;
+
+  errno = 0;
+  value = strtoul (env, &end, 10);
+  if (errno || (long) value <= 0)
+goto invalid;
+
+  while (isspace ((unsigned char) *end))
+++end;
+  if (*end != '\0')
+{
+  if (*end == ',')
+   {
+ unsigned long nvalues = 0, nalloced = 0;
+
+ do
+   {
+ env = end + 1;
+ if (nvalues == nalloced)
+   {
+ unsigned long *n;
+ nalloced = nalloced ? nalloced * 2 : 16;
+ n = realloc (values, nalloced * sizeof (unsigned long));
+ if (n == NULL)
+   {
+ free (values);
+ gomp_error ("Out of memory while trying to parse"
+ " environment variable %s", name);
+ return false;
+   }
+ values = n;
+ if (nvalues == 0)
+   values[nvalues++] = value;
+   }
+
+ while (isspace ((unsigned char) *env))
+   ++env;
+ if (*env == '\0')
+   goto invalid;
+
+ errno = 0;
+ value = strtoul (env, &end, 10);
+ if (errno || (long) value <= 0)
+   goto invalid;
+
+ values[nvalues++] = value;
+ while (isspace ((unsigned char) *end))
+   ++end;
+ if (*end == '\0')
+   break;
+ if (*end != ',')
+   goto invalid;
+   }
+ while (1);
+ *p1stvalue = values[0];
+ *pvalues = values;
+ *pnvalues = nvalues;
+ return true;
+   }
+  goto invalid;
+}
+
+  *p1stvalue = value;
+  return true;
+
+ invalid:
+  free (values);
+  gomp_error ("Invalid value for environment variable %s", name);
+  return false;
+}
+
 /* Parse the OMP_STACKSIZE environment varible.  Return true if one was
present and it was successfully parsed.  */
 
@@ -492,8 +582,10 @@ initialize_env (void)
 #endif
   gomp_init_num_threads ();
   gomp_available_cpus = gomp_global_icv.nthreads_var;
-  if (!parse_unsigned_long ("OMP_NUM_THREADS", &gomp_global_icv.nthreads_var,
-   false))
+  if (!parse_unsigned_long_list ("OMP_NUM_THREADS",
+&gomp_global_icv.nthreads_var,
+&gomp_nthreads_var_list,
+&gomp_nthreads_var_list_len))
 gomp_global_icv.nthreads_var = gomp_available_cpus;
   if (parse_affinity ())
 gomp_init_affinity ();
--- libgomp/team.c

Re: [PATCH] fix PR 47786, DECL_CHAIN fallout with -flto

2011-03-07 Thread Nathan Froyd
On Wed, Feb 23, 2011 at 11:14:08AM -0800, Nathan Froyd wrote:
> The patch below fixes PR 47786, a bit of DECL_CHAIN fallout.  The patch
> is trivial, even obvious, since it replaces the custom loop with
> list_length.
> 
> The only problem is adding a testcase.  I can't add the existing
> testcase from the PR to gcc.dg/lto/ because the bug isn't triggered when
> compiling the files separately; the bug is only triggered when both
> source files are specified on the command line to cc1 (*not* to
> [x]gcc).  AFAIK, there's no infrastructure for doing something like that
> in the current testsuite.

In the absence of comments and inspiration about what to do, I've
committed this patch sans testcase.

-Nathan


Re: [PATCH] PR 47862: Fix caller-save vector spill on PowerPC

2011-03-07 Thread David Edelsohn
On Fri, Mar 4, 2011 at 1:06 PM, Pat Haugen  wrote:
> Fix subject PR by defining HARD_REGNO_CALLER_SAVE_MODE to return V2DFmode
> for vectors in FP regs.
>
> Bootstrap/regtest on powerpc with no new failures. Ok for trunk and 4.5
> (after successful 4.5 bootstrap/regtest)?
>
> -Pat
>
>
> 2011-03-04  Pat Haugen 
>
>        * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Define.
>        * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Undefine
>         before definition.
>
> testsuite/ChangeLog
>        * testsuite/gcc.target/powerpc/pr47862.c: New.

This patch is okay.

As I mentioned on IRC, I am a little concerned that the macro returns
V2DFmode instead of V2DImode (normal FPRs use DImode, not DFmode), but
no one seems to be aware of any problems that will cause.

Thanks, David


[committed] Fix profiledbootstrap on x86_64-linux (PR bootstrap/48000)

2011-03-07 Thread Jakub Jelinek
Hi!

I've bootstrapped/regtested and profiledbootstrapped/regtested
the following patch from Zdenek on x86_64-linux and i686-linux
and with richi's approval from IRC committed to trunk.

2011-03-07  Zdenek Dvorak  

PR bootstrap/48000
* cfgloopmanip.c (fix_bb_placements): Return immediately
if FROM is BASE_LOOP's header.

--- gcc/cfgloopmanip.c  (revision 170739)
+++ gcc/cfgloopmanip.c  (working copy)
@@ -185,7 +185,11 @@ fix_bb_placements (basic_block from,
  fix_loop_placement.  */
 
   base_loop = from->loop_father;
-  if (base_loop == current_loops->tree_root)
+  /* If we are already in the outermost loop, the basic blocks cannot be moved
+ outside of it.  If FROM is the header of the base loop, it cannot be moved
+ outside of it, either.  In both cases, we can end now.  */
+  if (base_loop == current_loops->tree_root
+  || from == base_loop->header)
 return;
 
   in_queue = sbitmap_alloc (last_basic_block);

Jakub


[GOMP 3.1] Update gcc/fortran/{gfortran,intrinsic}.texi for OpenMP 3.1

2011-03-07 Thread Tobias Burnus
The attached patch removes the deleted constants omp_integer_kind and 
omp_logical_kind from the manual and updates the references to the 
OpenMP 3.1 spec.


Committed to the gomp-3_1-branch as Rev. 170742.

Tobias
2011-03-07  Tobias Burnus  

	* gfortran.texi (OpenMP): Update ref to OpenMP 3.1.
	* intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1;
	remove deleted omp_integer_kind and omp_logical_kind constants.

Index: gcc/fortran/gfortran.texi
===
--- gcc/fortran/gfortran.texi	(Revision 170739)
+++ gcc/fortran/gfortran.texi	(Arbeitskopie)
@@ -530,7 +530,7 @@
 @ref{Fortran 2008 status} sections of the documentation.
 
 Additionally, the GNU Fortran compilers supports the OpenMP specification
-(version 3.0, @url{http://openmp.org/@/wp/@/openmp-specifications/}).
+(version 3.1, @url{http://openmp.org/@/wp/@/openmp-specifications/}).
 
 @node Varying Length Character Strings
 @subsection Varying Length Character Strings
@@ -1752,8 +1752,8 @@
 and environment variables that influence run-time behavior.
 
 GNU Fortran strives to be compatible to the 
-@uref{http://www.openmp.org/mp-documents/spec30.pdf,
-OpenMP Application Program Interface v3.0}.
+@uref{http://www.openmp.org/mp-documents/spec31.pdf,
+OpenMP Application Program Interface v3.1}.
 
 To enable the processing of the OpenMP directive @code{!$omp} in
 free-form source code; the @code{c$omp}, @code{*$omp} and @code{!$omp}
Index: gcc/fortran/intrinsic.texi
===
--- gcc/fortran/intrinsic.texi	(Revision 170739)
+++ gcc/fortran/intrinsic.texi	(Arbeitskopie)
@@ -12908,7 +12908,7 @@
 @section OpenMP Modules @code{OMP_LIB} and @code{OMP_LIB_KINDS}
 @table @asis
 @item @emph{Standard}:
-OpenMP Application Program Interface v3.0
+OpenMP Application Program Interface v3.1
 @end table
 
 
@@ -12921,15 +12921,13 @@
 below.
 
 For details refer to the actual
-@uref{http://www.openmp.org/mp-documents/spec30.pdf,
-OpenMP Application Program Interface v3.0}.
+@uref{http://www.openmp.org/mp-documents/spec31.pdf,
+OpenMP Application Program Interface v3.1}.
 
 @code{OMP_LIB_KINDS} provides the following scalar default-integer
 named constants:
 
 @table @asis
-@item @code{omp_integer_kind}
-@item @code{omp_logical_kind}
 @item @code{omp_lock_kind}
 @item @code{omp_nest_lock_kind}
 @item @code{omp_sched_kind}


Re: [STORMY16] Hookize PRINT_OPERAND and TARGET_PRINT_OPERAND_ADDRESS

2011-03-07 Thread Nick Clifton

Hi Anatoly,


 * config/stormy16/stormy16.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS):
 Remove.
 * config/stormy16/stormy16-protos.h (xstormy16_print_operand,
 xstormy16_print_operand_address): Remove.
 * config/stormy16/stormy16.c (xstormy16_print_operand,
 xstormy16_print_operand_address): Make static.
 (TARGET_PRINT_OPERAND, TARGET_PRINT_OPERAND_ADDRESS): Define.


Approved - please apply.

Cheers
  Nick


Re: [PATCH] Teach var-tracking about some targets setmem/movmem patterns (PR debug/47991)

2011-03-07 Thread Alexandre Oliva
On Mar  4, 2011, Jakub Jelinek  wrote:

>   PR debug/47991
>   * var-tracking.c (find_use_val): Return NULL for
>   cui-> sets && cui->store_p BLKmode MEMs.

>   * gcc.dg/pr47991.c: New test.

This looks good to me, but I can't approve it.

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [PATCH] PR45413 - require nonpic target

2011-03-07 Thread Mike Stump
On Mar 7, 2011, at 6:41 AM, Dominique Dhumieres wrote:
> Would it be possible to have this patch commited before 4.6 is
> released?

I checked it in.  Give it a try, and if it doesn't work as expected ,let me 
know asap.  :-)


RE: [PING^2] [PR46003, C++] Fix the assertion failure in build_target_expr

2011-03-07 Thread Yufeng Zhang
> On 03/03/2011 11:39 PM, Jason Merrill wrote: 
> I think rather that the problem is in build_conditional_expr; it
> should have a template case that just determines the appropriate
> type and then builds up a COND_EXPR with that type from the
> unconverted operands, like we do for calls in finish_call_expr.

Thanks for the suggestion. I spent some more time looking into the
related code. If I understand it correctly, I think this is just what
build_x_conditional_expr in ./cp/typeck.c does:

If the conditional expression is type-dependent in the template, it
builds and returns a COND_EXPR without TREE_TYPE.

If the conditional expression is not type-dependent, it calls
build_conditional_expr to determine its TREE_TYPE and then builds up
a COND_EXPR with the unconverted/original operands.

Different from CALL_EXPR, the TREE_TYPE of a COND_EXPR is determined
by the TREE_TYPEs of its latter two operands. When the types of the
two operands are different, a conversion is attempted on each operand
type to match the type of the other operand; while for a CALL_EXPR,
its TREE_TYPE is independent from the TREE_TYPE(s) of its arg(s).

So I think it is necessary for build_conditional_expr to call
convert_like_real to do the conversions. The parser should try its best
to determine the type and check for any semantic error for expressions
in a template declaration, especially for non-dependent expressions.

I still feel the proposed patch in
  http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00076.html
makes sense. But if you think anything is not appropriate or have any
more question, please do let me know.


Regards,
Yufeng





[PATCH] Don't warn with -Wstrict-overflow about X + C1 == C2 transformations (PR tree-optimization/48022)

2011-03-07 Thread Jakub Jelinek
Hi!

EQ/NE comparisons don't really assume that overflow doesn't happen unlike
>/>=/etc., so it is strange that we warn about it.
As the warning happens on simple strcmp uses when using glibc string.h,
it is extra annoying.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2011-03-07  Jakub Jelinek  

PR tree-optimization/48022
* fold-const.c (fold_comparison): Don't call fold_overflow_warning
for EQ/NE_EXPR.

* gcc.dg/pr48022-1.c: New test.
* gcc.dg/pr48022-2.c: New test.

--- gcc/fold-const.c.jj 2011-03-03 09:11:43.0 +0100
+++ gcc/fold-const.c2011-03-07 17:44:02.0 +0100
@@ -8572,10 +8572,11 @@ fold_comparison (location_t loc, enum tr
  && (TREE_CODE (lhs) != INTEGER_CST
  || !TREE_OVERFLOW (lhs)))
{
- fold_overflow_warning ("assuming signed overflow does not occur "
- "when changing X +- C1 cmp C2 to "
- "X cmp C1 +- C2",
-WARN_STRICT_OVERFLOW_COMPARISON);
+ if (code != EQ_EXPR && code != NE_EXPR)
+   fold_overflow_warning ("assuming signed overflow does not occur "
+  "when changing X +- C1 cmp C2 to "
+  "X cmp C1 +- C2",
+  WARN_STRICT_OVERFLOW_COMPARISON);
  return fold_build2_loc (loc, code, type, variable, lhs);
}
 }
--- gcc/testsuite/gcc.dg/pr48022-1.c.jj 2011-03-07 17:46:55.0 +0100
+++ gcc/testsuite/gcc.dg/pr48022-1.c2011-03-07 17:47:18.0 +0100
@@ -0,0 +1,14 @@
+/* PR tree-optimization/48022 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-overflow" } */
+
+int
+foo (const char *x)
+{
+  unsigned long l = 1;
+  const unsigned char *s = (const unsigned char *) (const char *) (x);
+  int r = s[0] - ((const unsigned char *) (const char *) ("/"))[0];
+  if (l > 0 && r == 0)
+r = (s[1] - ((const unsigned char *) (const char *) ("/"))[1]);
+  return r;
+}
--- gcc/testsuite/gcc.dg/pr48022-2.c.jj 2011-03-07 17:47:26.0 +0100
+++ gcc/testsuite/gcc.dg/pr48022-2.c2011-03-07 17:47:45.0 +0100
@@ -0,0 +1,11 @@
+/* PR tree-optimization/48022 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-overflow" } */
+
+#include 
+
+int
+foo (const char *x)
+{
+  return strcmp (x, "/");
+}

Jakub


Re: [patch testsuite g++.dg]: Adjust tree-ssa/pr21082 testcase for LLP64

2011-03-07 Thread Kai Tietz
PING

2011/2/23 Kai Tietz :
> Hi,
>
> ChangeLog
>
> 2011-02-23  Kai Tietz
>
>        * g++.dg/tree-ssa/pr21082.C: Use __INTPTR_TYPE__ instead of 'long' 
> type.
>
> Ok for apply?
>
> Regards,
> Kai
>



-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination


Re: avoid useless if-before-free tests

2011-03-07 Thread Dr Andrew John Hughes
On 19:16 Sat 05 Mar , Joseph S. Myers wrote:
> On Sat, 5 Mar 2011, Jim Meyering wrote:
> 
> > diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
> > index 7a7e840..8993fc7 100644
> > --- a/gcc/config/i386/gmm_malloc.h
> > +++ b/gcc/config/i386/gmm_malloc.h
> > @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
> >  static __inline__ void
> >  _mm_free (void * aligned_ptr)
> >  {
> > -  if (aligned_ptr)
> > -free (((void **) aligned_ptr) [-1]);
> > +  free (((void **) aligned_ptr) [-1]);
> >  }
> 
> This one looks suspicious; it's not if (p) free (p); but if (p) free 
> (something-derived-from-p);.
> 
> > diff --git a/libjava/classpath/native/fdlibm/dtoa.c 
> > b/libjava/classpath/native/fdlibm/dtoa.c
> > index 458e629..92aa793 100644
> 
> http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
> via Classpath upstream, not directly into GCC.  I don't know if that's 
> still accurate.
> 

That's still true.  This seems to be the first message I've received in this
thread, so I'm not even aware of what these changes are.  Were the earlier
messages not sent to this list?

> > diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
> > index 9ad4766..644ef1b 100644
> 
> We definitely don't want to make local changes to zlib for this sort of 
> issue, though importing a new upstream version of zlib (making sure the 
> local configure code still works) should be fine for 4.7.
> 
> -- 
> Joseph S. Myers
> jos...@codesourcery.com

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37


Re: PR 47793 - Support relative paths using -fprofile-generate

2011-03-07 Thread Diego Novillo
On Tue, Mar 1, 2011 at 17:07, Martin Thuresson  wrote:
> Ping.
>
> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson  wrote:
>> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson  
>> wrote:
>>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>>> part of this change, relative paths stopped working.
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>>
>>> This patch adds a guard so that "/" is not added when no prefix is
>>> given.
>>>
>>> The added testcase uses the path "../gcc/". This puts the gcda in the
>>> same directory, so that the cleanup-coverage-files will find them.
>>>
>>> I have tested the patch using "make bootstrap; make -k check" with
>>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>>
>>> Let me know if there is any other testing I should do.
>>
>> ChangeLog
>> gcc/
>>
>> 2011-02-23  Martin Thuresson  
>>
>>        PR gcov-profile/47793
>>        * libgcov.c (gcov_exit): Support relative profile paths.
>>
>> gcc/testsuite/
>>
>> 2011-02-23  Martin Thuresson  
>>
>>        PR gcov-profile/47793
>>        * gcc.dg/pr47793.c: New.

Martin,

Let's put it in google/main while the review is underway.  Is this a
regression vs 4.5 or 4.4?  If so, it may be suitable for trunk (or the
future release branch), but you will need an explicit approval from
the release managers (CC'd).  If it's a new bug, then this should go
in trunk after we re-enter stage 1.


Diego.


C++ PATCH for c++/48008 (mangling clash with -fabi-version=5)

2011-03-07 Thread Jason Merrill
My patch from last July to avoid mangling attribute const/volatile as 
qualifiers on the type had the unfortunate effect of also omitting 
const/volatile function-cv-quals on plain function types, which can 
occur as template arguments.  This patch fixes that by stripping the 
attribute-derived qualifiers on pointer/reference-to-function types, 
where the function-cv-quals cannot occur.


Tested x86_64-pc-linux-gnu, applied to trunk.
commit 5f2add86f317fdc58ca590401baf873908043672
Author: Jason Merrill 
Date:   Mon Mar 7 13:03:12 2011 -0500

PR c++/48008
* mangle.c (write_type): Strip cv-quals from FUNCTION_TYPE here.
(write_CV_qualifiers_for_type): Not here.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 0297a2a..c46ba30 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1880,16 +1880,25 @@ write_type (tree type)
  break;
 
case POINTER_TYPE:
- write_char ('P');
- write_type (TREE_TYPE (type));
- break;
-
case REFERENCE_TYPE:
- if (TYPE_REF_IS_RVALUE (type))
-   write_char('O');
+ if (TREE_CODE (type) == POINTER_TYPE)
+   write_char ('P');
+ else if (TYPE_REF_IS_RVALUE (type))
+   write_char ('O');
   else
 write_char ('R');
- write_type (TREE_TYPE (type));
+ {
+   tree target = TREE_TYPE (type);
+   /* Attribute const/noreturn are not reflected in mangling.
+  We strip them here rather than at a lower level because
+  a typedef or template argument can have function type
+  with function-cv-quals (that use the same representation),
+  but you can't have a pointer/reference to such a type.  */
+   if (abi_version_at_least (5)
+   && TREE_CODE (target) == FUNCTION_TYPE)
+ target = build_qualified_type (target, TYPE_UNQUALIFIED);
+   write_type (target);
+ }
  break;
 
case TEMPLATE_TYPE_PARM:
@@ -2017,12 +2026,6 @@ write_CV_qualifiers_for_type (const tree type)
  array.  */
   cp_cv_quals quals = TYPE_QUALS (type);
 
-  /* Attribute const/noreturn are not reflected in mangling.  */
-  if (abi_version_at_least (5)
-  && (TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE))
-return 0;
-
   if (quals & TYPE_QUAL_RESTRICT)
 {
   write_char ('r');
diff --git a/gcc/testsuite/g++.dg/abi/mangle46.C 
b/gcc/testsuite/g++.dg/abi/mangle46.C
new file mode 100644
index 000..fddc88d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle46.C
@@ -0,0 +1,15 @@
+// PR c++/48008
+// { dg-options -fabi-version=5 }
+// Test that we retain function-cv-quals in template argument mangling.
+
+template 
+struct A
+{ };
+
+typedef void cfn(int) const;
+typedef void fn(int);
+
+// { dg-final { scan-assembler  "_Z1f1AIFviEE" } }
+void f(A) { }
+// { dg-final { scan-assembler  "_Z1f1AIKFviEE" } }
+void f(A) { }


[PATCH] PR c++/47957

2011-03-07 Thread Dodji Seketeli
Hello,

In the example of the patch below, the lookup of symbol 'T' yields the
template parameter instead of the typedef Base::T.  That's because
outer_binding considers the template-parameters-scope bindings from
Derived::foo even though that template doesn't have it's own
template header.  outer_binding should first consider the class-scope
bindings from Derived::foo.

The patch tightens binding_to_template_parms_of_scope_p to make it
only consider template parameters of the scope of a template which has
its own template header.

Tested on x86_64-unknown-linux-gnu against trunk.

-- 
Dodji

>From 48496aa3972649c82bc1c16c59c461102270caad Mon Sep 17 00:00:00 2001
From: Dodji Seketeli 
Date: Mon, 7 Mar 2011 16:47:17 +0100
Subject: [PATCH] PR c++/47957

gcc/cp/

* name-lookup.c (binding_to_template_parms_of_scope_p): Only
consider scopes of primary template definitions.  Adjust comments.

gcc/testsuite/

* g++.dg/lookup/template3.C: New test.
---
 gcc/cp/name-lookup.c|   11 -
 gcc/testsuite/g++.dg/lookup/template3.C |   35 +++
 2 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/lookup/template3.C

diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 4117202..18e3441 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4205,8 +4205,13 @@ qualified_lookup_using_namespace (tree name, tree scope,
 }
 
 /* Subroutine of outer_binding.
-   Returns TRUE if BINDING is a binding to a template parameter of SCOPE,
-   FALSE otherwise.  */
+
+   Returns TRUE if BINDING is a binding to a template parameter of
+   SCOPE.  In that case SCOPE is the scope of a primary template
+   parameter -- in the sense of G++, i.e, a template that has its own
+   template header.
+
+   Returns FALSE otherwise.  */
 
 static bool
 binding_to_template_parms_of_scope_p (cxx_binding *binding,
@@ -4222,6 +4227,8 @@ binding_to_template_parms_of_scope_p (cxx_binding 
*binding,
   return (scope
  && scope->this_entity
  && get_template_info (scope->this_entity)
+ && PRIMARY_TEMPLATE_P (TI_TEMPLATE
+(get_template_info (scope->this_entity)))
  && parameter_of_template_p (binding_value,
  TI_TEMPLATE (get_template_info \
(scope->this_entity;
diff --git a/gcc/testsuite/g++.dg/lookup/template3.C 
b/gcc/testsuite/g++.dg/lookup/template3.C
new file mode 100644
index 000..e5f6f18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/template3.C
@@ -0,0 +1,35 @@
+// Origin PR c++/47957
+// { dg-do compile }
+
+struct S
+{
+  int m;
+
+  S()
+: m(0)
+  {
+  }
+};
+
+struct Base
+{
+  typedef S T;
+};
+
+template
+struct Derived : public Base
+{
+  int
+  foo()
+  {
+T a; // This is Base::T, not the template parameter.
+return a.m;
+  }
+};
+
+int
+main()
+{
+  Derived d;
+  return d.foo();
+}
-- 
1.7.3.4



Go patch committed: Handle predeclared names as field names in literals

2011-03-07 Thread Ian Lance Taylor
This patch to the Go frontend fixes the case where a struct composite
literal uses a field name which happens to be a predeclared name.  The
problem was that predeclared names aren't packed as hidden names,
because the package name is not known when they are declared.  The field
names in structs are, however, packed when appropriate.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

diff -r 6b5a5e74bfb4 go/expressions.cc
--- a/go/expressions.cc	Wed Mar 02 22:49:50 2011 -0800
+++ b/go/expressions.cc	Mon Mar 07 13:18:54 2011 -0800
@@ -936,14 +936,6 @@
   return this;
 }
 
-// Return the name of the variable.
-
-const std::string&
-Var_expression::name() const
-{
-  return this->variable_->name();
-}
-
 // Return the type of a reference to a variable.
 
 Type*
@@ -1125,14 +1117,6 @@
 // a function seems like it could work, though there might be little
 // point to it.
 
-// Return the name of the function.
-
-const std::string&
-Func_expression::name() const
-{
-  return this->function_->name();
-}
-
 // Traversal.
 
 int
@@ -2359,10 +2343,6 @@
   named_object()
   { return this->constant_; }
 
-  const std::string&
-  name() const
-  { return this->constant_->name(); }
-
   // Check that the initializer does not refer to the constant itself.
   void
   check_for_init_loop();
@@ -11645,7 +11625,7 @@
 
  private:
   Expression*
-  lower_struct(Type*);
+  lower_struct(Gogo*, Type*);
 
   Expression*
   lower_array(Type*);
@@ -11706,7 +11686,7 @@
   if (type->is_error_type())
 return Expression::make_error(this->location());
   else if (type->struct_type() != NULL)
-return this->lower_struct(type);
+return this->lower_struct(gogo, type);
   else if (type->array_type() != NULL)
 return this->lower_array(type);
   else if (type->map_type() != NULL)
@@ -11723,7 +11703,7 @@
 // Lower a struct composite literal.
 
 Expression*
-Composite_literal_expression::lower_struct(Type* type)
+Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
 {
   source_location location = this->location();
   Struct_type* st = type->struct_type();
@@ -11751,6 +11731,7 @@
 
   bool bad_key = false;
   std::string name;
+  const Named_object* no = NULL;
   switch (name_expr->classification())
 	{
 	case EXPRESSION_UNKNOWN_REFERENCE:
@@ -11758,7 +11739,7 @@
 	  break;
 
 	case EXPRESSION_CONST_REFERENCE:
-	  name = static_cast(name_expr)->name();
+	  no = static_cast(name_expr)->named_object();
 	  break;
 
 	case EXPRESSION_TYPE:
@@ -11768,16 +11749,16 @@
 	if (nt == NULL)
 	  bad_key = true;
 	else
-	  name = nt->name();
+	  no = nt->named_object();
 	  }
 	  break;
 
 	case EXPRESSION_VAR_REFERENCE:
-	  name = name_expr->var_expression()->name();
+	  no = name_expr->var_expression()->named_object();
 	  break;
 
 	case EXPRESSION_FUNC_REFERENCE:
-	  name = name_expr->func_expression()->name();
+	  no = name_expr->func_expression()->named_object();
 	  break;
 
 	case EXPRESSION_UNARY:
@@ -11825,6 +11806,23 @@
 	  return Expression::make_error(location);
 	}
 
+  if (no != NULL)
+	{
+	  name = no->name();
+
+	  // A predefined name won't be packed.  If it starts with a
+	  // lower case letter we need to check for that case, because
+	  // the field name will be packed.
+	  if (!Gogo::is_hidden_name(name)
+	  && name[0] >= 'a'
+	  && name[0] <= 'z')
+	{
+	  Named_object* gno = gogo->lookup_global(name.c_str());
+	  if (gno == no)
+		name = gogo->pack_hidden_name(name, false);
+	}
+	}
+
   unsigned int index;
   const Struct_field* sf = st->find_local_field(name, &index);
   if (sf == NULL)
diff -r 6b5a5e74bfb4 go/expressions.h
--- a/go/expressions.h	Wed Mar 02 22:49:50 2011 -0800
+++ b/go/expressions.h	Mon Mar 07 13:18:54 2011 -0800
@@ -903,10 +903,6 @@
   named_object() const
   { return this->variable_; }
 
-  // Return the name of the variable.
-  const std::string&
-  name() const;
-
  protected:
   Expression*
   do_lower(Gogo*, Named_object*, int);
@@ -1314,10 +1310,6 @@
   named_object() const
   { return this->function_; }
 
-  // Return the name of the function.
-  const std::string&
-  name() const;
-
   // Return the closure for this function.  This will return NULL if
   // the function has no closure, which is the normal case.
   Expression*


Go patch committed: Fix import _ used twice in one package

2011-03-07 Thread Ian Lance Taylor
This patch to the Go frontend fixes the case where a package is imported
twice, by two different source files, and the second import uses _ as
the local name.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r f3dfe292768b go/gogo.cc
--- a/go/gogo.cc	Mon Mar 07 13:19:55 2011 -0800
+++ b/go/gogo.cc	Mon Mar 07 13:26:17 2011 -0800
@@ -308,12 +308,7 @@
 	  ln = package->name();
 	  is_ln_exported = Lex::is_exported_name(ln);
 	}
-  if (ln != ".")
-	{
-	  ln = this->pack_hidden_name(ln, is_ln_exported);
-	  this->package_->bindings()->add_package(ln, package);
-	}
-  else
+  if (ln == ".")
 	{
 	  Bindings* bindings = package->bindings();
 	  for (Bindings::const_declarations_iterator p =
@@ -322,6 +317,13 @@
 	   ++p)
 	this->add_named_object(p->second);
 	}
+  else if (ln == "_")
+	package->set_uses_sink_alias();
+  else
+	{
+	  ln = this->pack_hidden_name(ln, is_ln_exported);
+	  this->package_->bindings()->add_package(ln, package);
+	}
   return;
 }
 


Go patch committed: Support multiple init functions in a single file

2011-03-07 Thread Ian Lance Taylor
This patch to the Go frontend fixes the case of having multiple init
functions in a single file.  The earlier code, removed in this patch,
handled multiple init functions in a single package, but not in a single
file.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r eb5c54efea28 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Mon Mar 07 13:29:00 2011 -0800
+++ b/go/gogo-tree.cc	Mon Mar 07 13:32:16 2011 -0800
@@ -839,19 +839,6 @@
   // types.
   decl_name = Gogo::unpack_hidden_name(this->name_);
 }
-  else if (this->is_function()
-	   && !this->func_value()->is_method()
-	   && this->package_ == NULL
-	   && Gogo::unpack_hidden_name(this->name_) == "init")
-{
-  // A single package can have multiple "init" functions, which
-  // means that we need to give them different names.
-  static int init_index;
-  char buf[20];
-  snprintf(buf, sizeof buf, "%d", init_index);
-  ++init_index;
-  decl_name = gogo->package_name() + ".init." + buf;
-}
   else
 {
   std::string package_name;
diff -r eb5c54efea28 go/gogo.cc
--- a/go/gogo.cc	Mon Mar 07 13:29:00 2011 -0800
+++ b/go/gogo.cc	Mon Mar 07 13:32:16 2011 -0800
@@ -211,12 +211,6 @@
   this->globals_->add_function_declaration("imag", NULL, imag_type, loc);
 
   this->define_builtin_function_trees();
-
-  // Declare "init", to ensure that it is not defined with parameters
-  // or return values.
-  this->declare_function("init",
-			 Type::make_function_type(NULL, NULL, NULL, loc),
-			 loc);
 }
 
 // Munge name for use in an error message.
@@ -660,7 +654,24 @@
 
   const std::string* pname;
   std::string nested_name;
-  if (!name.empty())
+  bool is_init = false;
+  if (Gogo::unpack_hidden_name(name) == "init" && !type->is_method())
+{
+  if ((type->parameters() != NULL && !type->parameters()->empty())
+	  || (type->results() != NULL && !type->results()->empty()))
+	error_at(location,
+		 "func init must have no arguments and no return values");
+  // There can be multiple "init" functions, so give them each a
+  // different name.
+  static int init_count;
+  char buf[30];
+  snprintf(buf, sizeof buf, ".$init%d", init_count);
+  ++init_count;
+  nested_name = buf;
+  pname = &nested_name;
+  is_init = true;
+}
+  else if (!name.empty())
 pname = &name;
   else
 {
@@ -753,7 +764,7 @@
   of.function = ret;
   of.blocks.push_back(block);
 
-  if (!type->is_method() && Gogo::unpack_hidden_name(name) == "init")
+  if (is_init)
 {
   this->init_functions_.push_back(ret);
   this->need_init_fn_ = true;


libgcc patch committed: Accounts for all regs in __splitstack_find

2011-03-07 Thread Ian Lance Taylor
The function __splitstack_find is used by the Go garbage collector to
find all stacks used by all threads.  The goal was to find all pointers
on the stack.  Unfortunately, it turned out to miss some saved registers
in some cases, because they were saved on the split stack below the
location where the stack was restored.  That meant that if a signal
happened at just the wrong time, specifically just when signals were
unblocked, those register values would not necessarily be found on any
stack returned by __splitstack_find.  That could in turn mean that some
newly allocated memory, not yet stored anywhere, might be immediately
freed.

This patch fixes the problem by doing a target dependent adjustment of
the stack pointer to include any saved registers.

Bootstrapped and ran split-stack and Go tests on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-03-07  Ian Lance Taylor  

* generic-morestack.c (__splitstack_find): Adjust returned stack
pointer to include all registers pushed by __morestack.


Index: generic-morestack.c
===
--- generic-morestack.c	(revision 170756)
+++ generic-morestack.c	(working copy)
@@ -1,5 +1,5 @@
 /* Library support for -fsplit-stack.  */
-/* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor .
 
 This file is part of GCC.
@@ -846,20 +846,24 @@ __splitstack_find (void *segment_arg, vo
  parameters   <- old_stack
  return in f1
 	 return in f2
-	 data pushed by __morestack
+	 registers pushed by __morestack
 
- On x86, the data pushed by __morestack includes the saved value
- of the ebp/rbp register.  We want our caller to be able to see
- that value, which can not be found on any other stack.  So we
- adjust accordingly.  This may need to be tweaked for other
- targets.  */
+ The registers pushed by __morestack may not be visible on any
+ other stack, if we are being called by a signal handler
+ immediately after the call to __morestack_unblock_signals.  We
+ want to adjust our return value to include those registers.  This
+ is target dependent.  */
 
   nsp = (char *) segment->old_stack;
-#ifdef STACK_GROWS_DOWNWARD
-  nsp -= 3 * sizeof (void *);
+
+#if defined (__x86_64__)
+  nsp -= 12 * sizeof (void *);
+#elif defined (__i386__)
+  nsp -= 6 * sizeof (void *);
 #else
-  nsp += 3 * sizeof (void *);
+#error "unrecognized target"
 #endif
+
   *next_sp = (void *) nsp;
 
 #ifdef STACK_GROWS_DOWNWARD


Go patch committed: Avoid race condition shutting down thread

2011-03-07 Thread Ian Lance Taylor
I spotted a theoretical race condition when shutting down a thread.  If
a garbage collection occurs at the very end of existing the thread, the
garbage collector and the thread could collide on manipulating the heap.
This patch fixes the problem by moving the thread exiting manipulations
within the lock held over all threads.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 6d06701000fc libgo/runtime/go-go.c
--- a/libgo/runtime/go-go.c	Mon Mar 07 13:38:09 2011 -0800
+++ b/libgo/runtime/go-go.c	Mon Mar 07 13:49:35 2011 -0800
@@ -92,18 +92,15 @@
   if (list_entry->next != NULL)
 list_entry->next->prev = list_entry->prev;
 
+  /* This will look runtime_mheap as needed.  */
   runtime_MCache_ReleaseAll (mcache);
 
-  /* As soon as we release this look, a GC could run.  Since this
- thread is no longer on the list, the GC will not find our M
- structure, so it could get freed at any time.  That means that
- any code from here to thread exit must not assume that the m is
- valid.  */
-  m = NULL;
-
-  i = pthread_mutex_unlock (&__go_thread_ids_lock);
-  __go_assert (i == 0);
-
+  /* This should never deadlock--there shouldn't be any code that
+ holds the runtime_mheap lock when locking __go_thread_ids_lock.
+ We don't want to do this after releasing __go_thread_ids_lock
+ because it will mean that the garbage collector might run, and
+ the garbage collector does not try to lock runtime_mheap in all
+ cases since it knows it is running single-threaded.  */
   runtime_lock (&runtime_mheap);
   mstats.heap_alloc += mcache->local_alloc;
   mstats.heap_objects += mcache->local_objects;
@@ -111,6 +108,16 @@
   runtime_FixAlloc_Free (&runtime_mheap.cachealloc, mcache);
   runtime_unlock (&runtime_mheap);
 
+  /* As soon as we release this look, a GC could run.  Since this
+ thread is no longer on the list, the GC will not find our M
+ structure, so it could get freed at any time.  That means that
+ any code from here to thread exit must not assume that m is
+ valid.  */
+  m = NULL;
+
+  i = pthread_mutex_unlock (&__go_thread_ids_lock);
+  __go_assert (i == 0);
+
   free (list_entry);
 }
 


Re: [PATCH] Teach var-tracking about some targets setmem/movmem patterns (PR debug/47991)

2011-03-07 Thread Richard Henderson
On 03/05/2011 07:56 AM, Jakub Jelinek wrote:
>   PR debug/47991
>   * var-tracking.c (find_use_val): Return NULL for
>   cui->sets && cui->store_p BLKmode MEMs.
> 
>   * gcc.dg/pr47991.c: New test.

Ok.

> +   /* Some targets represent memset and memcpy patterns
> +  by (set (mem:BLK ...) (reg:[QHSD]I ...)) or
> +  (set (mem:BLK ...) (const_int ...)) or
> +  (set (mem:BLK ...) (mem:BLK ...)).  Don't return anything
> +  in that case, otherwise we end up with mode mismatches.  */
> +   if (mode == BLKmode && MEM_P (x))
> + return NULL;

Could you please file bug reports against the first two variants
you mention here?  These sorts of mode conflicts are bad.


r~


libgo patch committed: Permit GC on any compiler generated allocation

2011-03-07 Thread Ian Lance Taylor
Due to an oversight, libgo did not permit garbage collection to occur
on any compiler generated memory allocation.  It would only occur on
memory allocation in the runtime library, or when allocating memory
which was known to not hold pointers.  This libgo patch fixes that
oversight.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 22c4b0a38087 libgo/runtime/go-new.c
--- a/libgo/runtime/go-new.c	Mon Mar 07 13:55:47 2011 -0800
+++ b/libgo/runtime/go-new.c	Mon Mar 07 14:17:10 2011 -0800
@@ -11,7 +11,7 @@
 void *
 __go_new (size_t size)
 {
-  return __go_alloc (size);
+  return runtime_mallocgc (size, 0, 1, 1);
 }
 
 void *


Re: [libgo] Use _nuname on 32-bit Solaris 2/x86

2011-03-07 Thread Ian Lance Taylor
Rainer Orth  writes:

> The libgo os test used to fail on 32-bit Solaris 2/x86 only:
>
> --- FAIL: os_test.TestHostname
>Hostname() = "", want "fuego"
>
> Running the test under gdb, I find that syscall.Uname is entered with
> errno = 4 and left the same, even if I reset errno = ENONE on entry.
> Further investigation led to this snippet from :
>
> #if defined(__i386) && !defined(__amd64)
>
> static int
> uname(struct utsname *_buf)
> {
> return (_nuname(_buf));
> }
>
> #endif
>
> The following patch reflects this and fixes the testcase.

Thanks.

Committed.

Ian


Re: avoid useless if-before-free tests

2011-03-07 Thread Joseph S. Myers
On Mon, 7 Mar 2011, Dr Andrew John Hughes wrote:

> > http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
> > via Classpath upstream, not directly into GCC.  I don't know if that's 
> > still accurate.
> > 
> 
> That's still true.  This seems to be the first message I've received in this
> thread, so I'm not even aware of what these changes are.  Were the earlier
> messages not sent to this list?

The original patch went only to gcc-patches.

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00252.html

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: avoid useless if-before-free tests

2011-03-07 Thread Paolo Carlini
On 03/05/2011 03:05 PM, Jim Meyering wrote:
> diff --git a/libstdc++-v3/libsupc++/del_opnt.cc 
> b/libstdc++-v3/libsupc++/del_opnt.cc
> index 75051d5..29eab10 100644
> --- a/libstdc++-v3/libsupc++/del_opnt.cc
> +++ b/libstdc++-v3/libsupc++/del_opnt.cc
> @@ -31,6 +31,5 @@ extern "C" void free (void *);
>  _GLIBCXX_WEAK_DEFINITION void
>  operator delete (void *ptr, const std::nothrow_t&) throw ()
>  {
> -  if (ptr)
> -free (ptr);
> +  free (ptr);
>  }
>   
This is Ok,

Thanks,
Paolo.


Re: [libgo] Omit /bin in os_test.go

2011-03-07 Thread Ian Lance Taylor
Rainer Orth  writes:

> /bin is a directory on Solaris 2, which causes the libgo os test to
> fail:
>
> FAIL: os
> --- FAIL: os_test.TestChdirAndGetwd
>   Getwd returned "/usr/bin" want "/bin"
>
> This patch fixes this by simply removing /bin.  One could probably
> replace it by /sbin instead, which is a directory on every Unix I know.

Committed to master repository and gccgo repository.

Thanks.

Ian


Re: [libgo] Don't check gopher, http ports

2011-03-07 Thread Ian Lance Taylor
Rainer Orth  writes:

> The gopher (sort of understandable) and http (unexpected and strange)
> ports are missing form Solaris 2 /etc/services as far back as Solaris 8,
> which causes the libgo net test to fail:
>
> --- FAIL: net.TestLookupPort
>   LookupPort("tcp", "gopher") = 0, unknown port tcp/gopher; want 70
>   LookupPort("tcp", "http") = 0, unknown port tcp/http; want 80
>
> Since having those two ports above all the others adds no extra value,
> I've simply removed them to fix the test.

Committed to master repository and gccgo repository.

Thanks.

Ian


[v3] libstdc++/47145

2011-03-07 Thread Benjamin Kosnik

Conditionally set XSL_STYLE_DIR at configure time for either debian or
fedora/RHEL based systems. As discussed in bugzilla. 

For convenience, this patch steps around the STYLESHEET_FLAG question by
just punting to the net for validation only. STYLESHEET_FLAG is only
used in the validation makefile rules, and these are not in the
critical path for things like "make html" where local docbook
stylesheet files are required. So a bit of a hit time-wise is not a
major negative, whereas all developers being on the same page with
respect to validation and being able to do it even w/o the rest of the
stylesheets seems like a clear win. 

Matthias, this should allow you to kill

libstdc++-stylesheets:
  Fix libstdc++ stylesheet detection

from your 4.6.0 patchset

-benjamin

tested x86/linux
tested x86/linux -x- arm-eabi2011-03-04  Benjamin Kosnik  

	PR libstdc++/47145
	* acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Define.
	* configure.ac: Use it.
	* doc/Makefile.am (XSL_STYLE_DIR): Set at configure time.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.


Index: configure.ac
===
--- configure.ac	(revision 170762)
+++ configure.ac	(working copy)
@@ -344,12 +344,8 @@
 # Check for docbook
 AC_CHECK_PROG([XSLTPROC], xsltproc, yes, no)
 AC_CHECK_PROG([XMLLINT], xmllint, yes, no)
+GLIBCXX_CONFIGURE_DOCBOOK
 
-glibcxx_stylesheets=no
-if test -f /usr/share/sgml/docbook/xsl-ns-stylesheets/VERSION; then
-  glibcxx_stylesheets=yes
-fi
-
 # Check for xml/html dependencies.
 AM_CONDITIONAL(BUILD_XML,
 	   test $ac_cv_prog_DOXYGEN = "yes" &&
@@ -378,7 +374,7 @@
 	   test $ac_cv_prog_PDFLATEX = "yes")
 
 AC_CHECK_PROG([RUBY], ruby, yes, no)
-AC_CHECK_PROG([DBTOEPUB], dbtoepubm, yes, no)
+AC_CHECK_PROG([DBTOEPUB], dbtoepub, yes, no)
 AM_CONDITIONAL(BUILD_EPUB,
 	   test $ac_cv_prog_RUBY = "yes" &&
 	   test $ac_cv_prog_DBTOEPUB = "yes")
Index: acinclude.m4
===
--- acinclude.m4	(revision 170762)
+++ acinclude.m4	(working copy)
@@ -622,5 +621,48 @@
 
 
+dnl
+dnl Does any necessary configuration of the documentation directory.
+dnl
+dnl XSLTPROC must be set before this
+dnl
+dnl Sets:
+dnl  glibcxx_stylesheets
+dnl Substs:
+dnl  XSL_STYLE_DIR
+dnl
+AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
+
+AC_MSG_CHECKING([for stylesheets used in generation of documentation])
+glibcxx_stylesheets=no
+if test x${XSLTPROC} = xyes && echo '' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
+  glibcxx_stylesheets=yes
+fi
+AC_MSG_RESULT($glibcxx_stylesheets)
+
+AC_MSG_CHECKING([for local stylesheet directory])
+glibcxx_local_stylesheets=no
+if test x"$glibcxx_stylesheets" = x"yes"; then
+  if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
+glibcxx_local_stylesheets=yes
+XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
+  fi
+  if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
+glibcxx_local_stylesheets=yes
+XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
+  fi
+fi
+AC_MSG_RESULT($glibcxx_local_stylesheets)
+
+if test x"$glibcxx_local_stylesheets" = x"yes"; then
+  AC_SUBST(XSL_STYLE_DIR)
+  AC_MSG_NOTICE($XSL_STYLE_DIR)
+else
+  glibcxx_stylesheets=no
+fi
+])
+
+
+dnl
 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
 dnl
 dnl Substs:
Index: doc/Makefile.am
===
--- doc/Makefile.am	(revision 170762)
+++ doc/Makefile.am	(working copy)
@@ -368,12 +368,9 @@
 
 XSLTPROC   = xsltproc
 XSLTPROC_FLAGS = --nonet --xinclude
-#XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-stylesheets
-XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets
+#XSL_STYLE_DIR = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns
+#XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-ns-stylesheets
 XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl
-#XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml/chunk.xsl
-#XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/onechunk.xsl
-#XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/docbook.xsl
 XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/chunk.xsl
 XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/docbook.xsl
 XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub/docbook.xsl
@@ -398,13 +395,11 @@
 
 # Validate existing XML structure.
 XMLLINT = xmllint
-#LINT_FLAGS = --debug --xinclude --nsclean --postvalid --nowarning --nonet
-#LINT_FLAGS = --xinclude --postvalid --noent --noblanks --noout
-LINT_FLAGS = --debug --xinclude --noent --noblanks  --nonet --noout
-#SCHEMA_FLAGS = --relaxng /usr/share/xml/docbook5/schema/rng/5.0/docbookxi.rng
-SCHEMA_FLAGS = --dtdvalid /usr/share/xml/docbook5/schema/dtd/5.0/docbook.dtd
+LINT_FLAGS = --debug --xinclude --noent --noblanks --noout
+SCHEMA_FLAGS = http://www.docbook.org/xml/5.0/dtd/docbook.dtd
+#SCHEMA_FLAGS = --nonet /usr/share/xml/docbook5/schem

[trans-mem] PR 47952 Re: weak aliases, .tm_clone_table, and binutils confusion

2011-03-07 Thread Richard Henderson
On 03/06/2011 10:54 PM, Patrick Marlier wrote:
> 
>> On 03/04/11 13:07, Patrick Marlier wrote:
>>> I think this line:
>>>
>>> .section
>>> .text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,"axG",@progbits,_ZNSt14_List_iteratorIN4Game12BuildProjectE
>>>
>>> EC5EPSt15_List_node_base,comdat
>>>
>>> should be:
>>>
>>> .section
>>> .text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,"axG",@progbits,_ZGTtNSt14_List_iteratorIN4Game12BuildProjectE
>>>
>>> EC5EPSt15_List_node_base,comdat
>>>
>>> Is it right?
> 
> Well, I have patched trans-mem.c to update the name of the COMDAT_GROUP in 
> ipa_tm_create_version(). I know this is not the way to do this but I hope it 
> can at least help you.

This part is clearly correct.  I've tidied up your patch a bit and committed the
following.  Please update the PR with a full compilable test case so I can 
determine what else might need fixing.


r~
PR 47952
* trans-mem.c (tm_mangle): Pass in and return an identifier.
(ipa_tm_create_version): Update to match.  Also mangle the
DECL_COMDAT_GROUP.


diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 9e68571..1aadd13 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4048,19 +4048,20 @@ ipa_tm_region_init (struct cgraph_node *node)
OLD_DECL.  The returned value is a freshly malloced pointer that
should be freed by the caller.  */
 
-static char *
-tm_mangle (tree old_decl)
+static tree
+tm_mangle (tree old_asm_id)
 {
   const char *old_asm_name;
   char *tm_name;
   void *alloc = NULL;
   struct demangle_component *dc;
+  tree new_asm_id;
 
   /* Determine if the symbol is already a valid C++ mangled name.  Do this
  even for C, which might be interfacing with C++ code via appropriately
  ugly identifiers.  */
   /* ??? We could probably do just as well checking for "_Z" and be done.  */
-  old_asm_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (old_decl));
+  old_asm_name = IDENTIFIER_POINTER (old_asm_id);
   dc = cplus_demangle_v3_components (old_asm_name, DMGL_NO_OPTS, &alloc);
 
   if (dc == NULL)
@@ -4068,8 +4069,7 @@ tm_mangle (tree old_decl)
   char length[8];
 
 do_unencoded:
-  sprintf (length, "%u",
-  IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (old_decl)));
+  sprintf (length, "%u", IDENTIFIER_LENGTH (old_asm_id));
   tm_name = concat ("_ZGTt", length, old_asm_name, NULL);
 }
   else
@@ -4098,7 +4098,11 @@ tm_mangle (tree old_decl)
   tm_name = concat ("_ZGTt", old_asm_name, NULL);
 }
   free (alloc);
-  return tm_name;
+
+  new_asm_id = get_identifier (tm_name);
+  free (tm_name);
+
+  return new_asm_id;
 }
 
 /* Create a copy of the function (possibly declaration only) of OLD_NODE,
@@ -4107,9 +4111,8 @@ tm_mangle (tree old_decl)
 static void
 ipa_tm_create_version (struct cgraph_node *old_node)
 {
-  tree new_decl, old_decl;
+  tree new_decl, old_decl, tm_name;
   struct cgraph_node *new_node;
-  char *tm_name;
 
   old_decl = old_node->decl;
   new_decl = copy_node (old_decl);
@@ -4117,10 +4120,13 @@ ipa_tm_create_version (struct cgraph_node *old_node)
   /* DECL_ASSEMBLER_NAME needs to be set before we call
  cgraph_copy_node_for_versioning below, because cgraph_node will
  fill the assembler_name_hash.  */
-  tm_name = tm_mangle (old_decl);
-  SET_DECL_ASSEMBLER_NAME (new_decl, get_identifier (tm_name));
+  tm_name = tm_mangle (DECL_ASSEMBLER_NAME (old_decl));
+  SET_DECL_ASSEMBLER_NAME (new_decl, tm_name);
   SET_DECL_RTL (new_decl, NULL);
-  free (tm_name);
+
+  /* Perform the same remapping to the comdat group.  */
+  if (DECL_COMDAT (new_decl))
+DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
 
   new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL);
   get_cg_data (old_node)->clone = new_node;
@@ -4146,15 +4152,13 @@ ipa_tm_create_version (struct cgraph_node *old_node)
 
   for (alias = old_node->same_body; alias; alias = alias->next)
{
- tm_name = tm_mangle (alias->decl);
+ tm_name = tm_mangle (DECL_ASSEMBLER_NAME (alias->decl));
  tm_alias = build_decl (DECL_SOURCE_LOCATION (alias->decl),
-  TREE_CODE (alias->decl),
-  get_identifier (tm_name),
-  TREE_TYPE (alias->decl));
+TREE_CODE (alias->decl), tm_name,
+TREE_TYPE (alias->decl));
 
- SET_DECL_ASSEMBLER_NAME (tm_alias, get_identifier (tm_name));
+ SET_DECL_ASSEMBLER_NAME (tm_alias, tm_name);
  SET_DECL_RTL (tm_alias, NULL);
- free (tm_name);
 
  /* Based loosely on C++'s make_alias_for().  */
  TREE_PUBLIC (tm_alias) = TREE_PUBLIC (alias->decl);


Using sysroot in testsuite. Trunk version. (issue4248059)

2011-03-07 Thread Diego Novillo

This is the patch I had in mind for trunk.  I made it a little more
generic by changing the name of the variable to TEST_ALWAYS_FLAGS and
setting it by default to use the value from SYSROOT_CFLAGS_FOR_TARGET.

I also added the setting of SYSROOT_CFLAGS_FOR_TARGET to use the value
from --with-build-sysroot.  I think this would also be useful for any
other settings that one would want to use with all compiles, but I'm
not completely sure if the approach is OK.

If this is not the proper way, I need something like this so I can
execute every test in the testsuite with a specific set of flags
(--sysroot=... in this case)

Bootstrapped and tested on x86_64 with and without build-sysroot.

OK for 4.7?


Thanks.  Diego.


ChangeLog

* Makefile.in (SYSROOT_CFLAGS_FOR_TARGET): Define from
@SYSROOT_CFLAGS_FOR_TARGET@.
* configure.ac (SYSROOT_CFLAGS_FOR_TARGET): Set from
build-sysroot.
* configure: Regenerate.
(site.exp): Add definition of TEST_ALWAYS_FLAGS.
Remove setting of GCC_UNDER_TEST.

testsuite/ChangeLog

* lib/g++.exp (g++_init): Add $TEST_ALWAYS_FLAGS to
ALWAYS_CXXFLAGS, if defined.
* lib/gfortran.exp (gfortran_init): Add $TEST_ALWAYS_FLAGS to
ALWAYS_GFORTRANFLAGS, if defined.
* lib/go.exp (go_target_compile): Add $TEST_ALWAYS_FLAGS to
ALWAYS_GOCFLAGS, if defined.
* lib/obj-c++.exp (obj-c++_init): Add $TEST_ALWAYS_FLAGS to
ALWAYS_OBJCXXFLAGS, if defined.
* lib/gcc.exp (gcc_target_compile): Add $TEST_ALWAYS_FLAGS to
additional_flags, if defined.
* lib/gnat.exp (gnat_target_compile): Likewise.
* lib/objc.exp (objc_target_compile): Likewise.
* lib/target-supports-dg.exp (dg-add-options): Handle
TEST_ALWAYS_FLAGS.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 9a8262a..158f47d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -373,6 +373,9 @@ UNWIND_H = $(srcdir)/unwind-generic.h
 # Don't use this as a dependency--use $(GCC_PASSES).
 GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ 
-isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include 
-L$(objdir)/../ld
 
+# Set if the compiler was configured with --with-build-sysroot.
+SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
+
 # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
 # It specifies -B./.
 # It also specifies -isystem ./include to find, e.g., stddef.h.
@@ -4831,6 +4834,9 @@ site.exp: ./config.status Makefile
@echo "set CXXFLAGS \"\"" >> ./tmp0
@echo "set HOSTCC \"$(CC)\"" >> ./tmp0
@echo "set HOSTCFLAGS \"$(CFLAGS)\"" >> ./tmp0
+# TEST_ALWAYS_FLAGS are flags that should be passed to every compilation.
+# They are passed first to allow individual tests to override them.
+   @echo "set TEST_ALWAYS_FLAGS \"$(SYSROOT_CFLAGS_FOR_TARGET)\"" >> ./tmp0
 # When running the tests we set GCC_EXEC_PREFIX to the install tree so that
 # files that have already been installed there will be found.  The -B option
 # overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files
diff --git a/gcc/configure b/gcc/configure
index a454946..df8b166 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -759,6 +759,7 @@ CONFIGURE_SPECS
 CROSS_SYSTEM_HEADER_DIR
 TARGET_SYSTEM_ROOT_DEFINE
 TARGET_SYSTEM_ROOT
+SYSROOT_CFLAGS_FOR_TARGET
 enable_shared
 enable_fixed_point
 enable_decimal_float
@@ -7060,11 +7061,16 @@ fi
 
 # Check whether --with-build-sysroot was given.
 if test "${with_build_sysroot+set}" = set; then :
-  withval=$with_build_sysroot;
+  withval=$with_build_sysroot; if test x"$withval" != x ; then
+ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
+   fi
+else
+  SYSROOT_CFLAGS_FOR_TARGET=
 fi
 
 
 
+
 # Check whether --with-sysroot was given.
 if test "${with_sysroot+set}" = set; then :
   withval=$with_sysroot;
@@ -17505,7 +17511,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17508 "configure"
+#line 17514 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17611,7 +17617,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17614 "configure"
+#line 17620 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 03a8cef..82aef96 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -711,7 +711,12 @@ AC_SUBST(enable_shared)
 
 AC_ARG_WITH(build-sysroot, 
   [  --with-build-sysroot=sysroot
-  use sysroot as the system root during the build])
+  use sysroot as the system root during the build],
+  [if test x"$withval" != x ; then
+ SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
+   fi],
+  [SYSROOT_CFLAGS_FOR_TARGET=])
+AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
 
 AC_ARG_WITH(sysroot,
 [  --with-sysroot[=DIR] Sear

Re: Using sysroot in testsuite. Trunk version. (issue4248059)

2011-03-07 Thread Mike Stump
On Mar 7, 2011, at 5:30 PM, Diego Novillo wrote:
> This is the patch I had in mind for trunk.

> OK for 4.7?

Ok.  I'll just note here, that this is necessary for canadian, but not always 
sufficient.  It is monotonically better however.  I looked at the 
Make/configure issues, and they look fine to me, though, there are others that 
specialize in that.  Thanks.


[4.7] Avoid global state in v850_handle_option

2011-03-07 Thread Joseph S. Myers
This patch, for 4.7 and relative to a tree with
 applied,
stops the V850 handle_option hook from using global state.

The main changes here relate to the small memory options.  These were
previously handled as options -msda, -mtda, -mzda with joined
arguments and target-specific code looking for a '-' or '=' followed
by a number; that is changed to describing them as options -msda=
etc. with UInteger arguments, and aliases -msda- etc., so the .opt
machinery deals with parsing the arguments.  (The canonical forms were
chosen on the basis that invoke.texi only mentions the '=' forms, with
the '-' forms being undocumented.)  Previously an array small_memory
was used that combined both variable information from the command line
and constant information about the permitted range of arguments to the
options; these are separated so that the variable information ends up
in the gcc_options structure.  The third structure element was the
option name; the full original option name with its original spelling
is now passed down to v850_handle_memory_option so that structure
element is no longer needed.

Tested building cc1 and xgcc for cross to v850-elf.  Will commit to
trunk for 4.7 in the absence of target maintainer objections.

2011-03-07  Joseph Myers  

* config/v850/v850-opts.h: New.
* config/v850/v850.c (small_memory): Replace with
small_memory_physical_max array.  Make that array static const.
(v850_handle_memory_option): Take integer value of argument.  Take
gcc_options pointer, option text and location.  Return void.
Update for changes to small memory structures.
(v850_handle_option): Access target_flags via opts pointer.  Don't
assert that global structures are in use.  Update calls to
v850_handle_memory_option.
(v850_encode_data_area): Update references to small memory
settings.
* config/v850/v850.h (struct small_memory_info, small_memory):
Remove.
(enum small_memory_type): Move to v850-opts.h.
* config/v850/v850.opt (config/v850/v850-opts.h): New
HeaderInclude entry.
(small_memory_max): New Variable entry.
(msda): Replace by pair of options msda= and msda-.  Use UInteger.
(mtda, mzda): Likewise.

diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/v850/v850-opts.h 
gcc-mainline/gcc/config/v850/v850-opts.h
--- gcc-mainline-1/gcc/config/v850/v850-opts.h  1969-12-31 16:00:00.0 
-0800
+++ gcc-mainline/gcc/config/v850/v850-opts.h2011-03-07 17:52:17.0 
-0800
@@ -0,0 +1,34 @@
+/* Definitions for option handling for NEC V850 series.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2007, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   .  */
+
+#ifndef V850_OPTS_H
+#define V850_OPTS_H
+
+enum small_memory_type {
+  /* tiny data area, using EP as base register */
+  SMALL_MEMORY_TDA = 0,
+  /* small data area using dp as base register */
+  SMALL_MEMORY_SDA,
+  /* zero data area using r0 as base register */
+  SMALL_MEMORY_ZDA,
+  SMALL_MEMORY_max
+};
+
+#endif
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/v850/v850.c 
gcc-mainline/gcc/config/v850/v850.c
--- gcc-mainline-1/gcc/config/v850/v850.c   2011-02-24 13:45:15.0 
-0800
+++ gcc-mainline/gcc/config/v850/v850.c 2011-03-07 18:07:45.0 -0800
@@ -51,12 +51,11 @@
 static void v850_print_operand_address (FILE *, rtx);
 
 /* Information about the various small memory areas.  */
-struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
+static const int small_memory_physical_max[(int) SMALL_MEMORY_max] =
 {
-  /* Name  Max Physical max.  */
-  { "tda", 0,  256 },
-  { "sda", 0,  65536 },
-  { "zda", 0,  32768 },
+  256,
+  65536,
+  32768,
 };
 
 /* Names of the various data areas used on the v850.  */
@@ -83,66 +82,62 @@ static GTY(()) section * zdata_section;
 static GTY(()) section * zbss_section;
 
 /* Set the maximum size of small memory area TYPE to the value given
-   by VALUE.  Return true if VALUE was syntactically correct.  VALUE
-   starts with the argument separator: either "-" or "=".  */
+   by SIZE in structure OPTS (option text OPT passed at lo

C++ PATCH for c++/48003 (allow integer overflow in template args with -fpermissive)

2011-03-07 Thread Jason Merrill
This patch changes convert_nontype_argument to defer to 
cxx_constant_value on whether or not to go ahead with a semi-constant 
template argument, and whether or not to give a diagnostic.  Making this 
change revealed a bug in potential_constant_expression_1, which was 
failing to check for overflow.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 0e5ec26f6aeca92278e290181b3bd66f9344953f
Author: Jason Merrill 
Date:   Mon Mar 7 16:17:21 2011 -0500

PR c++/48003
* pt.c (convert_nontype_argument): Fix -fpermissive allowing
integer overflow.
* semantics.c (potential_constant_expression_1): Check TREE_OVERFLOW.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index dfc9728..076224c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5402,11 +5402,19 @@ convert_nontype_argument (tree type, tree expr, 
tsubst_flags_t complain)
{
  if (complain & tf_error)
{
- error ("%qE is not a valid template argument for type %qT "
-"because it is a non-constant expression", expr, type);
- cxx_constant_value (expr);
+ int errs = errorcount, warns = warningcount;
+ expr = cxx_constant_value (expr);
+ if (errorcount > errs || warningcount > warns)
+   inform (EXPR_LOC_OR_HERE (expr),
+   "in template argument for type %qT ", type);
+ if (expr == error_mark_node)
+   return NULL_TREE;
+ /* else cxx_constant_value complained but gave us
+a real constant, so go ahead.  */
+ gcc_assert (TREE_CODE (expr) == INTEGER_CST);
}
- return NULL_TREE;
+ else
+   return NULL_TREE;
}
 }
   /* [temp.arg.nontype]/5, bullet 2
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 52a962d..a0f48c0e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7275,7 +7275,20 @@ potential_constant_expression_1 (tree t, bool want_rval, 
tsubst_flags_t flags)
   return false;
 }
   if (CONSTANT_CLASS_P (t))
-return true;
+{
+  if (TREE_OVERFLOW (t))
+   {
+ if (flags & tf_error)
+   {
+ permerror (EXPR_LOC_OR_HERE (t),
+"overflow in constant expression");
+ if (flag_permissive)
+   return true;
+   }
+ return false;
+   }
+  return true;
+}
 
   switch (TREE_CODE (t))
 {
diff --git a/gcc/testsuite/g++.dg/init/member1.C 
b/gcc/testsuite/g++.dg/init/member1.C
index aededf2..88f9b31 100644
--- a/gcc/testsuite/g++.dg/init/member1.C
+++ b/gcc/testsuite/g++.dg/init/member1.C
@@ -12,7 +12,7 @@ template struct C
 {
   static const int i = A::i;  // { dg-error "incomplete" }
   static const int j = i;
-  B b;  // { dg-error "not a valid template arg" }
+  B b;
 };
 
 C c;
diff --git a/gcc/testsuite/g++.dg/parse/constant4.C 
b/gcc/testsuite/g++.dg/parse/constant4.C
index 4d9814f..a1be5dd 100644
--- a/gcc/testsuite/g++.dg/parse/constant4.C
+++ b/gcc/testsuite/g++.dg/parse/constant4.C
@@ -18,7 +18,7 @@ void Foo ()
   
   static const unsigned J = X::J; // { dg-message "not initialized with a 
constant expression" }
   
-  Y j; // { dg-error "constant" "" }
+  Y j; // { dg-error "constant|template argument" "" }
 }
 
 struct A 
diff --git a/gcc/testsuite/g++.dg/template/nontype20.C 
b/gcc/testsuite/g++.dg/template/nontype20.C
new file mode 100644
index 000..e4aba32
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nontype20.C
@@ -0,0 +1,11 @@
+// PR c++/48003
+// { dg-options "-fpermissive -w" }
+// Test that we allow integer overflow in constant exprs with -fpermissive
+
+template
+struct test
+{
+  typedef test prior;
+};
+
+test<-2147483647-1> f;
diff --git a/gcc/testsuite/g++.dg/template/qualified-id3.C 
b/gcc/testsuite/g++.dg/template/qualified-id3.C
index bbfb51e..c769a52 100644
--- a/gcc/testsuite/g++.dg/template/qualified-id3.C
+++ b/gcc/testsuite/g++.dg/template/qualified-id3.C
@@ -3,7 +3,7 @@
 template  struct A { };
 template  struct B {
   static const int c; // { dg-message "not initialized with a constant 
expression" }
-  typedef A::c> C;// { dg-error "constant expression" }
+  typedef A::c> C;// { dg-error "constant expression|template 
argument" }
 };
 template  const int B::c = sizeof (T);
 
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C 
b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
index af0e919..86f3861 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
@@ -5,6 +5,7 @@ class GCD {
 public:
   enum { val = (N == 0) ? M : GCD::val }; // { dg-warning "division" 
"division" }
 // { dg-error "constant expression" "valid" { target *-*-* } 6 }
+// { dg-message "template argument" "valid" { target *-*-* } 6 }
 };
 
 int main() {
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc 
b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_

Re: PR 47793 - Support relative paths using -fprofile-generate

2011-03-07 Thread Martin Thuresson
On Mon, Mar 7, 2011 at 11:53 AM, Diego Novillo  wrote:
> On Tue, Mar 1, 2011 at 17:07, Martin Thuresson  wrote:
>> Ping.
>>
>> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson  wrote:
>>> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson  
>>> wrote:
 Change 165596 and 168475 updated the code for handling gcda-paths. As
 part of this change, relative paths stopped working.

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793

 This patch adds a guard so that "/" is not added when no prefix is
 given.

 The added testcase uses the path "../gcc/". This puts the gcda in the
 same directory, so that the cleanup-coverage-files will find them.

 I have tested the patch using "make bootstrap; make -k check" with
 target x86_64-unknown-linux-gnu and saw no additional test failures.

 Let me know if there is any other testing I should do.
>>>
>>> ChangeLog
>>> gcc/
>>>
>>> 2011-02-23  Martin Thuresson  
>>>
>>>        PR gcov-profile/47793
>>>        * libgcov.c (gcov_exit): Support relative profile paths.
>>>
>>> gcc/testsuite/
>>>
>>> 2011-02-23  Martin Thuresson  
>>>
>>>        PR gcov-profile/47793
>>>        * gcc.dg/pr47793.c: New.
>
> Martin,
>
> Let's put it in google/main while the review is underway.  Is this a
> regression vs 4.5 or 4.4?  If so, it may be suitable for trunk (or the
> future release branch), but you will need an explicit approval from
> the release managers (CC'd).  If it's a new bug, then this should go
> in trunk after we re-enter stage 1.

I have not tested 4.5 yet, but looking at the SVN log, I believe
this was introduced 2010/10/17.

Martin


C++ PATCH for c++/48015 (C++0x ICE with non-constant initializer for const int var in template)

2011-03-07 Thread Jason Merrill
constant_value_1 has been trying to pull out DECL_INITIAL for any 
variable with the proper type.  This can be problematic in templates, 
where DECL_INITIAL hasn't always been properly folded yet.  But since we 
try to reduce initializers to a constant when we process the 
declaration, we can just decide whether or not we want to use the 
initializer based on TREE_CONSTANT.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 9c7fa022068d56f4417aeea733e8bdf21c4a98e7
Author: Jason Merrill 
Date:   Mon Mar 7 16:00:05 2011 -0500

PR c++/48015
* init.c (constant_value_1): Always require init to be TREE_CONSTANT.

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e590118..56f66fa 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1760,17 +1760,15 @@ constant_value_1 (tree decl, bool integral_p)
init = TREE_VALUE (init);
   if (!init
  || !TREE_TYPE (init)
- || uses_template_parms (init)
- || (integral_p
- ? false
- : (!TREE_CONSTANT (init)
-/* Do not return an aggregate constant (of which
-   string literals are a special case), as we do not
-   want to make inadvertent copies of such entities,
-   and we must be sure that their addresses are the
-   same everywhere.  */
-|| TREE_CODE (init) == CONSTRUCTOR
-|| TREE_CODE (init) == STRING_CST)))
+ || !TREE_CONSTANT (init)
+ || (!integral_p
+ /* Do not return an aggregate constant (of which
+string literals are a special case), as we do not
+want to make inadvertent copies of such entities,
+and we must be sure that their addresses are the
+same everywhere.  */
+ && (TREE_CODE (init) == CONSTRUCTOR
+ || TREE_CODE (init) == STRING_CST)))
break;
   decl = unshare_expr (init);
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/non-const1.C 
b/gcc/testsuite/g++.dg/cpp0x/regress/non-const1.C
new file mode 100644
index 000..7fc66a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/non-const1.C
@@ -0,0 +1,9 @@
+// PR c++/48015
+// { dg-options -std=c++0x }
+
+template  T f(T);
+template  void g()
+{
+  int const c = f (1);
+  int i = c - 0;
+}


[PATCH, SMS] Support closing_branch_deps

2011-03-07 Thread Revital1 Eres

Hello,

The attached patch includes enhancements for SMS to support targets
that their doloop part is not decoupled from the rest of the loop's
instructions, as SMS currently requires. (ARM is an example for such
target, where the loop's instructions might use CC which is used in the
doloop part)

The patch uses already existing closing_branch_deps field in the DDG to
indicate whether the closing branch should be scheduled with the rest
of the loop instructions to preserve the dependencies between them.
In the current implementation, closing_branch_deps is always false which
enables to leave the closing branch outside of the scheduling process and
place it at ii-1 row at the end of the process.  This patch extends the
implementation by identifying loops where closing_branch_deps  should be
true and scheduling the closing branch with the rest of the instructions
for such loops, rotating the branch to be in the ii-1 row at the end of
the scheduling process.

The patch also enables the scheduling when debug_insn is generated for
instructions in the do-loop part. To enable this, a small fix was inserted
on top of the already approved do-loop patch (not in mainline yet,
http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01718.html) in loop-doloop.c
file to consider prev_nondebug_insn instead of PREV_INSN as follows:
(the diff is against the patch in the above link and thus it is not
included in the attached file, however it is part of the tested patch
and thus I appreciate an approval for this part also)


@@ -610,7 +614,7 @@
 +inc = XVECEXP (PATTERN (prev_insn), 0, 1);
 +  }
 +  else
-+inc = PATTERN (PREV_INSN (doloop_pat));
++inc = PATTERN (prev_insn);
/* We expect the condition to be of the form (reg != 0)  */
cond = XEXP (SET_SRC (cmp), 0);
if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx)

The attached patch was tested with the patch to support do-loop for ARM
(http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01718.html) including the
fix mentioned above; as following:
On ppc64-redhat-linux regtest as well as bootstrap with flags(*);
enabling SMS also on loops with stage count 1.
Regtested on SPU.
On arm-linux-gnueabi regtseted on c,c++. Bootstrap c language
with flags (*)  configured  w and w\o --with-arch=armv7-a; and w and w\o
--with-mode=thumb
(four different configurations in total) enabling SMS also on loops with
stage count 1.

(*) flags used for bootstrap: -O2 -fmodulo-sched
-fmodulo-sched-allow-regmoves
-fno-auto-inc-dec -funsafe-math-optimizations

OK for trunk once stage 1 will be open?

Thanks,
Revital

ChangeLog:

   * ddg.c (check_closing_branch_deps, get_node_of_insn_uid):
New functions.
(create_ddg): Pass sbitmap containing do-loop related
instructions instead of closing_branch_deps parameter and call
check_closing_branch_deps function.
* ddg.h (create_ddg): Adjust the function declaration.
* modulo-sched.c (PS_STAGE_COUNT): Rename to CALC_STAGE_COUNT
and redefine.
(doloop_register_get): Handle NONDEBUG_INSN_P.
(stage_count): New field in struct partial_schedule.
(mark_doloop_insns, calculate_stage_count): New functions.
(normalize_sched_times): Rename to reset_sched_times and handle
incrementing the sched time of the nodes by a constant value
passed as parameter.
(duplicate_insns_of_cycles): Skip closing branch.
(sms_schedule_by_order): Schedule closing branch when
closing_branch_deps is true.
(ps_insn_find_column): Handle closing branch.
(sms_schedule): Call reset_sched_times and handle case where
do-loop pattern is not decoupled from the other loop instructions.
(ps_insert_empty_row): Update calls to normalize_sched_times
and rotate_partial_schedule functions.
   * loop-doloop.c (doloop_condition_get): Use prev_nondebug_insn
instead of PREV_INSN.


testsuite Changlog:

* gcc.target/arm/sms-9.c: New file.
* gcc.target/arm/sms-10.c: New file.

(See attached file: patch_doloop_fix_7_3_new.txt)

(See attached file: sms-10.c)(See attached file: sms-9.c)Index: ddg.c
===
--- ddg.c   (revision 170464)
+++ ddg.c   (working copy)
@@ -60,6 +60,8 @@ static void create_ddg_dep_no_link (ddg_
 static ddg_edge_ptr create_ddg_edge (ddg_node_ptr, ddg_node_ptr, dep_type,
 dep_data_type, int, int);
 static void add_edge_to_ddg (ddg_ptr g, ddg_edge_ptr);
+static ddg_node_ptr get_node_of_insn_uid (ddg_ptr, int);
+
 
 /* Auxiliary variable for mem_read_insn_p/mem_write_insn_p.  */
 static bool mem_ref_p;
@@ -488,12 +490,65 @@ build_intra_loop_deps (ddg_ptr g)
   sched_free_deps (head, tail, false);
 }
 
+/* Given DOLOOP_INSNS which holds the instructions that
+   belong to the do-loop part; mark closing_branch_deps field in ddg G
+   as TRUE if the do-