Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler

2011-05-15 Thread Janne Blomqvist
On Sat, May 14, 2011 at 22:40, Janne Blomqvist
 wrote:
> Hi
>
> the current version of showing the backtrace is not async-signal-safe
> as it uses backtrace_symbols() which, in turn, uses malloc(). The
> attached patch changes the backtrace printing functionality to instead
> use backtrace_symbols_fd() and pipes.
>
> Also, it does some other work on backtrace printing:
>
> - Nowadays the main program has the same debug symbol name as whatever
> the name of the main program is, rather than MAIN__. Therefore remove
> special case logic related to that.

FWIW, I noticed that if debug symbols are not included, the MAIN__ is
printed. So should I add back the special casing of MAIN__?

> - Don't filter out stack frames from inside libgfortran, as this might
> lose information in case the reason for the crash is in the library.
>
> - Reformat the output slightly, so the each stack frame fits on one
> line, and begins with #NUM, similar to GDB.

I reformatted it some more, now it includes the file name, so the output is like

Backtrace for this error:
  #0  
/home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0x18357)[0x7fd385e51357]
  #1  
/home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0x19de7)[0x7fd385e52de7]
  #2  
/home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0xe1f69)[0x7fd385f1af69]
  #3  
/home/janne/src/gfortran/my-patches/pr48931-backtrace-abort/a.out[0x400612]
in b_ at bt.f90:5
  #4  
/home/janne/src/gfortran/my-patches/pr48931-backtrace-abort/a.out[0x400620]
in b_ at bt.f90:7
  #5  
/home/janne/src/gfortran/my-patches/pr48931-backtrace-abort/a.out[0x400630]
in a_ at bt.f90:11
  #6  
/home/janne/src/gfortran/my-patches/pr48931-backtrace-abort/a.out[0x400640]
in bt at bt.f90:15
Aborted

Similar to GDB, the address is now printed before function and
file:line number info. And similar to backtrace_symbols_fd() output (3
first stack frames above), the file name is printed before the
address.

I also improved the logic for figuring out the executable path, as the
old way doesn't work if the executable is not in the current working
directory.  The improved logic is, I believe, Linux-specific, but
since the only user of full_exe_path() is the glibc-specific
backtracing stuff I don't think that is a big loss.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2011-05-15  Janne Blomqvist  

PR libfortran/48931
* configure.ac: Check for backtrace_symbols_fd instead of
backtrace_symbols, check for readlink.
* config.h.in: Regenerated.
* configure: Regenerated.
* runtime/backtrace.c (local_strcasestr): Remove.
(bt_header): New function.
(dump_glibc_backtrace): Remove.
(show_backtrace): Rework to use backtrace_symbols_fd and pipes,
reformat output.
* runtime/main.c (store_exe_path): Try to check /proc/self/exe
first.
(full_exe_path): If the path is NULL, try to figure it out before
returning.


-- 
Janne Blomqvist
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index cf38fb0..74cfe44 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -264,10 +264,10 @@ AC_CHECK_FUNCS(sleep time ttyname signal alarm clock access fork execl)
 AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
 AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
 AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r)
-AC_CHECK_FUNCS(clock_gettime strftime)
+AC_CHECK_FUNCS(clock_gettime strftime readlink)
 
 # Check for glibc backtrace functions
-AC_CHECK_FUNCS(backtrace backtrace_symbols)
+AC_CHECK_FUNCS(backtrace backtrace_symbols_fd)
 
 # Check libc for getgid, getpid, getuid
 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 10917d3..c591b01 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -54,57 +54,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define CAN_FORK (defined(HAVE_FORK) && defined(HAVE_EXECVP) \
 		  && defined(HAVE_WAIT))
 #define GLIBC_BACKTRACE (defined(HAVE_BACKTRACE) \
-			 && defined(HAVE_BACKTRACE_SYMBOLS))
+			 && defined(HAVE_BACKTRACE_SYMBOLS_FD))
 #define CAN_PIPE (CAN_FORK && defined(HAVE_PIPE) \
 		  && defined(HAVE_DUP2) && defined(HAVE_FDOPEN) \
 		  && defined(HAVE_CLOSE))
 
 
