[4.8] Request to backport patch to the 4.8 branch

2014-12-24 Thread zhangjian
Hi, guys

I encounter a gcc failure when I build mysql on opensuse[1]
5.6.17/storage/perfschema/pfs_account.cc:320:1: error: could not split insn
[ 1245s]  }
[ 1245s]  ^
[ 1245s] (insn 482 1770 1461 (parallel [
[ 1245s] (set (reg:SI 1 x1 [orig:167 D.16835 ] [167])
[ 1245s] (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] [166]) 
[-1  S4 A32]))
[ 1245s] (set (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] [166]) 
[-1  S4 A32])
[ 1245s] (unspec_volatile:SI [
[ 1245s] (ior:SI (mem/v:SI (reg/f:DI 0 x0 [orig:166 
D.16844 ] [166]) [-1  S4 A32])
[ 1245s] (const_int 0 [0]))
[ 1245s] (const_int 5 [0x5])
[ 1245s] ] UNSPECV_ATOMIC_OP))
[ 1245s] (clobber (reg:CC 66 cc))
[ 1245s] (clobber (reg:SI 4 x4))
[ 1245s] (clobber (reg:SI 3 x3))
[ 1245s] ]) 
/home/abuild/rpmbuild/BUILD/mysql-5.6.17/include/my_atomic.h:217 1814 
{atomic_fetch_orsi}
[ 1245s]  (expr_list:REG_UNUSED (reg:CC 66 cc)
[ 1245s] (expr_list:REG_UNUSED (reg:SI 4 x4)
[ 1245s] (expr_list:REG_UNUSED (reg:SI 3 x3)
[ 1245s] (nil)
[ 1245s] 
/home/abuild/rpmbuild/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1:
 internal compiler error: in final_scan_insn, at final.c:2897

Ihis bug could be fixed by Michael's patch(r217076):
2014-11-04  Michael Collison michael.colli...@linaro.org

* config/aarch64/iterators.md (lconst_atomic): New mode attribute
to support constraints for CONST_INT in atomic operations.
* config/aarch64/atomics.md
(atomic_atomic_optabmode): Use lconst_atomic constraint.
(atomic_nandmode): Likewise.
(atomic_fetch_atomic_optabmode): Likewise.
(atomic_fetch_nandmode): Likewise.
(atomic_atomic_optab_fetchmode): Likewise.
(atomic_nand_fetchmode): Likewise.

Michael's patch could be applied on the top of gcc 4.8 branch except the 
gcc/ChangeLog.
Is it possible backport this patch to gcc 4.8 branch?
I am new to here, I am not sure if I need send the patch with modified 
ChangeLog. Sorry if I break the rules.

regards

bamvor

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=896667



Re: [4.8] Request to backport patch to the 4.8 branch

2014-12-24 Thread Bin.Cheng
On Wed, Dec 24, 2014 at 4:35 PM, zhangjian bamvor.zhangj...@huawei.com wrote:
 Hi, guys

 I encounter a gcc failure when I build mysql on opensuse[1]
 5.6.17/storage/perfschema/pfs_account.cc:320:1: error: could not split insn
 [ 1245s]  }
 [ 1245s]  ^
 [ 1245s] (insn 482 1770 1461 (parallel [
 [ 1245s] (set (reg:SI 1 x1 [orig:167 D.16835 ] [167])
 [ 1245s] (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] [166]) 
 [-1  S4 A32]))
 [ 1245s] (set (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] [166]) 
 [-1  S4 A32])
 [ 1245s] (unspec_volatile:SI [
 [ 1245s] (ior:SI (mem/v:SI (reg/f:DI 0 x0 [orig:166 
 D.16844 ] [166]) [-1  S4 A32])
 [ 1245s] (const_int 0 [0]))
 [ 1245s] (const_int 5 [0x5])
 [ 1245s] ] UNSPECV_ATOMIC_OP))
 [ 1245s] (clobber (reg:CC 66 cc))
 [ 1245s] (clobber (reg:SI 4 x4))
 [ 1245s] (clobber (reg:SI 3 x3))
 [ 1245s] ]) 
 /home/abuild/rpmbuild/BUILD/mysql-5.6.17/include/my_atomic.h:217 1814 
 {atomic_fetch_orsi}
 [ 1245s]  (expr_list:REG_UNUSED (reg:CC 66 cc)
 [ 1245s] (expr_list:REG_UNUSED (reg:SI 4 x4)
 [ 1245s] (expr_list:REG_UNUSED (reg:SI 3 x3)
 [ 1245s] (nil)
 [ 1245s] 
 /home/abuild/rpmbuild/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1:
  internal compiler error: in final_scan_insn, at final.c:2897

 Ihis bug could be fixed by Michael's patch(r217076):
 2014-11-04  Michael Collison michael.colli...@linaro.org

 * config/aarch64/iterators.md (lconst_atomic): New mode attribute
 to support constraints for CONST_INT in atomic operations.
 * config/aarch64/atomics.md
 (atomic_atomic_optabmode): Use lconst_atomic constraint.
 (atomic_nandmode): Likewise.
 (atomic_fetch_atomic_optabmode): Likewise.
 (atomic_fetch_nandmode): Likewise.
 (atomic_atomic_optab_fetchmode): Likewise.
 (atomic_nand_fetchmode): Likewise.

 Michael's patch could be applied on the top of gcc 4.8 branch except the 
 gcc/ChangeLog.
 Is it possible backport this patch to gcc 4.8 branch?
 I am new to here, I am not sure if I need send the patch with modified 
 ChangeLog. Sorry if I break the rules.
Hi,
Since the patch applies to 4.8 smoothly, and you already provided the
revision number, I don't think an additional patch is needed.  But is
the original patch for an existing bug?  And what's about gcc 4_9
branch?  Maybe you can create a PR against 4.8 (or 4.9) for tracking.
Another problem is you may need to wait for a while since it's holiday
time.

Thanks,
bin

 regards

 bamvor

 [1] https://bugzilla.opensuse.org/show_bug.cgi?id=896667



[PATCH, libiberty, gcc]: Introduce xasprintf to libiberty and use it in gengtype

2014-12-24 Thread Uros Bizjak
Hello!

Based on a suggestion from [1] and on previous work by Manuel and Ben.
The new code is almost the same as existing asprintf.c, but uses
recently added xvasprintf.

Thes patch removes local xasprintf definition from gengtype.c and uses
the new one there.

libiberty/ChangeLog:

2014-12-24  Uros Bizjak  ubiz...@gmail.com
Ben Elliston  b...@au.ibm.com
Manuel Lopez-Ibanez  m...@gcc.gnu.org

* xasprintf.c: New file.
* Makefile.in (CFILES): Add xasprintf.c.
(REQUIRED_OFILES): Add xasprintf.$(objext).
(xasprintf.$(objext)): New target.
* functions.texi: Regenerate.

include/ChangeLog:

2014-12-24  Uros Bizjak  ubiz...@gmail.com
Ben Elliston  b...@au.ibm.com
Manuel Lopez-Ibanez  m...@gcc.gnu.org

* libiberty.h (xasprintf): Declare.

gcc/ChangeLog:

2014-12-24  Uros Bizjak  ubiz...@gmail.com

* gengtype.h (xasprintf): Remove declaration.
* gengtype.c (xasprintf): Remove.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK for mainline?

[1] https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00848.html

Uros.
Index: gcc/gengtype.c
===
--- gcc/gengtype.c  (revision 219042)
+++ gcc/gengtype.c  (working copy)
@@ -119,23 +119,6 @@ error_at_line (const struct fileloc *pos, const ch
 
   va_end (ap);
 }
-
-/* asprintf, but produces fatal message on out-of-memory.  */
-char *
-xasprintf (const char *format, ...)
-{
-  int n;
-  char *result;
-  va_list ap;
-
-  va_start (ap, format);
-  n = vasprintf (result, format, ap);
-  if (result == NULL || n  0)
-fatal (out of memory);
-  va_end (ap);
-
-  return result;
-}
 
 /* Locate the ultimate base class of struct S.  */
 
Index: gcc/gengtype.h
===
--- gcc/gengtype.h  (revision 219042)
+++ gcc/gengtype.h  (working copy)
@@ -418,9 +418,6 @@ void write_state (const char* path);
 extern void error_at_line
 (const struct fileloc *pos, const char *msg, ...) ATTRIBUTE_PRINTF_2;
 
-/* Like asprintf, but calls fatal() on out of memory.  */
-extern char *xasprintf (const char *, ...) ATTRIBUTE_PRINTF_1;
-
 /* Constructor routines for types.  */
 extern void do_typedef (const char *s, type_p t, struct fileloc *pos);
 extern void do_scalar_typedef (const char *s, struct fileloc *pos);
Index: include/libiberty.h
===
--- include/libiberty.h (revision 219042)
+++ include/libiberty.h (working copy)
@@ -629,6 +629,11 @@ extern int pwait (int, int *, int);
 extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
 #endif
 
+/* Like asprintf but allocates memory without fail. This works like
+   xmalloc.  */
+
+extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1;
+
 #if !HAVE_DECL_VASPRINTF
 /* Like vsprintf but provides a pointer to malloc'd storage, which
must be freed by the caller.  */
Index: libiberty/Makefile.in
===
--- libiberty/Makefile.in   (revision 219042)
+++ libiberty/Makefile.in   (working copy)
@@ -158,8 +158,8 @@ CFILES = alloca.c argv.c asprintf.c atexit.c
\
vasprintf.c vfork.c vfprintf.c vprintf.c vprintf-support.c  \
 vsnprintf.c vsprintf.c \
waitpid.c   \
-   xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c \
-xstrndup.c xvasprintf.c
+   xasprintf.c xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c \
+xstrerror.c xstrndup.c xvasprintf.c
 
 # These are always included in the library.  The first four are listed
 # first and by compile time to optimize parallel builds.
@@ -190,9 +190,10 @@ REQUIRED_OFILES =  
\
./splay-tree.$(objext) ./stack-limit.$(objext)  \
./strerror.$(objext) ./strsignal.$(objext)  \
./timeval-utils.$(objext) ./unlink-if-ordinary.$(objext)\
-   ./xatexit.$(objext) ./xexit.$(objext) ./xmalloc.$(objext)   \
-   ./xmemdup.$(objext) ./xstrdup.$(objext) ./xstrerror.$(objext)   \
-   ./xstrndup.$(objext) ./xvasprintf.$(objext)
+   ./xasprintf.$(objext) ./xatexit.$(objext) ./xexit.$(objext) \
+   ./xmalloc.$(objext) ./xmemdup.$(objext) ./xstrdup.$(objext) \
+   ./xstrerror.$(objext) ./xstrndup.$(objext)  \
+   ./xvasprintf.$(objext)
 
 # These are all the objects that configure may add to the library via
 # $funcs or EXTRA_OFILES.  This list exists here only for make
@@ -1618,6 +1619,16 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
else true; fi
$(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION)
 
+./xasprintf.$(objext): $(srcdir)/xasprintf.c config.h $(INCDIR)/ansidecl.h \
+   

Re: [4.8] Request to backport patch to the 4.8 branch

2014-12-24 Thread Bamvor Jian Zhang
On 2014/12/24 17:41, Bin.Cheng wrote:
 On Wed, Dec 24, 2014 at 4:35 PM, zhangjian bamvor.zhangj...@huawei.com 
 wrote:
 Hi, guys

 I encounter a gcc failure when I build mysql on opensuse[1]
 5.6.17/storage/perfschema/pfs_account.cc:320:1: error: could not split insn
 [ 1245s]  }
 [ 1245s]  ^
 [ 1245s] (insn 482 1770 1461 (parallel [
 [ 1245s] (set (reg:SI 1 x1 [orig:167 D.16835 ] [167])
 [ 1245s] (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] [166]) 
 [-1  S4 A32]))
 [ 1245s] (set (mem/v:SI (reg/f:DI 0 x0 [orig:166 D.16844 ] 
 [166]) [-1  S4 A32])
 [ 1245s] (unspec_volatile:SI [
 [ 1245s] (ior:SI (mem/v:SI (reg/f:DI 0 x0 [orig:166 
 D.16844 ] [166]) [-1  S4 A32])
 [ 1245s] (const_int 0 [0]))
 [ 1245s] (const_int 5 [0x5])
 [ 1245s] ] UNSPECV_ATOMIC_OP))
 [ 1245s] (clobber (reg:CC 66 cc))
 [ 1245s] (clobber (reg:SI 4 x4))
 [ 1245s] (clobber (reg:SI 3 x3))
 [ 1245s] ]) 
 /home/abuild/rpmbuild/BUILD/mysql-5.6.17/include/my_atomic.h:217 1814 
 {atomic_fetch_orsi}
 [ 1245s]  (expr_list:REG_UNUSED (reg:CC 66 cc)
 [ 1245s] (expr_list:REG_UNUSED (reg:SI 4 x4)
 [ 1245s] (expr_list:REG_UNUSED (reg:SI 3 x3)
 [ 1245s] (nil)
 [ 1245s] 
 /home/abuild/rpmbuild/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1:
  internal compiler error: in final_scan_insn, at final.c:2897

 Ihis bug could be fixed by Michael's patch(r217076):
 2014-11-04  Michael Collison michael.colli...@linaro.org

 * config/aarch64/iterators.md (lconst_atomic): New mode attribute
 to support constraints for CONST_INT in atomic operations.
 * config/aarch64/atomics.md
 (atomic_atomic_optabmode): Use lconst_atomic constraint.
 (atomic_nandmode): Likewise.
 (atomic_fetch_atomic_optabmode): Likewise.
 (atomic_fetch_nandmode): Likewise.
 (atomic_atomic_optab_fetchmode): Likewise.
 (atomic_nand_fetchmode): Likewise.

 Michael's patch could be applied on the top of gcc 4.8 branch except the 
 gcc/ChangeLog.
 Is it possible backport this patch to gcc 4.8 branch?
 I am new to here, I am not sure if I need send the patch with modified 
 ChangeLog. Sorry if I break the rules.
Hi, bin
 Hi,
 Since the patch applies to 4.8 smoothly, and you already provided the
 revision number, I don't think an additional patch is needed.  But is
 the original patch for an existing bug?
After check the original discussion, I found that it is a bug reported
by d...@ubuntu.com[1].
 And what's about gcc 4_9
 branch?
I am not sure. It seems that the original patch is tested on gcc 4.9[1]:
--- ../../../../linaro-gcc4_9_git/gcc/config/aarch64/iterators.md   2014-09-22 
10:10:04.520258964 -0700
+++ iterators.md2014-09-16 14:27:10.459050672 -0700
@@ -349,6 +349,9 @@

 Maybe you can create a PR against 4.8 (or 4.9) for tracking.
Thanks your suggestion. I am sorry I do not know what should be included
in PR and how to create a PR after google.
 Another problem is you may need to wait for a while since it's holiday
 time.

 Thanks,
 bin

regards

bamvor

[1] https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02209.html

 regards

 bamvor

 [1] https://bugzilla.opensuse.org/show_bug.cgi?id=896667

 
 .
 




Flatten tree.h and tree-core.h (Version 2)

2014-12-24 Thread Michael Collison
This patch flattens tree.h and tree-core.h. This is a revised patch that 
does not include tree-core.h as a result of flattening.


I removed the includes in tree.h and tree-core.h except for the include 
of tree-core.h in tree.h.


I modified genattrtab.c, genautomata.c, genemit.c, gengtype.c, 
gengtype.c, genoptinit.c, genoutput.c,
genpeep.c, genpreds.c, and optc-save-gen-awk to include the the 
necessary include files removed from

tree.h and tree-core.h when generating their respective files.

I removed three inline functions from tree.h and relocated them to 
fold-const.c and exported them in fold-const.h. The functions are:


convert_to_ptrofftype-loc
fold_build_pointer_plus_loc
fold_build_pointer_plus_hwi_loc

All other changes include the necessary include files removed from 
tree.h and tree-core.h. Note the patches modifies all the front-ends.


I bootstrapped on x86 with all languages. I also bootstrapped on all 
targets listed in contrib/config-list.mk with c and c++ enabled.


Is this okay for trunk?


2014-12-24  Michael Collison  michael.colli...@linaro.org

* genattrtab.c (write_header): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-attrtab.c.
* genautomata.c (main) : Include hash-set.h, macInclude hash-set.h, 
machmode.h,

vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-automata.c.
* genemit.c (main): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-emit.c.
* gengtype.c (open_base_files): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
gtype-desc.c.
* genopinit.c (main): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-opinit.c.
* genoutput.c (output_prologue): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-output.c.
* genpeep.c (main): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-peep.c.
* genpreds.c (write_insn_preds_c): Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
insn-preds.c.
* optc-save-gen-awk: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h when generating
options-save.c.
* opth-gen.awk: Change include guard from GCC_C_COMMON_H to 
GCC_C_COMMON_C

when generating options.h.

2014-12-24  Michael Collison  michael.colli...@linaro.org

* ada/gcc-interface/cuintp.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h,
fold-const.h, wide-int.h, and inchash.h due to
flattening of tree.h.
* ada/gcc-interface/decl.c: ditto.
* ada/gcc-interface/misc.c: ditto.
* ada/gcc-interface/targtyps.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h,
fold-const.h, wide-int.h, and inchash.h due to
flattening of tree.h.
* ada/gcc-interface/trans.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, real.h,
fold-const.h, wide-int.h, inchash.h due to
flattening of tree.h.
* ada/gcc-interface/utils.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h,
fold-const.h, wide-int.h, and inchash.h due to
flattening of tree.h.
* ada/gcc-interface/utils2.c: ditto.
* alias.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h due to
flattening of tree.h.
* asan.c: ditto.
* attribs.c: ditto.
* auto-inc-dec.c: ditto.
* auto-profile.c: ditto
* bb-reorder.c: ditto.
* bt-load.c: Include symtab.h due to flattening of tree.h.
* builtins.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, and inchash.h due to
flattening of tree.h.
* c/c-array-notation.c: ditto.
* c/c-aux-info.c: ditto.
* c/c-convert.c: ditto.
* c/c-decl.c: ditto.
* c/c-errors.c: ditto.
* c/c-lang.c: dittoxs.
* c/c-objc-common.c: ditto.
* c/c-parser.c: ditto.
* c/c-typeck.c: Include hash-set.h, machmode.h,
vec.h, double-int.h, input.h, alias.h, symtab.h, options.h
fold-const.h, wide-int.h, inchash.h, 

[PATCH, libgo]: Double StackMin size for 64bit non-split-stack targets

2014-12-24 Thread Uros Bizjak
Hello!

The attached patch doubles StackMin size for 64bit non-split-stack
targets. This patch fixes regexp libgo failure (tracked as gcc PR61871
[1]) on alpha-linux-gnu.

--cut here--
Index: runtime/proc.c
===
--- runtime/proc.c  (revision 219035)
+++ runtime/proc.c  (working copy)
@@ -51,7 +51,7 @@
 #if defined(USING_SPLIT_STACK)  defined(LINKER_SUPPORTS_SPLIT_STACK)
 # define StackMin PTHREAD_STACK_MIN
 #else
-# define StackMin 2 * 1024 * 1024
+# define StackMin ((sizeof(char *)  8) ? 2 * 1024 * 1024 : 4 * 1024 * 1024)
 #endif

 uintptr runtime_stacks_sys;
--cut here--

Bootstrapped and regression tested on alphaev68-linux-gnu.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61871

Uros.


[Patch, moxie] Add -mmul.x option

2014-12-24 Thread Anthony Green

I am committing the attached patch, which adds support for the mul.x and
umul.x instructions, which compute the high 32 bits of a 64-bit result
for a 32-bit multiply (signed and unsigned).  These instructions are
enabled by default for moxiebox-* configurations.

This patch also updates the add, sub, mul, div and udiv instruction
names by removing the trailing .l.


2014-12-24  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.opt (mul.x): New option.
* doc/invoke.texi (Moxie Options): Document -mmul.x.
* config/moxie/moxie.md (addsi3, mulsi3, subsi3, divsi3, udivs3):
Remove trailing .l from add, mul, sub, div and udiv
instructions.
(mulsi3_highpart, mulsidi3): Add mul.x  umul.x instruction
support (high 32-bit result of multiply).
* config/moxie/moxie.c (moxie_option_override): Force availability
of mul.x instructions for moxiebox target.
* config/moxie/moxiebox.h (TARGET_MOXIEBOX): Define.


Index: gcc/config/moxie/moxie.c
===
--- gcc/config/moxie/moxie.c(revision 219054)
+++ gcc/config/moxie/moxie.c(working copy)
@@ -249,13 +249,16 @@
 }
 
 
-/* The TARGET_OPTION_OVERRIDE worker.
-   All this curently does is set init_machine_status.  */
+/* The TARGET_OPTION_OVERRIDE worker.  */
 static void
 moxie_option_override (void)
 {
   /* Set the per-function-data initializer.  */
   init_machine_status = moxie_init_machine_status;
+
+#ifdef TARGET_MOXIEBOX  
+  target_flags = ~MASK_HAS_MULX;
+#endif
 }
 
 /* Compute the size of the local area and the size to be adjusted by the
Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219054)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -50,7 +50,7 @@
   @
   inc%0, %2
   dec   %0, -%2
-  add.l  %0, %2)
+  add%0, %2)
 
 (define_insn subsi3
   [(set (match_operand:SI 0 register_operand =r,r)
@@ -60,7 +60,7 @@
   
   @
   dec%0, %2
-  sub.l  %0, %2)
+  sub%0, %2)
 
 (define_insn mulsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -68,15 +68,44 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mul.l  %0, %2)
+  mul%0, %2)
 
+(define_code_iterator EXTEND [sign_extend zero_extend])
+(define_code_attr mul [(sign_extend mul) (zero_extend umul)])
+
+(define_insn mulsi3_highpart
+  [(set (match_operand:SI 0 register_operand   =r)
+(truncate:SI
+ (lshiftrt:DI
+  (mult:DI (EXTEND:DI (match_operand:SI 1 register_operand  0))
+   (EXTEND:DI (match_operand:SI 2 register_operand  r)))
+  (const_int 32]
+  TARGET_HAS_MULX
+  mul.x\\t%0, %2)
+
+(define_expand mulsidi3
+  [(set (match_operand:DI 0 register_operand )
+   (mult:DI (EXTEND:DI (match_operand:SI 1 register_operand 0))
+(EXTEND:DI (match_operand:SI 2 register_operand r]
+  TARGET_HAS_MULX
+{
+  rtx hi = gen_reg_rtx (SImode);
+  rtx lo = gen_reg_rtx (SImode);
+
+  emit_insn (gen_mulsi3_highpart (hi, operands[1], operands[2]));
+  emit_insn (gen_mulsi3 (lo, operands[1], operands[2]));
+  emit_move_insn (gen_lowpart (SImode, operands[0]), lo);
+  emit_move_insn (gen_highpart (SImode, operands[0]), hi);
+  DONE;
+})
+
 (define_insn divsi3
   [(set (match_operand:SI 0 register_operand =r)
  (div:SI
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  div.l  %0, %2)
+  div%0, %2)
 
 (define_insn udivsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -84,7 +113,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  udiv.l %0, %2)
+  udiv   %0, %2)
 
 (define_insn modsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -92,7 +121,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mod.l  %0, %2)
+  mod%0, %2)
 
 (define_insn umodsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -100,7 +129,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  umod.l %0, %2)
+  umod   %0, %2)
 
 ;; -
 ;; Unary arithmetic instructions
Index: gcc/config/moxie/moxie.opt
===
--- gcc/config/moxie/moxie.opt  (revision 219054)
+++ gcc/config/moxie/moxie.opt  (working copy)
@@ -26,6 +26,10 @@
 Target RejectNegative Report Mask(LITTLE_ENDIAN)
 Generate little-endian code
 
+mmul.x
+Target Report Mask(HAS_MULX)
+Enable MUL.X and UMUL.X instructions
+
 ; Ignored by the compiler
 mno-crt0
 Target RejectNegative
Index: gcc/config/moxie/moxiebox.h
===

Commit: 4.9 branch: Backport RX alignment fix

2014-12-24 Thread Nick Clifton
Hi Guys,

  I am backporting an RX-specific patch from the mainline to the 4.9
  branch as this fixes an internal error in the assembler (!) when
  running the gcc test gcc.c-torture/compile/pr53748.c.

Cheers
  Nick

gcc/ChangeLog
2014-12-24  Nick Clifton  ni...@redhat.com

Backport from mainline:
2014-06-13  Nick Clifton  ni...@redhat.com

* config/rx/rx.h (JUMP_ALIGN): Return the log value if user
requested alignment is active.
(LABEL_ALIGN): Likewise.
(LOOP_ALIGN): Likewise.

Index: gcc/config/rx/rx.h
===
--- gcc/config/rx/rx.h  (revision 219053)
+++ gcc/config/rx/rx.h  (working copy)
@@ -433,9 +433,9 @@
 /* Compute the alignment needed for label X in various situations.
If the user has specified an alignment then honour that, otherwise
use rx_align_for_label.  */
-#define JUMP_ALIGN(x)  (align_jumps ? align_jumps : 
rx_align_for_label (x, 0))
-#define LABEL_ALIGN(x) (align_labels ? align_labels : 
rx_align_for_label (x, 3))
-#define LOOP_ALIGN(x)  (align_loops ? align_loops : 
rx_align_for_label (x, 2))
+#define JUMP_ALIGN(x)  (align_jumps  1 ? 
align_jumps_log : rx_align_for_label (x, 0))
+#define LABEL_ALIGN(x) (align_labels  1 ? 
align_labels_log : rx_align_for_label (x, 3))
+#define LOOP_ALIGN(x)  (align_loops  1 ? 
align_loops_log : rx_align_for_label (x, 2))
 #define LABEL_ALIGN_AFTER_BARRIER(x)   rx_align_for_label (x, 0)
 
 #define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM, LOG, MAX_SKIP)   \


Commit: 4.9 branch: Backport RX 'R' operator fix

2014-12-24 Thread Nick Clifton
Hi Guys,

  I am backporting an RX-specific patch from the mainline to the 4.9
  branch as it fixes an ICE running the gcc test
  gcc.c-torture/compile/pr39423-2.c.

Cheers
  Nick

gcc/ChangeLog
2014-12-24  Nick Clifton  ni...@redhat.com

Backport from mainline:
2014-03-25  Nick Clifton  ni...@redhat.com

* config/rx/rx.c (rx_print_operand): Allow R operator to accept
SImode values.

Index: gcc/config/rx/rx.c
===
--- gcc/config/rx/rx.c  (revision 219054)
+++ gcc/config/rx/rx.c  (working copy)
@@ -733,7 +733,7 @@
   break;
 
 case 'R':
-  gcc_assert (GET_MODE_SIZE (GET_MODE (op))  4);
+  gcc_assert (GET_MODE_SIZE (GET_MODE (op)) = 4);
   unsigned_load = true;
   /* Fall through.  */
 case 'Q':


Commit: MSP430: Fix addsi splitter (PR 64160)

2014-12-24 Thread Nick Clifton
Hi Guys.

  I am applying the patch below to fix PR 64160 for the MSP430.

Cheers
  Nick