-#if GLIBC_BACKTRACE && CAN_PIPE
-static char *
-local_strcasestr (const char *s1, const char *s2)
+/* GDB style #NUM index for each stack frame.  */
+static void 
+bt_header (int num)
 {
-#ifdef HAVE_STRCASESTR
-  return strcasestr (s1, s2);
-#else
-
-  const char *p = s1;
-  const size_t len = strlen (s2);
-  const char u = *s2, v = isupper((int) *s2) ? tolower((int) *s2)
-  : (islower((int) *s2) ? toupper((int) *s2)
-			: *s2);
-
-  while (1)
-{
-  while (*p != u && *p != v && *p)
-	p++;
-   

[patch] fix c++/48994

2011-05-15 Thread Jonathan Wakely
cp/ChangeLog

PR c++/48994
* parser.c (cp_parser_perform_range_for_lookup): Call complete_type.

testsuite/ChangeLog

PR c++/48994
* g++.dg/cpp0x/range-for18.C: New.

Tested x86_64-linux, ok for trunk?
Index: cp/parser.c
===
--- cp/parser.c (revision 173683)
+++ cp/parser.c (working copy)
@@ -8682,7 +8682,7 @@
 static tree
 cp_parser_perform_range_for_lookup (tree range, tree *begin, tree *end)
 {
-  if (!COMPLETE_TYPE_P (TREE_TYPE (range)))
+  if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (range
 {
   error ("range-based % expression of type %qT "
 "has incomplete type", TREE_TYPE (range));
Index: testsuite/g++.dg/cpp0x/range-for18.C
===
--- testsuite/g++.dg/cpp0x/range-for18.C(revision 0)
+++ testsuite/g++.dg/cpp0x/range-for18.C(revision 0)
@@ -0,0 +1,17 @@
+// PR c++/48994
+
+// { dg-do compile }
+// { dg-options "-std=c++0x" }
+
+template 
+struct myvec
+{
+T* begin() const;
+T* end() const;
+};
+
+void f(const myvec& v)
+{
+for (int i : v)
+;
+}


Re: [Patch, libfortran, committed] PR 48915 Update mixed-language programming section documentation

2011-05-15 Thread Janne Blomqvist
The previous patch was slightly over-zealous. Committed the following fix:

Index: gfortran.texi
===
--- gfortran.texi   (revision 173769)
+++ gfortran.texi   (working copy)
@@ -2611,7 +2611,7 @@ standard error.  Default: @code{GFC_STD_
 Default: off.
 @item @var{option}[3] @tab Unused.
 @item @var{option}[4] @tab If non zero, enable backtracing on run-time
-errors.  Default: enabled.
+errors.  Default: off.
 Note: Installs a signal handler and requires command-line
 initialization using @code{_gfortran_set_args}.
 @item @var{option}[5] @tab If non zero, supports signed zeros.
Index: ChangeLog
===
--- ChangeLog   (revision 173769)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2011-05-15  Janne Blomqvist  
+
+   PR libfortran/48915
+   * gfortran.texi (_gfortran_set_options): Even though -fbacktrace
+   is now the default, the library defaults to backtracing disabled.
+
 2011-05-14  Tobias Burnus  

* lang.opt (fdump-core): Re-add as ignored option


On Sat, May 14, 2011 at 13:24, Janne Blomqvist
 wrote:
> Hi,
>
> I committed the attached patch as obvious. It updates the manual
> section on mixed-language programming to reflect the changes made as
> part of PR 48915.
>
> Index: gfortran.texi
> ===
> --- gfortran.texi       (revision 173750)
> +++ gfortran.texi       (working copy)
> @@ -2578,7 +2578,7 @@ int main (int argc, char *argv[])
>  @table @asis
>  @item @emph{Description}:
>  @code{_gfortran_set_options} sets several flags related to the Fortran
> -standard to be used, whether backtracing or core dumps should be enabled
> +standard to be used, whether backtracing should be enabled
>  and whether range checks should be performed.  The syntax allows for
>  upward compatibility since the number of passed flags is specified; for
>  non-passed flags, the default value is used.  See also
> @@ -2609,10 +2609,9 @@ Possible values are (bitwise or-ed) @cod
>  standard error.  Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
>  @item @var{option}[2] @tab If non zero, enable pedantic checking.
>  Default: off.
> -@item @var{option}[3] @tab If non zero, enable core dumps on run-time
> -errors.  Default: off.
> +@item @var{option}[3] @tab Unused.
>  @item @var{option}[4] @tab If non zero, enable backtracing on run-time
> -errors.  Default: off.
> +errors.  Default: enabled.
>  Note: Installs a signal handler and requires command-line
>  initialization using @code{_gfortran_set_args}.
>  @item @var{option}[5] @tab If non zero, supports signed zeros.
> @@ -2627,8 +2626,8 @@ Default: enabled.  See -frange-check (@p
>
>  @item @emph{Example}:
>  @smallexample
> -  /* Use gfortran 4.5 default options.  */
> -  static int options[] = @{68, 255, 0, 0, 0, 1, 0, 1@};
> +  /* Use gfortran 4.7 default options.  */
> +  static int options[] = @{68, 255, 0, 0, 1, 1, 0, 1@};
>   _gfortran_set_options (8, &options);
>  @end smallexample
>  @end table
> Index: ChangeLog
> ===
> --- ChangeLog   (revision 173750)
> +++ ChangeLog   (working copy)
> @@ -1,5 +1,12 @@
>  2011-05-14  Janne Blomqvist  
>
> +       PR libfortran/48915
> +       * gfortran.texi: Update mixed-language programming section
> +       reflecting the removal of the fdump-core option, and that
> +       -fbacktrace is enabled by default.
> +
> +2011-05-14  Janne Blomqvist  
> +
>         PR libfortran/48915
>         * gfortran.h (gfc_option_t): Remove flag_dump_core.
>         * gfortran.texi (GFORTRAN_ERROR_DUMPCORE): Remove section.
>
>
> --
> Janne Blomqvist
>



-- 
Janne Blomqvist


Re: [google] support for building Linux kernel with FDO (issue4523061)

2011-05-15 Thread Jan Hubicka
> On Fri, May 13, 2011 at 5:54 AM, Paolo Bonzini  wrote:
> > On 05/13/2011 03:03 AM, Rong Xu wrote:
> >>
> >>        * gcc/coverage.c        (revision 173717): set a flag if building
> >> for Linux kernel.
> >>        * gcc/tree-profile.c    (revision 173717): don't emit TLS
> >> declarations for Linux kernel builds.
> >
> > I think this should be done without touching at all the profiling machinery
> > in GCC.
> >
> > 1) add a new TLS model -ftls-model=none and make the kernel uses it. The
> > model would simply force targetm.have_tls to false.
> >
> 
> This is a good idea.
> 
> 
> > 2) as Richi mentioned, gcov-io and libgcov changes then can move to the
> > kernel, and GCC needs no change at all here.
> >
> 
> In fact -- reuse gcc code profiling machinery for FDO is the KEY
> objective in this effort --- the effort tries to minimize gcc changes
> by refactoring gcc code and isolating/abstracting away part of gcc
> implementation that is user space program specific without using
> runtime hooks.  Aside from the kernel FDO change -- the refactoring
> itself actually makes the libgcov code more readable -- the existing
> implementation has many huge functions etc.
> 
> Kernel source has their implementation of coverage testing -- but it
> makes lots of data structure assumptions and hard coded -- it can
> easily out of sync with gcc and is considered  unmaintainable.

Yep,
I think it does make sense to share the implementation, but we need to find
resonable way to do so.  I guess we could separate out the i/o bits
into interface generic enough to cover the needs, move libgcov into its
own directory (just like libgcc is these days) and add an configury option
that sets the interface.  The kernel's interface can then be implemented
in a single file instead of tons of ifdefs and I guess can sit either in kernel
or gcc tree...

Honza
> 
> Rong will have more explanation on the design.
> 
> Thanks,
> 
> David
> 
> 
> > BTW, these parts of LIPO:
> >
> >> +      if (!is_kernel_build)
> >> +        DECL_TLS_MODEL (dc_gcov_type_ptr_var) =
> >> +         decl_default_tls_model (dc_gcov_type_ptr_var);
> >>
> >>       dc_void_ptr_var =
> >>        build_decl (UNKNOWN_LOCATION, VAR_DECL,
> >> @@ -1488,8 +1493,9 @@
> >>                    ptr_void);
> >>       DECL_ARTIFICIAL (dc_void_ptr_var) = 1;
> >>       DECL_EXTERNAL (dc_void_ptr_var) = 1;
> >> -      DECL_TLS_MODEL (dc_void_ptr_var) =
> >> -       decl_default_tls_model (dc_void_ptr_var);
> >> +      if (!is_kernel_build)
> >> +        DECL_TLS_MODEL (dc_void_ptr_var) =
> >> +         decl_default_tls_model (dc_void_ptr_var);
> >
> > Probably are missing a !targetm.have_tls.
> >
> > Paolo
> >


Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler

2011-05-15 Thread Janne Blomqvist
Hi,

so, here is take 3 (sigh). Compared to take 2, it no longer uses
stdio, since opening a stdio FILE stream probably malloc()'s a buffer,
which is not async-signal-safe.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2011-05-15  Janne Blomqvist  

PR libfortran/48931
* configure.ac: Check for backtrace_symbols_fd instead of
backtrace_symbols, check for readlink.
* config.h.in: Regenerated.
* configure: Regenerated.
* runtime/backtrace.c (local_strcasestr): Remove.
(bt_header): New function.
(dump_glibc_backtrace): Remove.
(fd_gets): New function.
(show_backtrace): Rework to use backtrace_symbols_fd and pipes,
reformat output.
* runtime/main.c (store_exe_path): Try to check /proc/self/exe
first.



-- 
Janne Blomqvist
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index cf38fb0..74cfe44 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -264,10 +264,10 @@ AC_CHECK_FUNCS(sleep time ttyname signal alarm clock access fork execl)
 AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
 AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
 AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r)
-AC_CHECK_FUNCS(clock_gettime strftime)
+AC_CHECK_FUNCS(clock_gettime strftime readlink)
 
 # Check for glibc backtrace functions
-AC_CHECK_FUNCS(backtrace backtrace_symbols)
+AC_CHECK_FUNCS(backtrace backtrace_symbols_fd)
 
 # Check libc for getgid, getpid, getuid
 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 10917d3..04246a9 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -54,59 +54,57 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define CAN_FORK (defined(HAVE_FORK) && defined(HAVE_EXECVP) \
 		  && defined(HAVE_WAIT))
 #define GLIBC_BACKTRACE (defined(HAVE_BACKTRACE) \
-			 && defined(HAVE_BACKTRACE_SYMBOLS))
+			 && defined(HAVE_BACKTRACE_SYMBOLS_FD))
 #define CAN_PIPE (CAN_FORK && defined(HAVE_PIPE) \
 		  && defined(HAVE_DUP2) && defined(HAVE_FDOPEN) \
 		  && defined(HAVE_CLOSE))
 
 
-#if GLIBC_BACKTRACE && CAN_PIPE
-static char *
-local_strcasestr (const char *s1, const char *s2)
-{
-#ifdef HAVE_STRCASESTR
-  return strcasestr (s1, s2);
-#else
+/* GDB style #NUM index for each stack frame.  */
 
-  const char *p = s1;
-  const size_t len = strlen (s2);
-  const char u = *s2, v = isupper((int) *s2) ? tolower((int) *s2)
-  : (islower((int) *s2) ? toupper((int) *s2)
-			: *s2);
-
-  while (1)
-{
-  while (*p != u && *p != v && *p)
-	p++;
-  if (*p == 0)
-	return NULL;
-  if (strncasecmp (p, s2, len) == 0)
-	return (char *)p;
-}
-#endif
+static void 
+bt_header (int num)
+{
+  st_printf ("  #%d  ", num);
 }
-#endif
 
 
-#if GLIBC_BACKTRACE
-static void
-dump_glibc_backtrace (int depth, char *str[])
-{
-  int i;
+/* fgets()-like function that reads a line from a fd, without
+   needing to malloc() a buffer, and does not use locks, hence should
+   be async-signal-safe.  */
 
-  for (i = 0; i < depth; i++)
+static char *
+fd_gets (char *s, int size, int fd)
+{
+  for (int i = 0; i < size; i++)
 {
-  estr_write ("  + ");
-  estr_write (str[i]);
-  estr_write ("\n");
+  char c;
+  ssize_t nread = read (fd, &c, 1);
+  if (nread == 1)
+	{
+	  s[i] = c;
+	  if (c == '\n')
+	{
+	  if (i + 1 < size)
+		s[i+1] = '\0';
+	  else
+		s[i] = '\0';
+	  break;
+	}
+	}
+  else
+	{
+	  s[i] = '\0';
+	  break;
+	}
 }
-
-  free (str);
+  return s;
 }
-#endif
+
 
 /* show_backtrace displays the backtrace, currently obtained by means of
the glibc backtrace* functions.  */
+
 void
 show_backtrace (void)
 {
@@ -116,176 +114,184 @@ show_backtrace (void)
 #define BUFSIZE 1024
 
   void *trace[DEPTH];
-  char **str;
   int depth;
 
   depth = backtrace (trace, DEPTH);
   if (depth <= 0)
 return;
 
-  str = backtrace_symbols (trace, depth);
-
 #if CAN_PIPE
 
-#ifndef STDIN_FILENO
-#define STDIN_FILENO 0
-#endif
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-#ifndef STDERR_FILENO
-#define STDERR_FILENO 2
-#endif
-
   /* We attempt to extract file and line information from addr2line.  */
   do
   {
 /* Local variables.  */
-int f[2], pid, line, i;
-FILE *output;
-char addr_buf[DEPTH][GFC_XTOA_BUF_SIZE], func[BUFSIZE], file[BUFSIZE];
+int f[2], pid, line, bt[2], inp[2];
+char addr_buf[GFC_XTOA_BUF_SIZE], func[BUFSIZE], file[BUFSIZE];
 char *p, *end;
-const char *addr[DEPTH];
 
-/* Write the list of addresses in hexadecimal format.  */
-for (i = 0; i < depth; i++)
-  addr[i] = gfc_xtoa ((GFC_UINTEGER_LARGEST) (intptr_t) trace[i], addr_buf[i],
-		  sizeof (addr_buf[i]));
+char *exe_path = full_exe_pat

[PING] 2 ARM patches

2011-05-15 Thread Carrot Wei
Hi

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01973.html
Use ldrd and strd to access two consecutive words

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00490.html
Compute attr length for thumb2 insns

thanks
Carrot


[C++ Patch] Restore the alphabetical for the "type traits" RIDs

2011-05-15 Thread Paolo Carlini

Hi,

just consistently handle the various "type traits" RIDs in alphabetical 
order (+ update the comments to mention the most recent ones). Tested 
x86_64-linux.


Ok for mainline?

Paolo.


/c-family
2011-05-15  Paolo Carlini  

* c-common.c (c_common_reswords): Reorder.
* c-common.h (rid): Likewise.

/cp
2011-05-15  Paolo Carlini  

* cxx-pretty-print.c: Update comment.
* semantics.c (trait_expr_value, finish_trait_expr):
Reorder the cases.
* parser.c (cp_parser_primary_expression): Likewise.
Index: c-family/c-common.c
===
--- c-family/c-common.c (revision 173769)
+++ c-family/c-common.c (working copy)
@@ -437,6 +437,10 @@ const struct c_common_resword c_common_reswords[]
   { "__has_trivial_copy", RID_HAS_TRIVIAL_COPY, D_CXXONLY },
   { "__has_trivial_destructor", RID_HAS_TRIVIAL_DESTRUCTOR, D_CXXONLY },
   { "__has_virtual_destructor", RID_HAS_VIRTUAL_DESTRUCTOR, D_CXXONLY },
+  { "__imag",  RID_IMAGPART,   0 },
+  { "__imag__",RID_IMAGPART,   0 },
+  { "__inline",RID_INLINE, 0 },
+  { "__inline__",  RID_INLINE, 0 },
   { "__int128",RID_INT128, 0 },
   { "__is_abstract",   RID_IS_ABSTRACT, D_CXXONLY },
   { "__is_base_of",RID_IS_BASE_OF, D_CXXONLY },
@@ -444,17 +448,12 @@ const struct c_common_resword c_common_reswords[]
   { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, D_CXXONLY },
   { "__is_empty",  RID_IS_EMPTY,   D_CXXONLY },
   { "__is_enum",   RID_IS_ENUM,D_CXXONLY },
+  { "__is_literal_type", RID_IS_LITERAL_TYPE, D_CXXONLY },
   { "__is_pod",RID_IS_POD, D_CXXONLY },
   { "__is_polymorphic",RID_IS_POLYMORPHIC, D_CXXONLY },
   { "__is_standard_layout", RID_IS_STD_LAYOUT, D_CXXONLY },
   { "__is_trivial", RID_IS_TRIVIAL, D_CXXONLY },
   { "__is_union",  RID_IS_UNION,   D_CXXONLY },
-  { "__is_literal_type", RID_IS_LITERAL_TYPE, D_CXXONLY },
-  { "__underlying_type", RID_UNDERLYING_TYPE, D_CXXONLY },
-  { "__imag",  RID_IMAGPART,   0 },
-  { "__imag__",RID_IMAGPART,   0 },
-  { "__inline",RID_INLINE, 0 },
-  { "__inline__",  RID_INLINE, 0 },
   { "__label__",   RID_LABEL,  0 },
   { "__null",  RID_NULL,   0 },
   { "__real",  RID_REALPART,   0 },
@@ -466,6 +465,7 @@ const struct c_common_resword c_common_reswords[]
   { "__thread",RID_THREAD, 0 },
   { "__typeof",RID_TYPEOF, 0 },
   { "__typeof__",  RID_TYPEOF, 0 },
+  { "__underlying_type", RID_UNDERLYING_TYPE, D_CXXONLY },
   { "__volatile",  RID_VOLATILE,   0 },
   { "__volatile__",RID_VOLATILE,   0 },
   { "alignof", RID_ALIGNOF,D_CXXONLY | D_CXX0X | D_CXXWARN },
Index: c-family/c-common.h
===
--- c-family/c-common.h (revision 173769)
+++ c-family/c-common.h (working copy)
@@ -135,9 +135,9 @@ enum rid
   RID_IS_ABSTRACT, RID_IS_BASE_OF,
   RID_IS_CONVERTIBLE_TO,   RID_IS_CLASS,
   RID_IS_EMPTY,RID_IS_ENUM,
-  RID_IS_POD,  RID_IS_POLYMORPHIC,
-  RID_IS_STD_LAYOUT,   RID_IS_TRIVIAL,
-  RID_IS_UNION,RID_IS_LITERAL_TYPE,
+  RID_IS_LITERAL_TYPE, RID_IS_POD,
+  RID_IS_POLYMORPHIC,  RID_IS_STD_LAYOUT,
+  RID_IS_TRIVIAL,  RID_IS_UNION,
   RID_UNDERLYING_TYPE,
 
   /* C++0x */
Index: cp/cxx-pretty-print.c
===
--- cp/cxx-pretty-print.c   (revision 173769)
+++ cp/cxx-pretty-print.c   (working copy)
@@ -394,8 +394,11 @@ pp_cxx_id_expression (cxx_pretty_printer *pp, tree
  __is_convertible_to ( type-id , type-id ) 
  __is_empty ( type-id )
  __is_enum ( type-id )
+ __is_literal_type ( type-id )
  __is_pod ( type-id )
  __is_polymorphic ( type-id )
+ __is_std_layout ( type-id )
+ __is_trivial ( type-id )
  __is_union ( type-id )  */
 
 static void
Index: cp/semantics.c
===
--- cp/semantics.c  (revision 173769)
+++ cp/semantics.c  (working copy)
@@ -5165,6 +5165,9 @@ trait_expr_value (cp_trait_kind kind, tree type1,
 case CPTK_IS_ENUM:
   return (type_code1 == ENUMERAL_TYPE);
 
+case CPTK_IS_LITERAL_TYPE:
+  return (literal_type_p (type1));
+
 case CPTK_IS_POD:
   return (pod_type_p (type1));
 
@@ -5180,9 +5183,6 @@ trait_expr_value (cp_trait_kind kind, tree type1,
 case CPTK_IS_UNION:
   return (type_code1 == UNION_TYPE);
 
-case CPTK_IS_LITERAL_TYPE:
-  return (literal_type_p (type1));
-
 default:
   gcc_unreachable ();
   return false;
@@ -5227,11 +5227,11 @@ finish_trait_expr (cp_trait_kind kind, tree type1,
  || kind == CPTK_IS_CONVERTIBLE_TO

[PATCH] Fix error: 'previous' may be used uninitialized in this function

2011-05-15 Thread Dmitry Gorbachev
2011-05-15  Dmitry Gorbachev  

* gengtype-state.c (read_state_param_structs): Initialize "previous".

--- gcc/gengtype-state.c
+++ gcc/gengtype-state.c
@@ -2137,7 +2137,7 @@ read_state_param_structs (type_p *param_structs)
   int nbparamstructs = 0;
   int countparamstructs = 0;
   type_p head = NULL;
-  type_p previous;
+  type_p previous = NULL;
   type_p tmp;
   struct state_token_st *t0 = peek_state_token (0);
   struct state_token_st *t1 = peek_state_token (1);


Re: [patch gimplifier]: Make sure TRUTH_NOT_EXPR has boolean_type_node type and argument

2011-05-15 Thread Eric Botcazou
> Well, I mean by artificial here, that gimplification is done via
> gimplify_expr API. As FE and ME have here different assumptions.  The
> ME uses internally most boolean_type_node and IMHO it should be the
> variant used there. As this conversation to a single boolean_type
> (with recast to result FE's boolean type on demand) has some
> advantages on optimization passes.  Additionally it simplifies logic
> in passes on types.  For example there are some expressions, which are
> in general unexpected in ME as they are transformed in gimplification
> (like TRUTH_ANDIF/ORIF_EXPR).  By adding tree manual, you might cause
> the same issue as for the logical-expression showing up now.

OK, then that's definitely not the case for Ada, so the comment is incorrect.

> Well, this patch might be an alternative, but I see here potential
> issues in such none-gimplified expressions for comparision and logical
> not, which not necessariily have BOOLEAN_TYPE.  See here the code for
> fold_truth_not (and some other places) in fold-const.  So I think, as
> long as we have here external gimplication it is more save to check
> just for integral-kind.

Note that, even without "external gimplication", we still have integral types 
down to the tree-cfg.c check.  Take ACATS c52103x at -O0.  The Ada FE hands 
over a valid TRUTH_AND_EXPR, i.e. (BOOLEAN_TYPE, BOOLEAN_TYPE, BOOLEAN_TYPE) 
but the gimplifier builds a (BOOLEAN_TYPE, INTEGER_TYPE, BOOLEAN_TYPE) as it 
strips, then adds, then re-strips a cast to BOOLEAN_TYPE in gimplify_expr.

-- 
Eric Botcazou


Re: Cgraph thunk reorg

2011-05-15 Thread H.J. Lu
On Fri, May 6, 2011 at 4:02 PM, Jan Hubicka  wrote:
> Hi,
> given that the patch has received feedback and I have weekend for fixing the
> fallout, I decided to commit the following version today.  It contains fix in
> visibility handling of thunks that has shown in Mozilla build.
>
>
>        * cgraph.c (cgraph_add_thunk): Create real function node instead
>        of alias node; finalize it and mark needed/reachale; arrange visibility
>        to be right and add it into the corresponding same comdat group list.
>        (dump_cgraph_node): Dump thunks.
>        * cgraph.h (cgraph_first_defined_function, 
> cgraph_next_defined_function,
>        cgraph_function_with_gimple_body_p, 
> cgraph_first_function_with_gimple_body,
>        cgraph_next_function_with_gimple_body): New functions.
>        (FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, FOR_EACH_DEFINED_FUNCTION):
>        New macros.
>        * ipa-cp.c (ipcp_need_redirect_p): Thunks can't be redirected.
>        (ipcp_generate_summary): Use FOR_EACH_FUNCTION_WITH_GIMPLE_BODY.
>        * cgraphunit.c (cgraph_finalize_function): Only look into possible
>        devirtualization when optimizing.
>        (verify_cgraph_node): Verify thunks.
>        (cgraph_analyze_function): Analyze thunks.
>        (cgraph_mark_functions_to_output): Output thunks only in combination
>        with function they are assigned to.
>        (assemble_thunk): Turn thunk into non-thunk; don't try to turn
>        alias into normal node.
>        (assemble_thunks): New functoin.
>        (cgraph_expand_function): Use it.
>        * lto-cgraph.c (lto_output_node): Stream thunks.
>        (input_overwrite_node): Stream in thunks.
>        * ipa-pure-const.c (analyze_function): Thunks do nothing interesting.
>        * lto-streamer-out.c (lto_output): Do not try to output thunk's body.
>        * ipa-inline.c (inline_small_functions): Use FOR_EACH_DEFINED_FUNCTION.
>        * ipa-inline-analysis.c (compute_inline_parameters): "Analyze" thunks.
>        (inline_analyze_function): Do not care about thunk jump functions.
>        (inline_generate_summary):Use FOR_EACH_DEFINED_FUNCTION.
>        * ipa-prop.c (ipa_prop_write_jump_functions): Use 
> cgraph_function_with_gimple_body_p.
>        * passes.c (do_per_function_toporder): Use 
> cgraph_function_with_gimple_body_p.
>        (execute_one_pass);Use FOR_EACH_FUNCTION_WITH_GIMPLE_BODY.
>        (ipa_write_summaries): Use cgraph_function_with_gimple_body_p.
>        (function_called_by_processed_nodes_p): Likewise.
>
>        * lto.c (lto_materialize_function): Use 
> cgraph_function_with_gimple_body_p.
>        (add_cgraph_node_to_partition): Do not re-add items to partition; 
> handle thunks.
>        (add_varpool_node_to_partition): Do not re-add items to partition.

This caused:

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


H.J.


[PATCH, i386]: Simplify movdf_internal insn condition a bit

2011-05-15 Thread Uros Bizjak
Hello!

optimize_size clears TARGET_INTEGER_DFMODE_MOVES, so we can simplify
movdf_internal insn condition a bit.

2011-05-15  Uros Bizjak  

* config/i386/i386.md (*movdf_internal): Simplify insn condition.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.

Index: config/i386/i386.md
===
--- config/i386/i386.md (revision 173771)
+++ config/i386/i386.md (working copy)
@@ -3050,15 +3050,14 @@
&& (!can_create_pseudo_p ()
|| (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)
|| GET_CODE (operands[1]) != CONST_DOUBLE
-   || (optimize_function_for_size_p (cfun)
+   || (!TARGET_INTEGER_DFMODE_MOVES
   && ((!(TARGET_SSE2 && TARGET_SSE_MATH)
&& standard_80387_constant_p (operands[1]) > 0)
   || (TARGET_SSE2 && TARGET_SSE_MATH
   && standard_sse_constant_p (operands[1])))
   && !memory_operand (operands[0], DFmode))
|| ((TARGET_INTEGER_DFMODE_MOVES
-   || (optimize_function_for_size_p (cfun)
-   && !TARGET_MEMORY_MISMATCH_STALL))
+   || !TARGET_MEMORY_MISMATCH_STALL)
   && memory_operand (operands[0], DFmode)))"
 {
   switch (which_alternative)


[v3] Add _GLIBCXX_NOEXCEPT, use it in

2011-05-15 Thread Paolo Carlini

Hi,

let's noexcept-ify ;) Tested x86_64-linux, committed.

Paolo.

/
2011-05-15  Paolo Carlini  

* include/bits/c++config (_GLIBCXX_NOEXCEPT, _GLIBCXX_USE_NOEXCEPT):
Add.
* include/std/limits: Use the latter everywhere.
(numeric_limits, numeric_limits): Simplify
macro usages, the specializations exist only in C++0x mode.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error
line number.
Index: include/std/limits
===
--- include/std/limits  (revision 173773)
+++ include/std/limits  (working copy)
@@ -1,7 +1,7 @@
 // The template and inlines for the numeric_limits classes. -*- C++ -*-
 
 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-// 2008, 2009, 2010  Free Software Foundation, Inc.
+// 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -306,47 +306,47 @@
   /** The minimum finite value, or for floating types with
  denormalization, the minimum positive normalized value.  */
   static _GLIBCXX_CONSTEXPR _Tp
-  min() throw() { return static_cast<_Tp>(0); }
+  min() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The maximum finite value.  */
   static _GLIBCXX_CONSTEXPR _Tp
-  max() throw() { return static_cast<_Tp>(0); }
+  max() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
   /** A finite value x such that there is no other finite value y
*  where y < x.  */
   static constexpr _Tp
-  lowest() throw() { return static_cast<_Tp>(0); }
+  lowest() noexcept { return static_cast<_Tp>(0); }
 #endif
 
   /** The @e machine @e epsilon:  the difference between 1 and the least
  value greater than 1 that is representable.  */
   static _GLIBCXX_CONSTEXPR _Tp
-  epsilon() throw() { return static_cast<_Tp>(0); }
+  epsilon() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The maximum rounding error measurement (see LIA-1).  */
   static _GLIBCXX_CONSTEXPR _Tp
-  round_error() throw() { return static_cast<_Tp>(0); }
+  round_error() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The representation of positive infinity, if @c has_infinity.  */
   static _GLIBCXX_CONSTEXPR _Tp
-  infinity() throw()  { return static_cast<_Tp>(0); }
+  infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The representation of a quiet Not a Number,
  if @c has_quiet_NaN. */
   static _GLIBCXX_CONSTEXPR _Tp
-  quiet_NaN() throw() { return static_cast<_Tp>(0); }
+  quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The representation of a signaling Not a Number, if
  @c has_signaling_NaN. */
   static _GLIBCXX_CONSTEXPR _Tp
-  signaling_NaN() throw() { return static_cast<_Tp>(0); }
+  signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 
   /** The minimum positive denormalized value.  For types where
  @c has_denorm is false, this is the minimum positive normalized
  value.  */
   static _GLIBCXX_CONSTEXPR _Tp
-  denorm_min() throw() { return static_cast<_Tp>(0); }
+  denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<_Tp>(0); }
 };
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -373,14 +373,14 @@
   static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
 
   static _GLIBCXX_CONSTEXPR bool 
-  min() throw() { return false; }
+  min() _GLIBCXX_USE_NOEXCEPT { return false; }
 
   static _GLIBCXX_CONSTEXPR bool 
-  max() throw()  { return true; }
+  max() _GLIBCXX_USE_NOEXCEPT { return true; }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
   static constexpr bool
-  lowest() throw() { return min(); }
+  lowest() noexcept { return min(); }
 #endif
   static _GLIBCXX_USE_CONSTEXPR int digits = 1;
   static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
@@ -393,10 +393,10 @@
   static _GLIBCXX_USE_CONSTEXPR int radix = 2;
 
   static _GLIBCXX_CONSTEXPR bool 
-  epsilon() throw() { return false; }
+  epsilon() _GLIBCXX_USE_NOEXCEPT { return false; }
 
   static _GLIBCXX_CONSTEXPR bool 
-  round_error() throw() { return false; }
+  round_error() _GLIBCXX_USE_NOEXCEPT { return false; }
 
   static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
   static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
@@ -411,16 +411,16 @@
   static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
 
   static _GLIBCXX_CONSTEXPR bool 
-  infinity() throw() { return false; }
+  infinity() _GLIBCXX_USE_NOEXCEPT { return false; }
 
   static _GLIBCXX_CONSTEXPR bool 
-  quiet_NaN() throw() { return false; }

Re: [PR testsuite/47013] Fix SMS testsuite faliures

2011-05-15 Thread Dominique Dhumieres
> The attached patch fixes SMS testsuite failures seen on PowerPC and SPU.

On powerpc-apple-darwin9 the patch fixes all the SMS failures but for

FAIL: gcc.dg/sms-8.c scan-rtl-dump-times sms "SMS loop with subreg in lhs" 1

with -m64. Also tested on x86_64-apple-darwin10 without regression.

Thanks for the patch.

Dominique


[PATCH, i386]: standard_80387_constant_p can return negative values

2011-05-15 Thread Uros Bizjak
Hello!

2011-05-15  Uros Bizjak  

* config/i386/i386.md (floating point move splitters): Fix
usage of standard_80387_constant_p.
* config/i386/i386.c (ix86_preferred_reload_class): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
Index: i386.md
===
--- i386.md (revision 173773)
+++ i386.md (working copy)
@@ -3315,7 +3315,7 @@
 }
   else if (FP_REG_P (r))
 {
-  if (!standard_80387_constant_p (c))
+  if (standard_80387_constant_p (c) < 1)
FAIL;
 }
   else if (MMX_REG_P (r))
@@ -3347,7 +3347,7 @@
 }
   else if (FP_REG_P (r))
 {
-  if (!standard_80387_constant_p (c))
+  if (standard_80387_constant_p (c) < 1)
FAIL;
 }
   else if (MMX_REG_P (r))
Index: i386.c
===
--- i386.c  (revision 173771)
+++ i386.c  (working copy)
@@ -28489,7 +28489,7 @@ ix86_preferred_reload_class (rtx x, reg_
 zero above.  We only want to wind up preferring 80387 registers if
 we plan on doing computation with them.  */
   if (TARGET_80387
- && standard_80387_constant_p (x))
+ && standard_80387_constant_p (x) > 0)
{
  /* Limit class to non-sse.  */
  if (regclass == FLOAT_SSE_REGS)


Re: [patch gimplifier]: Make sure TRUTH_NOT_EXPR has boolean_type_node type and argument

2011-05-15 Thread Kai Tietz
2011/5/15 Eric Botcazou :
>> Well, I mean by artificial here, that gimplification is done via
>> gimplify_expr API. As FE and ME have here different assumptions.  The
>> ME uses internally most boolean_type_node and IMHO it should be the
>> variant used there. As this conversation to a single boolean_type
>> (with recast to result FE's boolean type on demand) has some
>> advantages on optimization passes.  Additionally it simplifies logic
>> in passes on types.  For example there are some expressions, which are
>> in general unexpected in ME as they are transformed in gimplification
>> (like TRUTH_ANDIF/ORIF_EXPR).  By adding tree manual, you might cause
>> the same issue as for the logical-expression showing up now.
>
> OK, then that's definitely not the case for Ada, so the comment is incorrect.

Yes, I will adjust comment here about ADA. Code for ADA looks sane.
Just one nit I saw in trans.c, which might be a cause here.

>> Well, this patch might be an alternative, but I see here potential
>> issues in such none-gimplified expressions for comparision and logical
>> not, which not necessariily have BOOLEAN_TYPE.  See here the code for
>> fold_truth_not (and some other places) in fold-const.  So I think, as
>> long as we have here external gimplication it is more save to check
>> just for integral-kind.
>
> Note that, even without "external gimplication", we still have integral types
> down to the tree-cfg.c check.  Take ACATS c52103x at -O0.  The Ada FE hands
> over a valid TRUTH_AND_EXPR, i.e. (BOOLEAN_TYPE, BOOLEAN_TYPE, BOOLEAN_TYPE)
> but the gimplifier builds a (BOOLEAN_TYPE, INTEGER_TYPE, BOOLEAN_TYPE) as it
> strips, then adds, then re-strips a cast to BOOLEAN_TYPE in gimplify_expr.

With this patch (which would describe why it gimplifier sees
integer-type nodes here):

Index: gcc/gcc/ada/gcc-interface/trans.c
===
--- gcc.orig/gcc/ada/gcc-interface/trans.c  2011-05-12
20:06:01.0 +0200
+++ gcc/gcc/ada/gcc-interface/trans.c   2011-05-15 15:33:32.305516200 +0200
@@ -7101,7 +7110,7 @@ convert_with_check (Entity_Id gnat_type,
 {
   /* Ensure GNU_EXPR only gets evaluated once.  */
   tree gnu_input = gnat_protect_expr (gnu_result);
-  tree gnu_cond = integer_zero_node;
+  tree gnu_cond = boolean_false_node;
   tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);
   tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);
   tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);

I was able to do a bootstrap for ada and run 'make check-ada' without
seeing gimplification errors.

The only failure I see in testrun is 'cxg2001.adb' test with 'GCC
error: in compensate_edge, at reg-stach.c:2781' Error detect around
cxg2001.adb:322:5.  But well, this bug seems to me unrelated here to
gimplication. But maybe I am wrong here.

Regards,
Kai


Re: [patch gimplifier]: Make sure TRUTH_NOT_EXPR has boolean_type_node type and argument

2011-05-15 Thread Kai Tietz
2011/5/15 Kai Tietz :
> 2011/5/15 Eric Botcazou :
>>> Well, I mean by artificial here, that gimplification is done via
>>> gimplify_expr API. As FE and ME have here different assumptions.  The
>>> ME uses internally most boolean_type_node and IMHO it should be the
>>> variant used there. As this conversation to a single boolean_type
>>> (with recast to result FE's boolean type on demand) has some
>>> advantages on optimization passes.  Additionally it simplifies logic
>>> in passes on types.  For example there are some expressions, which are
>>> in general unexpected in ME as they are transformed in gimplification
>>> (like TRUTH_ANDIF/ORIF_EXPR).  By adding tree manual, you might cause
>>> the same issue as for the logical-expression showing up now.
>>
>> OK, then that's definitely not the case for Ada, so the comment is incorrect.
>
> Yes, I will adjust comment here about ADA. Code for ADA looks sane.
> Just one nit I saw in trans.c, which might be a cause here.
>
>>> Well, this patch might be an alternative, but I see here potential
>>> issues in such none-gimplified expressions for comparision and logical
>>> not, which not necessariily have BOOLEAN_TYPE.  See here the code for
>>> fold_truth_not (and some other places) in fold-const.  So I think, as
>>> long as we have here external gimplication it is more save to check
>>> just for integral-kind.
>>
>> Note that, even without "external gimplication", we still have integral types
>> down to the tree-cfg.c check.  Take ACATS c52103x at -O0.  The Ada FE hands
>> over a valid TRUTH_AND_EXPR, i.e. (BOOLEAN_TYPE, BOOLEAN_TYPE, BOOLEAN_TYPE)
>> but the gimplifier builds a (BOOLEAN_TYPE, INTEGER_TYPE, BOOLEAN_TYPE) as it
>> strips, then adds, then re-strips a cast to BOOLEAN_TYPE in gimplify_expr.
>
> With this patch (which would describe why it gimplifier sees
> integer-type nodes here):
>
> Index: gcc/gcc/ada/gcc-interface/trans.c
> ===
> --- gcc.orig/gcc/ada/gcc-interface/trans.c      2011-05-12
> 20:06:01.0 +0200
> +++ gcc/gcc/ada/gcc-interface/trans.c   2011-05-15 15:33:32.305516200 +0200
> @@ -7101,7 +7110,7 @@ convert_with_check (Entity_Id gnat_type,
>     {
>       /* Ensure GNU_EXPR only gets evaluated once.  */
>       tree gnu_input = gnat_protect_expr (gnu_result);
> -      tree gnu_cond = integer_zero_node;
> +      tree gnu_cond = boolean_false_node;
>       tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);
>       tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);
>       tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);
>
> I was able to do a bootstrap for ada and run 'make check-ada' without
> seeing gimplification errors.
>
> The only failure I see in testrun is 'cxg2001.adb' test with 'GCC
> error: in compensate_edge, at reg-stach.c:2781' Error detect around
> cxg2001.adb:322:5.  But well, this bug seems to me unrelated here to
> gimplication. But maybe I am wrong here.
>
> Regards,
> Kai

PS: There are more places to fix, I will sent tomorrow a full patch
for this after bootstrap and testsuite-run was completetly successful.
 I saw in later gnat.dg the described error (but no more the truth-not
issue). So I was a bit to early to post here.

Regards,
Kai


[Patch, Fortran] Implement/fix cobounds for scalar coarrays on tree level

2011-05-15 Thread Tobias Burnus
The patch is a follow-up to the patch at 
http://gcc.gnu.org/ml/fortran/2011-05/msg00067.html. With that patch, 
all* my coarray example compile (and run with -fcoarray=single or 
-fcoarray=lib -lcaf_single).


Build and regtested on x86-64-linux with two regtest failures: (a) The 
never workinggfortran.dg/realloc_on_assign_5.f03 (PRs fortran/47674 and 
48438), (b) gfortran.dg/lto/pr46036 (PR middle-end/48989).


OK for the trunk?

Tobias

* Well no rule without exception: Scalar coarrays are not yet supported. 
Neither are polymorphic coarrays, but those probably do not need decl 
changes.


PS: Short-term coarray plans (next couple of weeks): Fixing some simpler 
FE bugs, supporting MPI in the test suite (caf.exp) - and working a bit 
on registering calls for coarrays.
2011-06-16  Tobias Burnus  

	PR fortran/18918
	* trans-types.c (gfc_get_element_type): Handle scalar coarrays.
	(gfc_get_nodesc_array_type): Make a variant-type copy for scalar
	coarrays.
	* trans.c (gfc_build_array_ref): Return original type not variant
	copy for scalar coarrays.
	* trans-array.c (gfc_conv_array_ref): Ditto.

2011-06-16  Tobias Burnus  

	PR fortran/18918
	* gfortran.dg/coarray_21.f90: New.

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 1a4ab39..78d65a6 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2621,7 +2621,12 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
   gfc_se tmpse;
 
   if (ar->dimen == 0)
-return;
+{
+  gcc_assert (ar->codimen);
+  /* Use the actual tree type and not the wrapped coarray. */
+  se->expr = fold_convert (TREE_TYPE (TREE_TYPE (se->expr)), se->expr);
+  return;
+}
 
   /* Handle scalarized references separately.  */
   if (ar->type != AR_ELEMENT)
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 24fdcf3..1165926 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1100,8 +1100,16 @@ gfc_get_element_type (tree type)
 {
   if (TREE_CODE (type) == POINTER_TYPE)
 type = TREE_TYPE (type);
-  gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
-  element = TREE_TYPE (type);
+  if (GFC_TYPE_ARRAY_RANK (type) == 0)
+	{
+	  gcc_assert (GFC_TYPE_ARRAY_CORANK (type) > 0);
+	  element = type;
+	}
+  else
+	{
+	  gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
+	  element = TREE_TYPE (type);
+	}
 }
   else
 {
@@ -1412,7 +1420,13 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
   /* We don't use build_array_type because this does not include include
  lang-specific information (i.e. the bounds of the array) when checking
  for duplicates.  */
-  type = make_node (ARRAY_TYPE);
+  if (as->rank)
+type = make_node (ARRAY_TYPE);
+  else
+{
+  type = build_variant_type_copy (etype);
+  TREE_TYPE (type) = etype;
+}
 
   GFC_ARRAY_TYPE_P (type) = 1;
   TYPE_LANG_SPECIFIC (type)
@@ -1526,6 +1540,23 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
   build_qualified_type (GFC_TYPE_ARRAY_DATAPTR_TYPE (type),
 			TYPE_QUAL_RESTRICT);
 
+  if (as->rank == 0)
+{
+  if (packed != PACKED_STATIC)
+	type = build_pointer_type (type);
+
+  if (restricted)
+type = build_qualified_type (type, TYPE_QUAL_RESTRICT);	
+
+  if (packed != PACKED_STATIC)
+	{
+	  GFC_ARRAY_TYPE_P (type) = 1;
+	  TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type)); 
+	}
+
+  return type;
+}
+
   if (known_stride)
 {
   mpz_sub_ui (stride, stride, 1);
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 1d25cb0..fcbb850 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -316,6 +316,13 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
   tree type = TREE_TYPE (base);
   tree tmp;
 
+  if (GFC_ARRAY_TYPE_P (type) && GFC_TYPE_ARRAY_RANK (type) == 0)
+{
+  gcc_assert (GFC_TYPE_ARRAY_CORANK (type) > 0);
+
+  return fold_convert (TREE_TYPE (type), base);
+}
+
   gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
   type = TREE_TYPE (type);
 
--- /dev/null	2011-05-15 08:03:38.907894364 +0200
+++ gcc/gcc/testsuite/gfortran.dg/coarray_21.f90	2011-05-15 23:41:43.0 +0200
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! PR fortran/18918
+!
+! Before scalar coarrays weren't regarded as scalar in the ME.
+!
+module mod_reduction
+  real :: g[*]
+contains
+  subroutine caf_reduce(x)
+real, intent(in) :: x
+   g = x  ! << used to ICE
+  end
+end module
+
+program test
+  integer, parameter :: size = 4000
+  type :: pct
+integer, allocatable :: data(:,:)
+  end type
+  type(pct) :: picture[*]
+ allocate(picture%data(size, size))
+end program test
+
+
+! { dg-final { cleanup-modules "mod_reduction" } }


Re: [patch gimplifier]: Make sure TRUTH_NOT_EXPR has boolean_type_node type and argument

2011-05-15 Thread Eric Botcazou
> With this patch (which would describe why it gimplifier sees
> integer-type nodes here):
>
> Index: gcc/gcc/ada/gcc-interface/trans.c
> ===
> --- gcc.orig/gcc/ada/gcc-interface/trans.c  2011-05-12
> 20:06:01.0 +0200
> +++ gcc/gcc/ada/gcc-interface/trans.c   2011-05-15 15:33:32.305516200 +0200
> @@ -7101,7 +7110,7 @@ convert_with_check (Entity_Id gnat_type,
>  {
>/* Ensure GNU_EXPR only gets evaluated once.  */
>tree gnu_input = gnat_protect_expr (gnu_result);
> -  tree gnu_cond = integer_zero_node;
> +  tree gnu_cond = boolean_false_node;
>tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);
>tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);
>tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);
>
> I was able to do a bootstrap for ada and run 'make check-ada' without
> seeing gimplification errors.

The patch is OK, but it doesn't change anything for c52103x as this is a pure 
gimplifier problem.  Try running ACATS at -O0:

Index: ada/acats/run_all.sh
===
--- ada/acats/run_all.sh(revision 173756)
+++ ada/acats/run_all.sh(working copy)
@@ -9,7 +9,7 @@
 # gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"
 # gnatflags="-gnatN"

-gccflags="-O2"
+gccflags=""
 gnatflags="-gnatws"

 target_run () {

and you'll see the failures.

> The only failure I see in testrun is 'cxg2001.adb' test with 'GCC
> error: in compensate_edge, at reg-stach.c:2781' Error detect around
> cxg2001.adb:322:5.  But well, this bug seems to me unrelated here to
> gimplication.

Yes, the cxg2001 failure is PR rtl-optimization/48633.

-- 
Eric Botcazou


Re: [patch gimplifier]: Make sure TRUTH_NOT_EXPR has boolean_type_node type and argument

2011-05-15 Thread Eric Botcazou
> The patch is OK, but it doesn't change anything for c52103x as this is a
> pure gimplifier problem.  Try running ACATS at -O0:

Or just compile the attached reduced testcase at -O0:

c52103x.adb: In function 'C52103X':
c52103x.adb:1:1: error: type mismatch in binary truth expression
boolean
system__unsigned_types__packed_byte
boolean
D.2363 = D.2361 && D.2362;

-- 
Eric Botcazou
PROCEDURE  C52103X  IS

BEGIN

CONSTR_ERR: -- THIS BLOCK CATCHES CONSTRAINT_ERROR
-- FOR THE TYPE DECLARATION.
 BEGIN

DCL_ARR:  DECLARE   -- THIS BLOCK DECLARES THE ARRAY TYPE

   TYPE  TA42  IS  ARRAY(
INTEGER RANGE -2..INTEGER'LAST
)  OF BOOLEAN ;
   -- CONSTRAINT_ERROR MAY BE RAISED BY THE
   -- ARRAY TYPE DECLARATION.
   PRAGMA PACK (TA42);

   SUBTYPE  TA41  IS  TA42 ;

  BEGIN

OBJ_DCL:   DECLARE   -- THIS BLOCK DECLARES TWO BOOLEAN ARRAYS THAT
 -- HAVE INTEGER'LAST + 3 COMPONENTS;
 -- STORAGE_ERROR MAY BE RAISED.
ARR41  :  TA41 ;
ARR42  :  TA42 ;

   BEGIN

DO_SLICE:  BEGIN
-- SLICE ASSIGNMENT:

ARR42(  -1..INTEGER'LAST  ) :=
 ARR41(
-2..INTEGER'LAST-1) ;

 CHK_SLICE: BEGIN
 FOR  I  IN  -1..2  LOOP

  IF  ARR42( I )  /=  FALSE  AND  I /= 0
  THEN
   raise Program_Error;
  ELSIF  ARR42( I ) /= TRUE  AND  I  = 0
  THEN
   raise Program_Error;
  END IF;

 END LOOP;

 IF  ARR42( -2 )  /=  TRUE
 THEN
raise Program_Error;
 END IF;

END CHK_SLICE;

   END DO_SLICE;

  END OBJ_DCL;

  END DCL_ARR;

 END CONSTR_ERR;


END C52103X;


Re: [patch] fix c++/48994

2011-05-15 Thread Jason Merrill

OK for trunk and 4.6.

Jason


Re: [C++ Patch] Restore the alphabetical for the "type traits" RIDs

2011-05-15 Thread Jason Merrill

OK.

Jason


[x32] PATCH: Put back mode on operand 1 in tls_global_dynamic_64 patterns.

2011-05-15 Thread H.J. Lu
Hi,

I checked in this patch to put back mode on operand 1 in
tls_global_dynamic_64 patterns.


H.J.
---
commit 6eddaa2187ccb80fe8515705778b5818033cfb2d
Author: H.J. Lu 
Date:   Fri May 13 10:35:16 2011 -0700

Rename tls_global_dynamic_64 to tls_global_dynamic_64_.

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 9426489..15da5cc 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,13 @@
+2011-05-13  H.J. Lu  
+
+   PR target/47715
+   * config/i386/i386.md (PTR64): New.
+   (*tls_global_dynamic_64): Rename to ...
+   (*tls_global_dynamic_64_): This.  Put PTR64 on operand 1.
+   (tls_global_dynamic_64): Rename to ...
+   (tls_global_dynamic_64_): This.  Put PTR64 on operand 1.
+   * config/i386/i386.c (legitimize_tls_address): Updated.
+
 2011-05-06  H.J. Lu  
 
* config/i386/i386.c (ix86_promote_function_mode): Handle NULL
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b89f558..2edde71 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12909,9 +12909,22 @@ legitimize_tls_address (rtx x, enum tls_model model, 
bool for_mov)
  if (TARGET_64BIT)
{
  rtx rax = gen_rtx_REG (Pmode, AX_REG), insns;
+ rtx (*tls_global_dynamic) (rtx, rtx, rtx);
+
+ switch (GET_MODE (x))
+   {
+   case SImode:
+ tls_global_dynamic = gen_tls_global_dynamic_64_si;
+ break;
+   case DImode:
+ tls_global_dynamic = gen_tls_global_dynamic_64_di;
+ break;
+   default:
+ gcc_unreachable ();
+   }
 
  start_sequence ();
- emit_call_insn (gen_tls_global_dynamic_64 (rax, x, caddr));
+ emit_call_insn (tls_global_dynamic (rax, x, caddr));
  insns = get_insns ();
  end_sequence ();
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 41bfe4e..ead5763 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -967,7 +967,9 @@
 ;; ptr_mode sized quantities.
 (define_mode_iterator PTR
   [(SI "ptr_mode == SImode") (DI "ptr_mode == DImode")])
-
+
+;; Pointer modes in 64bit.
+(define_mode_iterator PTR64 [(SI "TARGET_X32") DI])
 
 ;; Scheduling descriptions
 
@@ -12603,11 +12605,11 @@
  (clobber (match_scratch:SI 5 ""))
  (clobber (reg:CC FLAGS_REG))])])
 
-(define_insn "*tls_global_dynamic_64"
+(define_insn "*tls_global_dynamic_64_"
   [(set (match_operand:DI 0 "register_operand" "=a")
(call:DI (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
 (match_operand:DI 3 "" "")))
-   (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
+   (unspec:DI [(match_operand:PTR64 1 "tls_symbolic_operand" "")]
  UNSPEC_TLS_GD)]
   "TARGET_64BIT"
 {
@@ -12620,12 +12622,12 @@
(set (attr "length")
(symbol_ref "TARGET_X32 ? 15 : 16"))])
 
-(define_expand "tls_global_dynamic_64"
+(define_expand "tls_global_dynamic_64_"
   [(parallel [(set (match_operand:DI 0 "register_operand" "")
   (call:DI
 (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
 (const_int 0)))
- (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
+ (unspec:DI [(match_operand:PTR64 1 "tls_symbolic_operand" "")]
 UNSPEC_TLS_GD)])])
 
 (define_insn "*tls_local_dynamic_base_32_gnu"


Re: [patch] fix c++/48994

2011-05-15 Thread Jonathan Wakely
On 15 May 2011 23:19, Jason Merrill wrote:
> OK for trunk and 4.6.

The bug isn't present on the 4.6 branch and I'm not sure where the
change should go, if it's needed at all, so I've only committed it to
trunk.


Patch: New GTY ((atomic)) option

2011-05-15 Thread Nicola Pero
This patch adds a new GTY option, "atomic", which is similar to the identical 
option you have with Boehm GC
and which can be used with pointers to inform the GC/PCH machinery that they 
point to an area of memory that
contains no pointers (and hence needs no scanning).

The reason for adding this option is that, without it, it seems to be 
(surprisingly) impossible
to write code that keeps a GC pointer to a plain array of C stuff such as 
integers.  In my case,
I was experimenting with hash tables that can automatically cache hash values.  
So I needed a plain
C array to store the cached hash values, but found that it is currently 
unsupported by GC/PCH! :-(

That is, at the moment you can't have a struct such as the following one --

struct GTY(()) my_struct {
  ...
  unsigned int * some_ints;
  size_t count;
  ...
};

because gengtype rejects it with the error "field `(*x).some_ints' is pointer 
to unimplemented type".

This patch basically implements it, but at this stage requires you to 
explicitly tell gengtype that the
pointer is atomic (and that is safe for gengtype to ignore the memory it points 
to).  So, the following
now works as expected --

struct GTY(()) my_struct {
  ...
  unsigned int * GTY((atomic)) some_ints;
  size_t count;
  ...
};

A next, nice step would be to have gengtype automatically mark as "atomic" any 
pointers that gengtype can safely determine
point to an area of memory that never contains any pointers.  But that's 
slightly more complicated (eg, currently
gengtype makes no difference between "unsigned int" and "void", hence "unsigned 
int *" and "void *" would be treated
the same, while you'd want the first one to be automatically marked as atomic, 
and the second one to generate an error
as gengtype has no way to determine if it's atomic or not - unless it's 
explicitly marked as atomic of course), so for now
I haven't implemented it; it could be a follow-up patch (even after 
implementing it, the explicit "atomic" option
would remain useful for "void *" pointers and such like, so it's a good 
starting point).

Btw, there are a few existing pointers in GCC that could be marked as atomic, 
for example the field "su" of struct
function in function.h.  The advantage of marking them as atomic would be a 
slight speedup of the GC marking by saving
a function call each time one of these structs is being walked; I suspect that 
alone wouldn't make any visibile difference
in practice, but I haven't done any profiling or benchmarking to know for sure.

I have done some testing of this patch, and I want to do some more before I 
commit.  If anyone has good ideas on how
to perform throughout testing, they are welcome. :-)

Ok to commit ?

Thanks

PS: This patch does not include support for marking root/global variables with 
"atomic" (neither manually nor automatically);
only fields in a struct.  That would be useful too, but I'm leaving it for yet 
another patch.

2011-05-16  Nicola Pero  

* gengtype.c (walk_type): Implemented "atomic" GTY option.
* doc/gty.texi (GTY Options): Document "atomic" GTY option.

Index: doc/gty.texi
===
--- doc/gty.texi(revision 173768)
+++ doc/gty.texi(working copy)
@@ -383,6 +383,42 @@ could be calculated as follows:
   size_t size = sizeof (struct sorted_fields_type) + n * sizeof (tree);
 @end smallexample
 
+@findex atomic
+@item atomic
+
+The @code{atomic} option can only be used with pointers.  It informs
+the GC machinery that the memory that the pointer points to does not
+contain any pointers, and hence it should be treated by the GC and PCH
+machinery as an ``atomic'' block of memory that does not need to be
+examined.  In particular, the machinery will not scan that memory for
+pointers to mark them as reachable (when marking pointers for GC) or
+to relocate them (when writing a PCH file).
+
+The @code{atomic} option must be used with great care, because all
+sorts of problem can occur if used incorrectly, that is, if the memory
+the pointer points to does actually contain a pointer.
+
+Here is an example of how to use it:
+@smallexample
+struct GTY(()) my_struct @{
+  int number_of_elements;
+  unsigned int GTY ((atomic)) * elements;
+@};
+@end smallexample
+In this case, @code{elements} is a pointer under GC, and the memory it
+points to needs to be allocated using the Garbage Collector, and will
+be freed automatically by the Garbage Collector when it is no longer
+referenced.  But the memory that the pointer points to is an array of
+@code{unsigned int} elements, and the GC does not need, and indeed
+must not, try to scan it to find pointers to mark or relocate, which
+is why it is marked with the @code{atomic} option.
+
+Note that, currently, global variables can not be marked with
+@code{atomic}; only fields of a struct can.  This is a known
+limitation.  It would be useful to be able to mark global pointers
+with @code{atomic} to make the PCH

Re: Patch: New GTY ((atomic)) option

2011-05-15 Thread Gabriel Dos Reis
On Sun, May 15, 2011 at 7:13 PM, Nicola Pero
 wrote:
> This patch adds a new GTY option, "atomic", which is similar to the identical 
> option you have with Boehm GC
> and which can be used with pointers to inform the GC/PCH machinery that they 
> point to an area of memory that
[...]
> This patch basically implements it, but at this stage requires you to 
> explicitly tell gengtype that the
> pointer is atomic (and that is safe for gengtype to ignore the memory it 
> points to).

then should you not name the attribute "ignore"?

-- Gaby


Re: Patch: New GTY ((atomic)) option

2011-05-15 Thread Nathan Froyd
On 05/15/2011 08:49 PM, Gabriel Dos Reis wrote:
> On Sun, May 15, 2011 at 7:13 PM, Nicola Pero
>  wrote:
>> This patch adds a new GTY option, "atomic", which is similar to the 
>> identical option you have with Boehm GC
>> and which can be used with pointers to inform the GC/PCH machinery that they 
>> point to an area of memory that
> [...]
>> This patch basically implements it, but at this stage requires you to 
>> explicitly tell gengtype that the
>> pointer is atomic (and that is safe for gengtype to ignore the memory it 
>> points to).
> 
> then should you not name the attribute "ignore"?

Or even the existing attribute "skip"?

-Nathan



Re: Patch: New GTY ((atomic)) option

2011-05-15 Thread Gabriel Dos Reis
On Sun, May 15, 2011 at 7:52 PM, Nathan Froyd  wrote:
> On 05/15/2011 08:49 PM, Gabriel Dos Reis wrote:
>> On Sun, May 15, 2011 at 7:13 PM, Nicola Pero
>>  wrote:
>>> This patch adds a new GTY option, "atomic", which is similar to the 
>>> identical option you have with Boehm GC
>>> and which can be used with pointers to inform the GC/PCH machinery that 
>>> they point to an area of memory that
>> [...]
>>> This patch basically implements it, but at this stage requires you to 
>>> explicitly tell gengtype that the
>>> pointer is atomic (and that is safe for gengtype to ignore the memory it 
>>> points to).
>>
>> then should you not name the attribute "ignore"?
>
> Or even the existing attribute "skip"?

better, indeed. :-)

-- Gaby


Re: [patch] fix c++/48994

2011-05-15 Thread Jason Merrill

On 05/15/2011 07:07 PM, Jonathan Wakely wrote:

On 15 May 2011 23:19, Jason Merrill wrote:

OK for trunk and 4.6.


The bug isn't present on the 4.6 branch and I'm not sure where the
change should go, if it's needed at all, so I've only committed it to
trunk.


Ah, my mistake.  Sounds good.

Jason



[wwwdocs] Simplify markup for java/faq.html

2011-05-15 Thread Gerald Pfeifer
Per some other changes in the last couple of weeks.

It would be really, really good if one of you Java guys could go
through the FAQ and remove obsolete entries.  (Or just let me know
about any changes and I'll make them for you.)

Gerald


2011-05-15  Gerald Pfeifer  

* faq.html:  Use , not fake tables for section headers.

Index: faq.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/java/faq.html,v
retrieving revision 1.64
diff -u -r1.64 faq.html
--- faq.html10 Oct 2009 13:32:15 -  1.64
+++ faq.html16 May 2011 04:56:44 -
@@ -77,15 +77,9 @@
   
 
   
-  
- 
-   
-General Questions
-  
-
-  
-  
-  
+
+  General Questions
+
   1.1 What license is used for libgcj?
   
 
@@ -150,15 +144,8 @@
 
   
   
-  
- 
-   
-Java Feature Support
-  
-
-  
+  Java Feature Support
   
-  
   2.1 What Java API's are supported? How complete is 
 the support?

@@ -286,15 +273,8 @@
 
   
   
-  
- 
-   
-Build Issues
-  
-
-  
+  Build Issues
 
-   
   3.1 I need something more recent than the last 
release. 
   How should I build it?

@@ -366,15 +346,8 @@
   
 
 
-  
- 
-   
-Gcj Compile/Link Questions
-  
-
-  
+  Gcj Compile/Link Questions
  
-  
   4.1 Why do I get undefined reference to 
`main' 
 errors?

@@ -479,15 +452,8 @@
 
   
   
-  
- 
-   
-Runtime Questions
-  
-
-  
+  Runtime Questions
  
-  
   5.1 My program is dumping core! What's going 
on?
   
 
@@ -590,15 +556,8 @@
 
   
 
-  
- 
-   
-Programming Issues 
-  
-
-  
+  Programming Issues
 
-  
   6.1 Are there any examples of how to use CNI?
   
 


[PATCH, i386] PR 48743 Correctly detect AMD K6-2+ and K6-3+

2011-05-15 Thread Zuxy Meng
Misdetected as Athlon by GCC, K6-2+ and K6-3+ are processors that support 
extended 3DNow! but don't support extended MMX or CMOV.


I don't own a K6-2 or Athlon machine. Can anybody have the patch tested?

2011-05-16 Zuxy Meng 
PR i386/48743
* config/i386/cpuid.h (bit_MMXEXT): New
* config/i386/cpuid.h (bit_3DNOWP): Deleted
* config/i386/driver-i386.c (host_detect_local_cpu): Detect Athlon by the 
presence of extended MMX instead of extended 3DNow!


--
Zuxy 


k6-3+.diff
Description: Binary data


Re: [PR testsuite/47013] Fix SMS testsuite faliures

2011-05-15 Thread Revital Eres
Hello,

Thanks for testing the patch.

> FAIL: gcc.dg/sms-8.c scan-rtl-dump-times sms "SMS loop with subreg in lhs" 1

Does the attached patch resolve the failure with sms-8.c?
If so I'll re-submit it.

Thanks,
Revital
Index: testsuite/gcc.dg/sms-2.c
===
--- testsuite/gcc.dg/sms-2.c(revision 173659)
+++ testsuite/gcc.dg/sms-2.c(working copy)
@@ -4,12 +4,11 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms" } */
 
-
+int th, h, em, nlwm, nlwS, nlw, sy;
 void
 fun (nb)
  int nb;
 {
-  int th, h, em, nlwm, nlwS, nlw, sy;
 
   while (nb--)
 while (h--)
@@ -33,5 +32,5 @@ fun (nb)
   }
 }
 
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* 
powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS loop many exits" 1 "sms" { target 
spu-*-* powerpc*-*-* } } } */
 /* { dg-final { cleanup-rtl-dump "sms" } } */
Index: testsuite/gcc.dg/sms-6.c
===
--- testsuite/gcc.dg/sms-6.c(revision 173659)
+++ testsuite/gcc.dg/sms-6.c(working copy)
@@ -1,5 +1,7 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms  --param sms-min-sc=1 " } */
+/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms  -mno-update --param 
sms-min-sc=1 -fmodulo-sched-allow-regmoves " { target powerpc*-*-*} } */
+
 
 extern void abort (void);
 
Index: testsuite/gcc.dg/sms-3.c
===
--- testsuite/gcc.dg/sms-3.c(revision 173659)
+++ testsuite/gcc.dg/sms-3.c(working copy)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param 
sms-min-sc=1 -fmodulo-sched-allow-regmoves" } */
 
 extern void abort (void);
 
Index: testsuite/gcc.dg/sms-7.c
===
--- testsuite/gcc.dg/sms-7.c(revision 173659)
+++ testsuite/gcc.dg/sms-7.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms" } */
+/* { dg-options "-O3 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms 
-fmodulo-sched-allow-regmoves --param sms-min-sc=1" } */
+/* { dg-options "-O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms --param 
sms-min-sc=1 -mno-update -fmodulo-sched-allow-regmoves" { target powerpc*-*-*} 
} */
 
 extern void abort (void);
 
@@ -44,7 +45,7 @@ int main()
   return 0;
 }
 
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms"  { target spu-*-* 
} } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 2 "sms"  { target spu-*-* 
} } } */
 /* { dg-final { scan-rtl-dump-times "SMS succeeded" 3  "sms" { target 
powerpc*-*-* } } } */
 /* { dg-final { cleanup-rtl-dump "sms" } } */
 
Index: testsuite/gcc.dg/sms-4.c
===
--- testsuite/gcc.dg/sms-4.c(revision 173659)
+++ testsuite/gcc.dg/sms-4.c(working copy)
@@ -1,6 +1,7 @@
 /* Inspired from sbitmap_a_or_b_and_c_cg function in sbitmap.c.  */
 /* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms  " } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms --param sms-min-sc=1 -mno-update" { target powerpc*-*-*} } */
 
 extern void abort (void);
 
Index: testsuite/gcc.dg/sms-8.c
===
--- testsuite/gcc.dg/sms-8.c(revision 173659)
+++ testsuite/gcc.dg/sms-8.c(working copy)
@@ -3,7 +3,8 @@
 that was not fixed by reg-moves.  */
 
  /* { dg-do run } */
- /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms" } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms --param sms-min-sc=1" } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-fdump-rtl-sms" { target powerpc*-*-*} } */
 
 extern void abort (void);
 
@@ -35,7 +36,7 @@ main ()
   return 0;
 }
 
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target 
powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 0 "sms" { target 
powerpc-*-* } } } */
 /* { dg-final { cleanup-rtl-dump "sms" } } */
 
 
Index: testsuite/gcc.dg/sms-5.c
===
--- testsuite/gcc.dg/sms-5.c(revision 173659)
+++ testsuite/gcc.dg/sms-5.c(working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-funroll-loops -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves 
-funroll-loops -fdump-rtl-sms --param sms-mi