gcc/ChangeLog
2014-12-24  Nick Clifton  ni...@redhat.com

PR target/64160
* config/msp430/msp430.md (addsi splitter): Do not split when the
destination partially overlaps the source.

Index: config/msp430/msp430.md
===
--- config/msp430/msp430.md (revision 219057)
+++ config/msp430/msp430.md (working copy)
@@ -402,14 +402,16 @@
operands[6] = msp430_subreg (HImode, operands[0], SImode, 2);
operands[7] = msp430_subreg (HImode, operands[1], SImode, 2);
operands[8] = msp430_subreg (HImode, operands[2], SImode, 2);
+
+   /* BZ 64160: Do not use this splitter when the dest partially overlaps the 
source.  */
+   if (reg_overlap_mentioned_p (operands[3], operands[7])
+   || reg_overlap_mentioned_p (operands[3], operands[8]))
+  FAIL;
+
if (GET_CODE (operands[5]) == CONST_INT)
- {
-   operands[9] = GEN_INT (INTVAL (operands[5])  0x);
- }
+ operands[9] = GEN_INT (INTVAL (operands[5])  0x);
else
- {
-   operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]);
- }
+ operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]);

   )
 


Re: [PATCH, libiberty, gcc]: Introduce xasprintf to libiberty and use it in gengtype

2014-12-24 Thread Ian Lance Taylor
On Wed, Dec 24, 2014 at 1:52 AM, Uros Bizjak ubiz...@gmail.com wrote:

 libiberty/ChangeLog:

 2014-12-24  Uros Bizjak  ubiz...@gmail.com
 Ben Elliston  b...@au.ibm.com
 Manuel Lopez-Ibanez  m...@gcc.gnu.org

 * xasprintf.c: New file.
 * Makefile.in (CFILES): Add xasprintf.c.
 (REQUIRED_OFILES): Add xasprintf.$(objext).
 (xasprintf.$(objext)): New target.
 * functions.texi: Regenerate.

 include/ChangeLog:

 2014-12-24  Uros Bizjak  ubiz...@gmail.com
 Ben Elliston  b...@au.ibm.com
 Manuel Lopez-Ibanez  m...@gcc.gnu.org

 * libiberty.h (xasprintf): Declare.

 gcc/ChangeLog:

 2014-12-24  Uros Bizjak  ubiz...@gmail.com

 * gengtype.h (xasprintf): Remove declaration.
 * gengtype.c (xasprintf): Remove.

 Bootstrapped and regression tested on x86_64-linux-gnu.

 OK for mainline?

This is OK.

Thanks.

Ian


[PATCH] combine: Correct cost calculation and display for split I2

2014-12-24 Thread Segher Boessenkool
If we have split a parallel I2 to two insns, we will count its RTL cost
twice.  This currently does not matter since the cost is 0 always (it is
not a single set insn), but let's fix it anyway.

Also do not display the fake I1 in the cost calculation in the dump file.

Tested on powerpc64-linux.  Okay for mainline?


Segher


2014-12-24  Segher Boessenkool  seg...@kernel.crashing.org

gcc/
* combine.c (combine_validate_cost): Do not count the cost of a
split I2 twice.  Do not display it twice in the dump, either.

---
 gcc/combine.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index ed247bd..56ac34c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -909,6 +909,12 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, 
rtx_insn *i2, rtx_insn *i3,
   i1_cost = i0_cost = 0;
 }
 
+  /* If we have split a PARALLEL I2 to I1,I2, we have counted its cost twice;
+ correct that.  */
+  if (old_cost  i1  INSN_UID (i1) == INSN_UID (i2))
+old_cost -= i1_cost;
+
+
   /* Calculate the replacement insn_rtx_costs.  */
   new_i3_cost = insn_rtx_cost (newpat, optimize_this_for_speed_p);
   if (newi2pat)
@@ -948,14 +954,14 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, 
rtx_insn *i2, rtx_insn *i3,
   reject ? rejecting : allowing);
   if (i0)
fprintf (dump_file, %d, , INSN_UID (i0));
-  if (i1)
+  if (i1  INSN_UID (i1) != INSN_UID (i2))
fprintf (dump_file, %d, , INSN_UID (i1));
   fprintf (dump_file, %d and %d\n, INSN_UID (i2), INSN_UID (i3));
 
   fprintf (dump_file, original costs );
   if (i0)
fprintf (dump_file, %d + , i0_cost);
-  if (i1)
+  if (i1  INSN_UID (i1) != INSN_UID (i2))
fprintf (dump_file, %d + , i1_cost);
   fprintf (dump_file, %d + %d = %d\n, i2_cost, i3_cost, old_cost);
 
-- 
1.8.1.4



[PATCH] rs6000: Fix the dlmzb. testcases

2014-12-24 Thread Segher Boessenkool
The dlmzb. instruction requires an 8-byte aligned operand.  The testcases
try to enforce that by passing an arg as long long *, but current GCC
still assumes an alignment of 1 (correctly I think -- the pointer is only
used as pointer to char).

This patch changes the testcases to explicitly have an 8-byte aligned datum.

Okay for mainline?


Segher


2014-12-24  Segher Boessenkool  seg...@kernel.crashing.org

gcc/testsuite/
* gcc.target/powerpc/405-dlmzb-strlen-1.c: Explicitly align arg.
* gcc.target/powerpc/440-dlmzb-strlen-1.c: Ditto.

---
 gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c | 6 --
 gcc/testsuite/gcc.target/powerpc/440-dlmzb-strlen-1.c | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c 
b/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
index b06a74f..52675ba 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
@@ -12,8 +12,10 @@ typedef __SIZE_TYPE__ size_t;
 
 size_t strlen(const char *);
 
+char s[100] __attribute__ ((aligned (8)));
+
 size_t
-strlen8(const long long *s)
+strlen8(void)
 {
-  return strlen((const char *)s);
+  return strlen(s);
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/440-dlmzb-strlen-1.c 
b/gcc/testsuite/gcc.target/powerpc/440-dlmzb-strlen-1.c
index d255bd7..0373466 100644
--- a/gcc/testsuite/gcc.target/powerpc/440-dlmzb-strlen-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/440-dlmzb-strlen-1.c
@@ -12,8 +12,10 @@ typedef __SIZE_TYPE__ size_t;
 
 size_t strlen(const char *);
 
+char s[100] __attribute__ ((aligned (8)));
+
 size_t
-strlen8(const long long *s)
+strlen8(void)
 {
-  return strlen((const char *)s);
+  return strlen(s);
 }
-- 
1.8.1.4



[PATCH] simplify-rtx: Generalize (and X (ior (not X) Y) - (and X Y)

2014-12-24 Thread Segher Boessenkool
The existing transform

  (and X (ior (not X) Y) - (and X Y)

has two shortcomings: it only handles identical RTX for X, i.e. registers,
not e.g. subregs of registers; and it only handles the case where the NOT
is the first arm of the IOR (it can be the second arm e.g. if the first
arm is a NOT as well).  Fix both.  This fixes gcc.dg/and-1.c on powerpc64.

Bootstrapped and tested on powerpc64-linux; okay for mainline?


Segher


2014-12-24  Segher Boessenkool  seg...@kernel.crashing.org

gcc/
* simplify-rtx.c (simplify_binary_operation_1): Handle more cases
for the (and X (ior (not X) Y) - (and X Y) transform.

---
 gcc/simplify-rtx.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 277288a..ae0b49d 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2933,15 +2933,27 @@ simplify_binary_operation_1 (enum rtx_code code, 
machine_mode mode,
   /* (and X (ior (not X) Y) - (and X Y) */
   if (GET_CODE (op1) == IOR
   GET_CODE (XEXP (op1, 0)) == NOT
-  op0 == XEXP (XEXP (op1, 0), 0))
+  rtx_equal_p (op0, XEXP (XEXP (op1, 0), 0)))
return simplify_gen_binary (AND, mode, op0, XEXP (op1, 1));
 
   /* (and (ior (not X) Y) X) - (and X Y) */
   if (GET_CODE (op0) == IOR
   GET_CODE (XEXP (op0, 0)) == NOT
-  op1 == XEXP (XEXP (op0, 0), 0))
+  rtx_equal_p (op1, XEXP (XEXP (op0, 0), 0)))
return simplify_gen_binary (AND, mode, op1, XEXP (op0, 1));
 
+  /* (and X (ior Y (not X)) - (and X Y) */
+  if (GET_CODE (op1) == IOR
+  GET_CODE (XEXP (op1, 1)) == NOT
+  rtx_equal_p (op0, XEXP (XEXP (op1, 1), 0)))
+   return simplify_gen_binary (AND, mode, op0, XEXP (op1, 0));
+
+  /* (and (ior Y (not X)) X) - (and X Y) */
+  if (GET_CODE (op0) == IOR
+  GET_CODE (XEXP (op0, 1)) == NOT
+  rtx_equal_p (op1, XEXP (XEXP (op0, 1), 0)))
+   return simplify_gen_binary (AND, mode, op1, XEXP (op0, 0));
+
   tem = simplify_byte_swapping_operation (code, mode, op0, op1);
   if (tem)
return tem;
-- 
1.8.1.4



[Patch, MIPS] Remove some multilibs from mips-mti-linux-gnu target

2014-12-24 Thread Steve Ellcey
This patch removes mips32[r1] and mips64[r1] from the list of
mips-mti-linux-gnu architectures built with -mnan=2008.  They
should never have been included since these architectures do not
support the ieee 2008 format (GCC warns and ignores the nan flag).

The recent changes to glibc to use -Werror mean that the warning
GCC gives is treated as an error and that glibc will not build with
these flag combinations so I would like to remove them from the
GCC mips-mti-linux-gnu multilib list.

This does not affect any GCC target other then mips-mti-linux.gnu.

OK to checkin?

Steve Ellcey
sell...@imgtec.com


2014-12-24  Steve Ellcey  sell...@mips.com

* config/mips/t-mti-linux (MULTILIB_EXCEPTIONS): Add exceptions
for mips32[r1] and mips64[r1] with -mnan=2008.


diff --git a/gcc/config/mips/t-mti-linux b/gcc/config/mips/t-mti-linux
index 487a015..c111532 100644
--- a/gcc/config/mips/t-mti-linux
+++ b/gcc/config/mips/t-mti-linux
@@ -41,5 +41,8 @@ MULTILIB_EXCEPTIONS += *mips32/mmicromips*
 MULTILIB_EXCEPTIONS += *mips64*/mmicromips*
 MULTILIB_EXCEPTIONS += *mmicromips/mabi=64*
 
-# We do not want nan2008 libraries for soft-float.
+# We do not want nan2008 libraries for soft-float,
+# mips32[r1], or mips64[r1].
 MULTILIB_EXCEPTIONS += *msoft-float*/*mnan=2008*
+MULTILIB_EXCEPTIONS += *mips32/*mnan=2008*
+MULTILIB_EXCEPTIONS += *mips64/*mnan=2008*


[PATCH] libobjc: Properly handle classes without instance variables in class_copyIvarList ().

2014-12-24 Thread Dimitris Papavasiliou

Hello,

The attached patch fixes an issue reported a couple of years ago in Bug 
51891 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51891).  The problem 
is caused because classes without instance variables have no ivar list 
at all, so that their ivars pointer is NULL, but the code in 
class_copyIvarList () is unaware of this.


That this is in fact so can be easily verified by checking the code of 
class_addIvar in the same source file, where the ivars list is allocated 
when the first ivar is added.  The code there also checks for a NULL 
ivars pointer.


The patch also adds a simple test-case for this issue.  I think that the 
ChangeLog entry should be something along the lines of:


   2014-12-24  Dimitris Papavasiliou  dpapa...@gmail.com

 PR libobjc/51891
 * libobjc/ivars.c: Add a check for classes without instance
variables, which have a NULL ivar list pointer.
 * gcc/testsuite/objc.dg/gnu-api-2-class.m: Add a test case
for the above change.

I hope I got the formatting right.  I've run make -k check-objc and all 
tests pass without problems.


Let me know if there are any problems, or if I can do anything else to 
facilitate the acceptance of the patch.


Regards,
Dimitris

Index: gcc/testsuite/objc.dg/gnu-api-2-class.m
===
--- gcc/testsuite/objc.dg/gnu-api-2-class.m	(revision 219054)
+++ gcc/testsuite/objc.dg/gnu-api-2-class.m	(working copy)
@@ -239,6 +239,19 @@
   abort ();
   }
 
+  printf (Testing class_copyIvarList () on class with no instance variables...\n);
+  {
+unsigned int count;
+Ivar * list = class_copyIvarList (objc_getClass (MyOtherSubClass),
+  count);
+
+if (count != 0)
+  abort ();
+
+if (list != NULL)
+  abort ();
+  }
+
   printf (Testing class_copyMethodList ()...\n);
   {
 unsigned int count;
Index: libobjc/ivars.c
===
--- libobjc/ivars.c	(revision 219054)
+++ libobjc/ivars.c	(working copy)
@@ -179,7 +179,7 @@
   struct objc_ivar **returnValue = NULL;
   struct objc_ivar_list* ivar_list;
 
-  if (class_ == Nil  ||  CLS_IS_IN_CONSTRUCTION (class_))
+  if (class_ == Nil  ||  CLS_IS_IN_CONSTRUCTION (class_) || !class_-ivars)
 {
   if (numberOfReturnedIvars)
 	*numberOfReturnedIvars = 0;



Re: [PATCH] rs6000: Fix the dlmzb. testcases

2014-12-24 Thread David Edelsohn
On Wed, Dec 24, 2014 at 12:05 PM, Segher Boessenkool
seg...@kernel.crashing.org wrote:
 The dlmzb. instruction requires an 8-byte aligned operand.  The testcases
 try to enforce that by passing an arg as long long *, but current GCC
 still assumes an alignment of 1 (correctly I think -- the pointer is only
 used as pointer to char).

 This patch changes the testcases to explicitly have an 8-byte aligned datum.

 Okay for mainline?


 Segher


 2014-12-24  Segher Boessenkool  seg...@kernel.crashing.org

 gcc/testsuite/
 * gcc.target/powerpc/405-dlmzb-strlen-1.c: Explicitly align arg.
 * gcc.target/powerpc/440-dlmzb-strlen-1.c: Ditto.

Okay.

Thanks, David


[PATCH] Cleaning up incomplete type warning.

2014-12-24 Thread Luis Felipe Strano Moraes
This removes an unnecessary static variable from the code and also makes it a 
single
warning instead of two. Patch originally proposed by Manuel López-Ibáñez.

Luis Strano

gcc/c/ChangeLog:

2014-12-24  Luis Felipe Strano Moraes  luis.str...@gmail.com

* c-decl.c (get_parm_info): cleaning up incomplete type warning.

Index: gcc/c/c-decl.c
===
--- gcc/c/c-decl.c  (revision 219059)
+++ gcc/c/c-decl.c  (working copy)
@@ -6897,7 +6897,6 @@ get_parm_info (bool ellipsis, tree expr)
   tree types= 0;
   tree others   = 0;
 
-  static bool explained_incomplete_types = false;
   bool gave_void_only_once_err = false;
 
   arg_info-had_vla_unspec = current_scope-had_vla_unspec;
@@ -7000,19 +6999,15 @@ get_parm_info (bool ellipsis, tree expr)
{
  if (b-id)
/* The %s will be one of 'struct', 'union', or 'enum'.  */
-   warning (0, %%s %E% declared inside parameter list,
-keyword, b-id);
+   warning (0, %%s %E% declared inside parameter list and will
+ not be visible outside of this definition or
+ declaration, keyword, b-id);
  else
/* The %s will be one of 'struct', 'union', or 'enum'.  */
-   warning (0, anonymous %s declared inside parameter list,
-keyword);
+   warning (0, anonymous %s declared inside parameter list and
+ will not be visible outside of this definition or
+ declaration, keyword);
 
- if (!explained_incomplete_types)
-   {
- warning (0, its scope is only this definition or 
declaration,
-   which is probably not what you want);
- explained_incomplete_types = true;
-   }
}
 
  tag.id = b-id;
Index: gcc/testsuite/gcc.dg/parm-incomplete-1.c
===
--- gcc/testsuite/gcc.dg/parm-incomplete-1.c(revision 219059)
+++ gcc/testsuite/gcc.dg/parm-incomplete-1.c(working copy)
@@ -17,7 +17,6 @@ struct s { int b; };
 void h (struct s x) { }
 
 void j(struct t2); /* { dg-warning 'struct t2' declared inside parameter 
list } */
-/* { dg-warning its scope is only explanation { target *-*-* } 19 } */
 
 union u;
 
Index: gcc/testsuite/gcc.dg/pr18809-1.c
===
--- gcc/testsuite/gcc.dg/pr18809-1.c(revision 219059)
+++ gcc/testsuite/gcc.dg/pr18809-1.c(working copy)
@@ -5,6 +5,5 @@
 
 void foo(enum E e) {}   /* { dg-error forward ref forward } */
/* { dg-warning declared declared { target *-*-* } 
6 } */
-   /* { dg-warning scope scope { target *-*-* } 6 } */
/* { dg-error incomplete incomplete { target *-*-* 
} 6 } */
 void bar() { foo(0); }
Index: gcc/testsuite/gcc.dg/pr27953.c
===
--- gcc/testsuite/gcc.dg/pr27953.c  (revision 219059)
+++ gcc/testsuite/gcc.dg/pr27953.c  (working copy)
@@ -1,7 +1,6 @@
 /* PR c/27953 */
 
 void foo(struct A a) {}  /* { dg-warning declared inside parameter list 
inside } */
-/* { dg-warning its scope is only scope { target *-*-* } 3 } */
 /* { dg-error incomplete type incomplete { target *-*-* } 3 } */
 
 void foo() {}/* { dg-error redefinition redef } */
Index: gcc/testsuite/gcc.dg/vla-11.c
===
--- gcc/testsuite/gcc.dg/vla-11.c   (revision 219059)
+++ gcc/testsuite/gcc.dg/vla-11.c   (working copy)
@@ -10,4 +10,3 @@ void foo11a(int x[sizeof(int *(*)[*])]);  /* { dg-w
 void foo11b(__SIZE_TYPE__ x, int y[(__UINTPTR_TYPE__)(int (*)[*])x]);  /* { 
dg-warning not in a declaration } */
 void foo11c(struct s { int (*x)[*]; } *y); /* { dg-error a member of a 
structure or union cannot have a variably modified type variably modified } 
*/
 /* { dg-warning 'struct s' declared inside parameter list struct decl { 
target *-*-* } 11 } */
-/* { dg-warning its scope is only this definition or declaration struct 
scope { target *-*-* } 11 } */


[SH][committed] Fix pr51244-12.c failures on SH2A

2014-12-24 Thread Oleg Endo
Hi,

Attached patch fixes the failures on SH2A that started to show recently
in the gcc.target/sh/pr51244-12.c test case.  Tested with
make -k check-gcc RUNTESTFLAGS=--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}
Committed as r219062.

Cheers,
Oleg

gcc/ChangeLog:
PR target/51244
* config/sh/sh.md (*mov_t_msb_neg): Convert split into insn_and_split.
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 219029)
+++ gcc/config/sh/sh.md	(working copy)
@@ -11601,8 +11601,8 @@
(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))])
 
 ;; Use negc to store the T bit in a MSB of a reg in the following way:
-;;	T = 1: 0x8000 - reg
-;;	T = 0: 0x7FFF - reg
+;;	T = 0: 0x8000 - reg
+;;	T = 1: 0x7FFF - reg
 ;; This works because 0 - 0x8000 = 0x8000.
 ;;
 ;; This insn must not match again after it has been split into the constant
@@ -11635,27 +11635,27 @@
   negc	%1,%0
   [(set_attr type arith)])
 
-;; These are essentially the same as above, but with the inverted T bit.
-;; Combine recognizes the split patterns, but does not take them sometimes
-;; if the T_REG clobber is specified.  Instead it tries to split out the
-;; T bit negation.  Since these splits are supposed to be taken only by
-;; combine, it will see the T_REG clobber of the *mov_t_msb_neg insn, so this
-;; should be fine.
-(define_split
+(define_insn_and_split *mov_t_msb_neg
   [(set (match_operand:SI 0 arith_reg_dest)
 	(plus:SI (match_operand 1 negt_reg_operand)
-		 (const_int 2147483647)))]  ;; 0x7fff
-  TARGET_SH1  can_create_pseudo_p ()
+		 (const_int 2147483647)))  ;; 0x7fff
+   (clobber (reg:SI T_REG))]
+  TARGET_SH1
+   #
+can_create_pseudo_p ()
   [(parallel [(set (match_dup 0)
 		   (minus:SI (const_int -2147483648) (reg:SI T_REG)))
 	  (clobber (reg:SI T_REG))])])
 
-(define_split
+(define_insn_and_split *mov_t_msb_neg
   [(set (match_operand:SI 0 arith_reg_dest)
 	(if_then_else:SI (match_operand 1 t_reg_operand)
 			 (const_int 2147483647)  ;; 0x7fff
-			 (const_int -2147483648)))]  ;; 0x8000
-  TARGET_SH1  can_create_pseudo_p ()
+			 (const_int -2147483648)))  ;; 0x8000
+   (clobber (reg:SI T_REG))]
+  TARGET_SH1
+  #
+   can_create_pseudo_p ()
   [(parallel [(set (match_dup 0)
 		   (minus:SI (const_int -2147483648) (reg:SI T_REG)))
 	  (clobber (reg:SI T_REG))])])


[PATCH] ubsan: Do not run the testsuite if ubsan does not work at all

2014-12-24 Thread Segher Boessenkool
I normally build with --disable-libsanitizer, because the sanitizers
testresults are very unreproducable, so just annoying noise.  This however
makes most (all?) ubsan testcases fail, since they want to load a shared
library that does not exist.

This patch disables the ubsan testcases if a trivial program does not
run when compiled with ubsan.

Tested on powerpc64-linux, -m32,-m32/-mpowerpc64,-m64,-m64/-mlra;
5452 failures gone, no other changes.

Okay for mainline?


Segher


2014-12-24  Segher Boessenkool  seg...@kernel.crashing.org

gcc/testsuite/
* lib/ubsan-dg.exp (check_effective_target_fsanitize_undefined):
Check if testcases run without errors, not just if they compile.

---
 gcc/testsuite/lib/ubsan-dg.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp
index 3bfdcc8..cea3e0e 100644
--- a/gcc/testsuite/lib/ubsan-dg.exp
+++ b/gcc/testsuite/lib/ubsan-dg.exp
@@ -18,7 +18,7 @@
 # code, 0 otherwise.
 
 proc check_effective_target_fsanitize_undefined {} {
-return [check_no_compiler_messages fsanitize_undefined executable {
+return [check_runtime fsanitize_undefined {
int main (void) { return 0; }
 } -fsanitize=undefined]
 }
-- 
1.8.1.4



C++ PATCH for c++/63522 (ICE with unexpanded parameter pack)

2014-12-24 Thread Jason Merrill
Things later in compilation were getting confused because we didn't 
catch the unexpanded parameter pack soon enough.


While looking at this I also fixed a location issue with the error about 
a parameter pack before the end of a class template parameter list, and 
avoided some follow-on errors when a template parameter is erroneous.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 93c26661038b76775f56a4a277ee78aa03b23578
Author: Jason Merrill ja...@redhat.com
Date:   Mon Dec 22 21:41:40 2014 -0500

	PR c++/63522
	* parser.c (cp_parser_type_parameter): Call
	check_for_bare_parameter_packs on default argument.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e57a5bd..2af1576 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13499,6 +13499,8 @@ cp_parser_type_parameter (cp_parser* parser, bool *is_parameter_pack)
 			default arguments);
 default_argument = NULL_TREE;
   }
+	else if (check_for_bare_parameter_packs (default_argument))
+	  default_argument = error_mark_node;
 	pop_deferring_access_checks ();
 	  }
 	else
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic164.C b/gcc/testsuite/g++.dg/cpp0x/variadic164.C
new file mode 100644
index 000..8f9cdb1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic164.C
@@ -0,0 +1,12 @@
+// PR c++/63522
+// { dg-do compile { target c++11 } }
+
+template typename... struct tuple;
+template typename... void slice();
+template int Index, typename... using slice_result = decltype(sliceIndex);
+template typename Tuple, typename... Tuples, int... ElementIndices,
+  typename =
+  typename tupleslice_resultElementIndices, Tuples...,
+ slice_resultElementIndices, Tuples..::type // { dg-error parameter pack }
+void zip_with(Tuple...);
+decltype(zip_with(0)) d;	// { dg-error no match }
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34052.C b/gcc/testsuite/g++.dg/cpp0x/vt-34052.C
index 1036537..31d2831 100644
--- a/gcc/testsuite/g++.dg/cpp0x/vt-34052.C
+++ b/gcc/testsuite/g++.dg/cpp0x/vt-34052.C
@@ -1,8 +1,8 @@
 // { dg-do compile { target c++11 } }
-templatetypename... T, typename = T struct A {}; // { dg-error must be at the end }
+templatetypename... T, typename = T struct A {}; // { dg-error parameter pack }
 
 
-templatetemplatetypename... T, typename = T class U struct B // { dg-error must be at the end }
+templatetemplatetypename... T, typename = T class U struct B // { dg-error parameter pack }
 {
-  templateint Uint foo(); // { dg-error mismatch|constant|invalid|invalid }
+  templateint Uint foo(); // { dg-error mismatch|constant|wrong|invalid }
 };

commit 9fede37842c061ad13cf7ee82d9d94befc68463d
Author: Jason Merrill ja...@redhat.com
Date:   Tue Dec 23 13:50:27 2014 -0500

	* pt.c (check_default_tmpl_args): Uses the parameter source
	location in the diagnostic.
	(convert_template_argument): Just return if parm is error_mark_node.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f5bd842..21d0d3a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4578,13 +4578,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
 		 parameter pack, at the end of the template
 		 parameter list.  */
 
-		  if (TREE_CODE (TREE_VALUE (parm)) == PARM_DECL)
-		error (parameter pack %qE must be at the end of the
-			template parameter list, TREE_VALUE (parm));
-		  else
-		error (parameter pack %qT must be at the end of the
-			template parameter list, 
-			   TREE_TYPE (TREE_VALUE (parm)));
+		  error (parameter pack %q+D must be at the end of the
+			  template parameter list, TREE_VALUE (parm));
 
 		  TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) 
 		= error_mark_node;
@@ -6524,6 +6519,9 @@ convert_template_argument (tree parm,
   tree val;
   int is_type, requires_type, is_tmpl_type, requires_tmpl_type;
 
+  if (parm == error_mark_node)
+return error_mark_node;
+
   if (TREE_CODE (arg) == TREE_LIST
TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF)
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31432.C b/gcc/testsuite/g++.dg/cpp0x/pr31432.C
index 1f2ea50..2048077 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr31432.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr31432.C
@@ -4,5 +4,5 @@ templatetypename..., typename struct A // { dg-error parameter pack }
  static int i;
 };
 
-Aint, int a; // { dg-error mismatch|expected|invalid type }
-Achar,int b; // { dg-error mismatch|expected|invalid type }
+Aint, int a;
+Achar,int b;
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31442.C b/gcc/testsuite/g++.dg/cpp0x/pr31442.C
index 7fd20e7..b4c737c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr31442.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr31442.C
@@ -6,4 +6,4 @@ struct B
   template template typename... class C B(Cint);
 };
 
-B b = Aint(); // { dg-error mismatch|expected }
+B b = Aint();
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr32115.C b/gcc/testsuite/g++.dg/cpp0x/pr32115.C
index 5722aa3..fafa4ee 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr32115.C

Re: [PATCH] pr31397 - implement -Wsuggest-override

2014-12-24 Thread Jason Merrill

OK.

Jason