Re: [testsuite, android] Disabling thread_local4.C and thread_local4g.C for Android.

2013-07-14 Thread Maxim Kuvyrkov
On 13/07/2013, at 10:34 AM, Mike Stump wrote:

> On Jun 20, 2013, at 4:30 AM, Alexander Ivchenko  wrote:
>> for Android:
> 
>> +2013-06-19  Alexander Ivchenko  
>> +
>> +   * g++.dg/tls/thread_local4.C: Disable test for Android.
>> +   * g++.dg/tls/thread_local4g.C: Ditto.
> 
>> is it ok for trunk?
> 
> Ok.

Alexander,

Your current patch as approved by Mike is OK, but it is more prudent to 
condition the tests on using Bionic libc, not the fact that target triplet has 
*-android* in it.  [E.g., it is possible to build a toolchain for, say, 
arm-linux-gnueabi which will use glibc for primary multilib, and bionic for 
secondary multilib.]

I didn't test the attached patch, so please confirm that it behaves as expected 
before applying it.

Thank you,

--
Maxim Kuvyrkov
KugelWorks



0001-Disable-tests-that-require-cancellation-when-using-B.patch
Description: Binary data


[PATCH][2/3] Re-submission of Altera Nios II port, testsuite parts

2013-07-14 Thread Chung-Lin Tang
These are nios2 patches for the gcc testsuite. Some new testcases were
added since the last posting.

Chung-Lin

2013-07-14  Sandra Loosemore  
Chung-Lin Tang  
Based on patches from Altera Corporation

* gcc.dg/stack-usage-1.c (SIZE): Define case for __nios2__.
* gcc.dg/20040813-1.c: Skip for nios2-*-*.
* gcc.dg/20020312-2.c: Add __nios2__ case.
* g++.dg/other/PR23205.C: Skip for nios2-*-*.
* g++.dg/other/pr23205-2.C: Skip for nios2-*-*.
* g++.dg/cpp0x/constexpr-rom.C: Skip for nios2-*-*.
* g++.dg/cpp0x/alias-decl-debug-0.C: Skip for nios2-*-*.
* g++.old-deja/g++.jason/thunk3.C: Skip for nios2-*-*.
* lib/target-supports.exp (check_profiling_available): Check for
nios2-*-elf.
* gcc.c-torture/execute/pr47237.x:: Skip for nios2-*-*.
* gcc.c-torture/execute/20101011-1.c: Skip for nios2-*-*.
* gcc.c-torture/execute/builtins/lib/chk.c (memset): Place
char-based memset loop before inline check, to prevent
problems when called to initialize .bss. Update comments.
* gcc.target/nios2/nios2.exp: New DejaGNU file.
* gcc.target/nios2/nios2-custom-1.c: New test.
* gcc.target/nios2/nios2-trap-insn.c: New test.
* gcc.target/nios2/nios2-builtin-custom.c: New test.
* gcc.target/nios2/nios2-builtin-io.c: New test.
* gcc.target/nios2/nios2-stack-check-1.c: New test.
* gcc.target/nios2/nios2-stack-check-2.c: New test.
* gcc.target/nios2/nios2-rdctl.c: New test.
* gcc.target/nios2/nios2-wrctl.c: New test.
* gcc.target/nios2/nios2-wrctl-zero.c: New test.
* gcc.target/nios2/nios2-wrctl-not-zero.c: New test.
* gcc.target/nios2/nios2-rdwrctl-1.c: New test.
* gcc.target/nios2/nios2-reg-constraints.c: New test.
* gcc.target/nios2/nios2-ashlsi3-one_shift.c: New test.
* gcc.target/nios2/nios2-mul-options-1.c: New test.
* gcc.target/nios2/nios2-mul-options-2.c: New test.
* gcc.target/nios2/nios2-mul-options-3.c: New test.
* gcc.target/nios2/nios2-mul-options-4.c: New test.
* gcc.target/nios2/nios2-nor.c: New test.
* gcc.target/nios2/nios2-stxio.c: New test.
* gcc.target/nios2/custom-fp-1.c: New test.
* gcc.target/nios2/custom-fp-2.c: New test.
* gcc.target/nios2/custom-fp-3.c: New test.
* gcc.target/nios2/custom-fp-4.c: New test.
* gcc.target/nios2/custom-fp-5.c: New test.
* gcc.target/nios2/custom-fp-6.c: New test.
* gcc.target/nios2/custom-fp-7.c: New test.
* gcc.target/nios2/custom-fp-8.c: New test.
* gcc.target/nios2/custom-fp-cmp-1.c: New test.
* gcc.target/nios2/custom-fp-conversion.c: New test.
* gcc.target/nios2/custom-fp-double.c: New test.
* gcc.target/nios2/custom-fp-float.c: New test.
* gcc.target/nios2/nios2-int-types.c: New test.
* gcc.target/nios2/nios2-cache-1.c: New test.
* gcc.target/nios2/nios2-cache-2.c: New test.
Index: gcc/testsuite/g++.old-deja/g++.jason/thunk3.C
===
--- gcc/testsuite/g++.old-deja/g++.jason/thunk3.C   (revision 200946)
+++ gcc/testsuite/g++.old-deja/g++.jason/thunk3.C   (working copy)
@@ -1,5 +1,5 @@
 // { dg-do run }
-// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi 
v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } { "*" } { "" 
} }
+// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi 
v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* nios2-*-* } { 
"*" } { "" } }
 // Test that variadic function calls using thunks work right.
 // Note that this will break on any target that uses the generic thunk
 //  support, because it doesn't support variadic functions.
Index: gcc/testsuite/lib/target-supports.exp
===
--- gcc/testsuite/lib/target-supports.exp   (revision 200946)
+++ gcc/testsuite/lib/target-supports.exp   (working copy)
@@ -529,6 +529,7 @@ proc check_profiling_available { test_what } {
 || [istarget mmix-*-*]
 || [istarget mn10300-*-elf*]
 || [istarget moxie-*-elf*]
+|| [istarget nios2-*-elf]
 || [istarget picochip-*-*]
 || [istarget powerpc-*-eabi*]
 || [istarget powerpc-*-elf]
Index: gcc/testsuite/gcc.c-torture/execute/20101011-1.c
===
--- gcc/testsuite/gcc.c-torture/execute/20101011-1.c(revision 200946)
+++ gcc/testsuite/gcc.c-torture/execute/20101011-1.c(working copy)
@@ -61,6 +61,10 @@ __aeabi_idiv0 (int return_value)
 }
 #  define DO_TEST 1
 # endif
+#elif defined (__nios2__)
+  /* Nios II requires both hardware support and user configuration to
+ raise an exception on divide by zero.  

[PATCH][3/3] Re-submission of Altera Nios II port, libgcc parts

2013-07-14 Thread Chung-Lin Tang
nios2 libgcc parts. Since the original post, the only main change has
been the fdpbit vs soft-fp issue raised by Joseph, which has been
resolved. Other parts are mostly the same.

Thanks,
Chung-Lin

2013-07-14  Sandra Loosemore  
Chung-Lin Tang  
Based on patches from Altera Corporation

* config.host (nios2-*-*,nios2-*-linux*): Add nios2 host cases.
* config/nios2/lib2-nios2.h: New file.
* config/nios2/lib2-divmod-hi.c: New file.
* config/nios2/linux-unwind.h: New file.
* config/nios2/lib2-divmod.c: New file.
* config/nios2/linux-atomic.c: New file.
* config/nios2/t-nios2: New file.
* config/nios2/crti.asm: New file.
* config/nios2/t-linux: New file.
* config/nios2/lib2-divtable.c: New file.
* config/nios2/lib2-mul.c: New file.
* config/nios2/tramp.c: New file.
* config/nios2/crtn.asm: New file.
Index: libgcc/config/nios2/lib2-nios2.h
===
--- libgcc/config/nios2/lib2-nios2.h(revision 0)
+++ libgcc/config/nios2/lib2-nios2.h(revision 0)
@@ -0,0 +1,49 @@
+/* Integer arithmetic support for Altera Nios II.
+   
+   Copyright (C) 2012-2013 Free Software Foundation, Inc.
+   Contributed by Altera and Mentor Graphics, Inc.
+
+   This file is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 3, or (at your option) any
+   later version.
+   
+   This file is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+   
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   . */
+
+#ifndef LIB2_NIOS2_H
+#define LIB2_NIOS2_H
+
+/* Types.  */
+
+typedef char QItype __attribute__ ((mode (QI)));
+typedef unsigned char UQItype __attribute__ ((mode (QI)));
+typedef short HItype __attribute__ ((mode (HI)));
+typedef unsigned short UHItype __attribute__ ((mode (HI)));
+typedef int SItype __attribute__ ((mode (SI)));
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+/* Exported functions.  */
+extern SItype __divsi3 (SItype, SItype);
+extern SItype __modsi3 (SItype, SItype);
+extern SItype __udivsi3 (SItype, SItype);
+extern SItype __umodsi3 (SItype, SItype);
+extern HItype __divhi3 (HItype, HItype);
+extern HItype __modhi3 (HItype, HItype);
+extern UHItype __udivhi3 (UHItype, UHItype);
+extern UHItype __umodhi3 (UHItype, UHItype);
+extern SItype __mulsi3 (SItype, SItype);
+
+#endif /* LIB2_NIOS2_H */
Index: libgcc/config/nios2/crtn.S
===
--- libgcc/config/nios2/crtn.S  (revision 0)
+++ libgcc/config/nios2/crtn.S  (revision 0)
@@ -0,0 +1,60 @@
+/* Copyright (C) 2012-2013 Free Software Foundation, Inc.
+   Contributed by Jonah Graham (jgra...@altera.com).
+   Contributed by Mentor Graphics, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+.  */
+
+
+/* This file just makes sure that the .fini and .init sections do in
+fact return.  Users may put any desired instructions in those sections.
+This file is the last thing linked into any executable.
+*/ 
+   .file   "crtn.asm"
+
+
+
+   .section".init"
+   ldw ra, 44(sp)
+   ldw r23, 40(sp)
+   ldw r22, 36(sp)
+   ldw r21, 32(sp)
+   ldw r20, 28(sp)
+   ldw r19, 24(sp)
+   ldw r18, 20(sp)
+   ldw r17, 16(sp)
+   ldw r16, 12(sp)
+   ldw fp

[PATCH] Hexadecimal numbers in option arguments

2013-07-14 Thread Chung-Lin Tang
Original patch posted as part of Nios II patches:
http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01087.html

This patch is to allow hexadecimal numbers to be used in option
arguments, e.g. -falign-loops=0x10 can now be used as equivalent to
-falign-loops=16.

Joseph, the patch has been modified to use IXDIGIT to check the argument
string first, as you suggested in the last submission. Is this okay for
trunk?

Thanks,
Chung-Lin

2013-07-14  Chung-Lin Tang  

* opts-common.c (integral_argument): Add support for hexadecimal
command option integer arguments. Update comments.
Index: opts-common.c
===
--- opts-common.c	(revision 200946)
+++ opts-common.c	(working copy)
@@ -147,7 +147,7 @@ find_opt (const char *input, unsigned int lang_mas
   return match_wrong_lang;
 }
 
-/* If ARG is a non-negative integer made up solely of digits, return its
+/* If ARG is a non-negative decimal or hexadecimal integer, return its
value, otherwise return -1.  */
 
 int
@@ -161,6 +161,17 @@ integral_argument (const char *arg)
   if (*p == '\0')
 return atoi (arg);
 
+  /* It wasn't a decimal number - try hexadecimal.  */
+  if (arg[0] == '0' && (arg[1] == 'x' || arg[1] == 'X'))
+{
+  p = arg + 2;
+  while (*p && ISXDIGIT (*p))
+	p++;
+
+  if (*p == '\0')
+	return strtol (arg, NULL, 16);
+}
+
   return -1;
 }
 


Re: [PATCH] PR32219, weak hidden reference segfault [PING^2]

2013-07-14 Thread Chung-Lin Tang
Ping.

On 2013/6/20 03:01 PM, Chung-Lin Tang wrote:
> Ping again?
> 
> On 13/6/11 5:20 PM, Bernhard Reutner-Fischer wrote:
>> ping, CCing middle-end maintainers for review.
>>
>> On 31 May 2013 10:13, Chung-Lin Tang  wrote:
>>> On 13/5/15 8:12 PM, Richard Sandiford wrote:
 Chung-Lin Tang  writes:
> On 13/5/10 6:37 PM, Richard Sandiford wrote:
>> Chung-Lin Tang  writes:
>>> +case UNSPEC:
>>> +  /* Reach for a contained symbol.  */
>>> +  return nonzero_address_p (XVECEXP (x, 0, 0));
>>
>> I don't think this is safe.  UNSPECs really are unspecified :-),
>> so we can't assume that (unspec X) is nonzero simply because X is.
>
> Attached is a modified patch (not yet tested but just for demonstration)
> with a more specific test, hopefully regarded as more safe.
>
> The point is in recognizing (const (unspec [symbol] XYZ)) offsets in PIC
> references, which seems quite idiomatic across all targets by now.

 I agree this is safer.  However, there used to be some ports that
 use (plus pic_offset_table_rtx (symbol_ref X)) -- i.e. without an unspec --
 to represent a PIC reference to X.  That always seemed semantically wrong,
 since you're not actually adding the address of X and the PIC register,
 but the patch wouldn't handle that case correctly.
>>>
>>> Well I can't help those targets then, but at least nothing will be
>>> changed for them by this patch. It will just continue to return 'true'.
>>>
 An alternative might be to remove the pic_offset_table_rtx case altogether
 and rely on targetm.delegitimize_address instead.  FWIW, I'd prefer that
 if it works, but it's not me you need to convince. :-)
>>>
>>> Like we discussed below, I think the direction should be towards making
>>> things more machine-independent, rather then pushing more into the backend.
>>>
> I would suggest that this probably means there should be a new, more
> specific construct in RTL to represent relocation values of this kind,
> instead of (const (unspec)) serving an unofficial role; possibly some
> real support for reasoning about PIC references could also be considered.

 Yeah, maybe we could try to introduce some target-independent knowledge
 of certain reloc types, a bit like the generic BFD_RELOC_*s in bfd.
>>>
>>>
>>> FWIW, I've ran tests on the newer patch on i686-linux, with no
>>> regressions. Testcase has been moved to gcc.dg/torture by recommendation
>>> of Bernhard. If any of the RTL maintainers can give an eye of merciful
>>> approval, this old PR could be resolved :)
>>>
>>> Thanks,
>>> Chung-Lin
>>>
> 



[Patch testsuite/objc/objc++] some objc/objcxx testsuite TLC re. PRs 55654,55656,55657

2013-07-14 Thread Iain Sandoe
Hi,

The NeXT Objective C runtime and its interfaces have been evolving - and, in 
particular, interfaces deprecated at Darwin9 have now been removed from recent 
Darwin/OSX implementations.

The following patch:
(a) exchanges the use of Object with NSObject where appropriate, for Darwin 
platforms.
(b) avoids the use of ***

tested on x86_64-unknown-linux-gnu, darwin 9 (ppc/x86) 10 and 12 (I don't 
currently have a copy of Darwin11, but believe bases should be adequately 
covered).

A few of the fails reported in the PRs enumerated are real regressions; this 
patch only addresses resolution of issues related to interface changes in the 
libraries.

OK for trunk?
OK for open branches? (this was reported against 4.8)

cheers
Iain

*** Foundation/Foundation.h for Darwin >= 11 (OSX 10.7) now depends on blocks 
support in the compiler, which represents a significant challenge.

---

gcc/testsuite/

2013-07-14  Iain Sandoe  

PR target/55654
PR target/55656
PR target/55657
* obj-c++.dg/cxx-ivars-3.mm: Use NSObject instead of Object.
* obj-c++.dg/strings/const-cfstring-5.mm: Likewise.
* obj-c++.dg/torture/strings/const-str-10.mm: Likewise.
* obj-c++.dg/torture/strings/const-str-9.mm: Likewise.
* objc.dg/image-info.m: Likewise.
* objc.dg/symtab-1.m: Likewise.
* objc.dg/torture/strings/const-str-10.m: Likewise.
* objc.dg/torture/strings/const-str-11.m: Likewise.
* objc.dg/torture/strings/const-str-9.m: Likewise.
* objc.dg/zero-link-1.m: Likewise.
* objc.dg/zero-link-2.m: Likewise.
* objc.dg/no-extra-load.m: Avoid Foundation.h.
* objc.dg/objc-foreach-4.m: Likewise.
* objc.dg/objc-foreach-5.m: Likewise.
* obj-c++.dg/proto-lossage-7.mm: Use NSObject instead of Object (for 
Darwin).
* obj-c++.dg/strings/const-str-12.mm: Likewise.
* obj-c++.dg/syntax-error-1.mm: Likewise.
* objc.dg/method-6.m: Likewise.
* objc.dg/pr23214.m: Likewise.
* objc.dg/proto-lossage-7.m: Likewise.
* objc.dg/strings/const-str-12b.m: Likewise.
* objc.dg/zero-link-3.m: Likewise.
* obj-c++.dg/method-12.mm: Skip on Darwin versions without 'Object'.
* objc.dg/encode-7-next-64bit.m: Use NSObject instead of Object, adjust 
headers,
interfaces and encoded types to reflect current system versions.  Add 
FIXME and
outputs from current system compiler for reference.

diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm 
b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
index e94e6ec..0098349 100644
--- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
+++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
@@ -2,12 +2,15 @@
 
 // { dg-do run { target *-*-darwin* } }
 // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
-// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" }
+// { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 
-framework Foundation" }
 // This test has no equivalent or meaning for m64/ABI V2
 // { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { 
"-fnext-runtime" } { "" } }
 
 #include 
 #include 
+#include 
+
+//extern "C" { int printf(const char *,...); }
 #define CHECK_IF(expr) if(!(expr)) abort()
 
 #ifndef CLS_HAS_CXX_STRUCTORS
@@ -19,7 +22,7 @@ struct cxx_struct {
   cxx_struct (void) { a = b = 55; }
 };
 
-@interface Foo {
+@interface Foo: NSObject {
   int c;
   cxx_struct s;
 }
@@ -42,9 +45,11 @@ int main (void)
   Class cls;
 
   cls = objc_getClass("Foo");
-  CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
+//  printf((const char *)"Foo info %lx\n",cls->info);
+  CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) != 0);
   cls = objc_getClass("Bar");
-  CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
+//  printf((const char *)"Bar info %lx\n",cls->info);
+  CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) == 0);
 
 #else
   /* No test needed or available.  */
diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm 
b/gcc/testsuite/obj-c++.dg/method-12.mm
index c1f2a39..6cdb0f9 100644
--- a/gcc/testsuite/obj-c++.dg/method-12.mm
+++ b/gcc/testsuite/obj-c++.dg/method-12.mm
@@ -2,6 +2,7 @@
 /* Author: Ziemowit Laski   */
 /* { dg-options "-Wstrict-selector-match" } */
 /* { dg-do compile } */
+/* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { 
"-fnext-runtime" } { "" } } */
 
 #include 
 
@@ -19,13 +20,13 @@ void foo(void) {
   Class receiver;
 
   [receiver port];  /* { dg-warning "multiple methods named .\\+port. found" } 
*/
-   /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target 
*-*-* } 9 } */
-   /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target 
*-*-* } 14 } */
+   /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target 
*-*-* } 10 } */
+   /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target 
*-*-* } 15 } */
 
   [receiver starboard];  /* { dg-warning "no .\\+starboard. method foun

Re: [PATCH] Hexadecimal numbers in option arguments

2013-07-14 Thread Joseph S. Myers
On Sun, 14 Jul 2013, Chung-Lin Tang wrote:

> Original patch posted as part of Nios II patches:
> http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01087.html
> 
> This patch is to allow hexadecimal numbers to be used in option
> arguments, e.g. -falign-loops=0x10 can now be used as equivalent to
> -falign-loops=16.
> 
> Joseph, the patch has been modified to use IXDIGIT to check the argument
> string first, as you suggested in the last submission. Is this okay for
> trunk?

This version looks like it will allow plain "0x" or "0X" as an argument, 
treating it as 0, rather than treating it as an error (i.e., you need to 
check there is at least one hex digit after the "0x" or "0X" before 
passing the string to strtol).

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


Re: [ubsan] Instrument __builtin_unreachable

2013-07-14 Thread Jakub Jelinek
On Sun, Jul 14, 2013 at 07:39:38AM +0200, Marek Polacek wrote:
> This patch implements sanitizing of the __builtin_unreachable call.
> A call to __builtin_unreachable only emits BARRIER, if we actually get to it,
> the behavior is undefined.  So, we just replace the call with a call to
> the ubsan library, it then issues an error and dies.
> 
> The patch is long because I had to pluck some code out of c-family/c-ubsan.c
> (otherwise we couldn't call ubsan_* routines from builtins.c), I've put
> the code into ubsan.c.
> 
> Commited to ubsan branch.  Comments?

> --- gcc/builtins.c.mp 2013-07-13 20:01:33.862643705 +0200
> +++ gcc/builtins.c2013-07-14 03:11:23.471284429 +0200
> @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.
>  #include "value-prof.h"
>  #include "diagnostic-core.h"
>  #include "builtins.h"
> +#include "ubsan.h"

You haven't added builtins.o : ubsan.h dependency to the Makefile.in.
Please double check that for the C/C++ files you've added #include
in the past you have it recorded in Makefile.in too.

>  #ifndef PAD_VARARGS_DOWN
> @@ -10281,6 +10282,11 @@ fold_builtin_0 (location_t loc, tree fnd
>  case BUILT_IN_CLASSIFY_TYPE:
>return fold_builtin_classify_type (NULL_TREE);
>  
> +case BUILT_IN_UNREACHABLE:
> +  if (flag_sanitize & SANITIZE_UNDEFINED)
> + return ubsan_instrument_unreachable (loc);
> +  break;

If you have committed your fsanitize= option handling patch,
I'd expect the above to be actually SANITIZE_UNREACHABLE or
whatever the option is plus changes to add SANITIZE_UNREACHABLE
to SANITIZE_UNDEFINED, and parsing unrechable string in *opts.c.

Otherwise it looks good to me.

Jakub


Re: [gomp4] Fix up #pragma omp declare simd parsing

2013-07-14 Thread Jason Merrill

OK.

Jason


Re: [PATCH] [lambda] Extract lambda functions from semantics.c.

2013-07-14 Thread Jason Merrill

Applied, thanks.

Jason


Re: [PATCH] Add command line parsing of -fsanitize

2013-07-14 Thread Joseph S. Myers
On Sat, 13 Jul 2013, Jakub Jelinek wrote:

> Here is a patch that implements that (of course on top of Marek's patch from
> June).
> 
> 2013-07-13  Jakub Jelinek  
> 
>   * gcc.c: Document %{%:function(args):X}.
>   (SANITIZER_EARLY_SPEC, SANITIZER_SPEC): Use %:sanitize(address)
>   instead of fsanitize=address and %:sanitize(thread) instead of
>   fsanitize=thread.
>   (static_spec_functions): Add sanitize.
>   (handle_spec_function): Add retval_nonnull argument and if non-NULL,
>   store funcval != NULL there.
>   (do_spec_1): Adjust handle_spec_function caller.
>   (handle_braces): Allow %:function(args) as condition.
>   (sanitize_spec_function): New function.
>   * common.opt (fsanitize=): Add Driver.
>   * config/darwin.h (LINK_COMMAND_SPEC_A): Use %:sanitize(address)
>   instead of fsanitize=address.
>   * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Use %:sanitize(address)
>   instead of fsanitize=address*.

This seems fine to me.

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


Re: [PATCH] PR32219, weak hidden reference segfault [PING^2]

2013-07-14 Thread Diego Novillo
On Sun, Jul 14, 2013 at 2:08 AM, Chung-Lin Tang  wrote:
> Ping.

Could you please repost the patch with its description?  This thread
is sufficiently old and noisy that I'm not even sure what the patch
does nor why.


Thanks.  Diego.


Re: [ubsan] Instrument __builtin_unreachable

2013-07-14 Thread Marek Polacek
On Sun, Jul 14, 2013 at 03:44:40PM +0200, Jakub Jelinek wrote:
> On Sun, Jul 14, 2013 at 07:39:38AM +0200, Marek Polacek wrote:
> > This patch implements sanitizing of the __builtin_unreachable call.
> > A call to __builtin_unreachable only emits BARRIER, if we actually get to 
> > it,
> > the behavior is undefined.  So, we just replace the call with a call to
> > the ubsan library, it then issues an error and dies.
> > 
> > The patch is long because I had to pluck some code out of c-family/c-ubsan.c
> > (otherwise we couldn't call ubsan_* routines from builtins.c), I've put
> > the code into ubsan.c.
> > 
> > Commited to ubsan branch.  Comments?
> 
> > --- gcc/builtins.c.mp   2013-07-13 20:01:33.862643705 +0200
> > +++ gcc/builtins.c  2013-07-14 03:11:23.471284429 +0200
> > @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.
> >  #include "value-prof.h"
> >  #include "diagnostic-core.h"
> >  #include "builtins.h"
> > +#include "ubsan.h"
> 
> You haven't added builtins.o : ubsan.h dependency to the Makefile.in.
> Please double check that for the C/C++ files you've added #include
> in the past you have it recorded in Makefile.in too.

Yeah, fixed with:

2013-07-14  Marek Polacek  

* Makefile.in (c-family/c-ubsan.o): Add alloc-pool.h, CGRAPH_H,
GIMPLE_H, HASH_TABLE_H, output.h, toplev.h and ubsan.h dependencies.
(builtins.o): Add ubsan.h dependency.

--- gcc/Makefile.in.mp  2013-07-14 18:09:19.770341832 +0200
+++ gcc/Makefile.in 2013-07-14 18:15:04.330055011 +0200
@@ -2023,8 +2023,9 @@ c-family/stub-objc.o : c-family/stub-obj
coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-objc.h
 
 c-family/c-ubsan.o : c-family/c-ubsan.c $(CONFIG_H) $(SYSTEM_H) \
-   coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-ubsan.h
-
+   coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-ubsan.h \
+   alloc-pool.h $(CGRAPH_H) $(GIMPLE_H) $(HASH_TABLE_H) output.h \
+   toplev.h ubsan.h
 default-c.o: config/default-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(C_TARGET_H) $(C_TARGET_DEF_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
@@ -2261,11 +2262,11 @@ tsan.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_
$(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_PASS_H) $(CGRAPH_H) $(GGC_H) \
$(BASIC_BLOCK_H) $(FLAGS_H) $(FUNCTION_H) \
$(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) tree-iterator.h \
-   intl.h cfghooks.h output.h options.h c-family/c-common.h tsan.h asan.h \
+   intl.h cfghooks.h output.h options.h $(C_COMMON_H) tsan.h asan.h \
tree-ssa-propagate.h
 ubsan.o : ubsan.c ubsan.h $(CONFIG_H) $(SYSTEM_H) $(GIMPLE_H) \
output.h coretypes.h $(TREE_H) alloc-pool.h $(CGRAPH_H) $(HASH_TABLE_H) \
-   toplev.h c-family/c-common.h c-family/c-ubsan.h
+   toplev.h $(C_COMMON_H)
 tree-ssa-tail-merge.o: tree-ssa-tail-merge.c \
$(SYSTEM_H) $(CONFIG_H) coretypes.h $(TM_H) $(BITMAP_H) \
$(FLAGS_H) $(TM_P_H) $(BASIC_BLOCK_H) $(CFGLOOP_H) \
@@ -2823,7 +2824,7 @@ builtins.o : builtins.c builtins.h $(CON
hard-reg-set.h $(DIAGNOSTIC_CORE_H) hard-reg-set.h $(EXCEPT_H) \
$(TM_P_H) $(PREDICT_H) $(LIBFUNCS_H) langhooks.h $(BASIC_BLOCK_H) \
tree-mudflap.h realmpfr.h $(BUILTINS_DEF) $(MACHMODE_H) \
-   $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) value-prof.h
+   $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) value-prof.h ubsan.h
 calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
$(LIBFUNCS_H) $(REGS_H) $(DIAGNOSTIC_CORE_H) output.h \

> >  #ifndef PAD_VARARGS_DOWN
> > @@ -10281,6 +10282,11 @@ fold_builtin_0 (location_t loc, tree fnd
> >  case BUILT_IN_CLASSIFY_TYPE:
> >return fold_builtin_classify_type (NULL_TREE);
> >  
> > +case BUILT_IN_UNREACHABLE:
> > +  if (flag_sanitize & SANITIZE_UNDEFINED)
> > +   return ubsan_instrument_unreachable (loc);
> > +  break;
> 
> If you have committed your fsanitize= option handling patch,
> I'd expect the above to be actually SANITIZE_UNREACHABLE or
> whatever the option is plus changes to add SANITIZE_UNREACHABLE
> to SANITIZE_UNDEFINED, and parsing unrechable string in *opts.c.

Right, done with following patch.  Sorry for that.

2013-07-14  Marek Polacek  

* opts.c (common_handle_option): Add -fsanitize=unreachable option.
* builtins.c (fold_builtin_0): Use SANITIZE_UNREACHABLE instead of
SANITIZE_UNDEFINED.
* flag-types.h (enum sanitize_code): Add SANITIZE_UNREACHABLE.

--- gcc/opts.c.mp   2013-07-14 18:30:44.548918471 +0200
+++ gcc/opts.c  2013-07-14 18:31:39.483143160 +0200
@@ -1423,6 +1423,8 @@ common_handle_option (struct gcc_options
  { "integer-divide-by-zero", SANITIZE_DIVIDE,
sizeof "integer-divide-by-zero" - 1 },
  { "undefined", SANITIZE_UNDEFINED, sizeof "undefined" - 1 },
+ { "unreachable", SANITIZE_UNREACHABLE,
+   sizeof "unreachable" - 1 },
  { NULL, 0, 0 }
};

Re: [PATCH] Fix raw-string handling (PR preprocessor/57620)

2013-07-14 Thread Jakub Jelinek
On Thu, Jul 11, 2013 at 01:32:58AM +0200, Jakub Jelinek wrote:
> With this make check RUNTESTFLAGS=dg.exp=raw-string* passes, but perhaps
> I'll need to play with gcov and add some new testcases, e.g. ones
> I have in mind are R"??(??)??"; which wouldn't work correctly if we didn't
> stop consuming notes after seeing ??X other than ??/, also something to
> catch when we have say R"?(x)??)?" because then first char of the trigraph
> matches against raw_prefix, but second char isn't the expected ", yet the
> last character of trigraph ) should start another round of checking against
> raw_prefix.

Here is an updated version that has those 3 new tests in and actually
passed bootstrap/regtested on x86_64-linux and i686-linux.

2013-07-10  Jakub Jelinek  

PR preprocessor/57620
* lex.c (lex_raw_string): Undo phase1 and phase2 transformations
between R" and final " rather than only in between R"del( and )del".

* c-c++-common/raw-string-2.c (s12, u12, U12, L12): Remove.
(main): Don't test {s,u,U,L}12.
* c-c++-common/raw-string-13.c: New test.
* c-c++-common/raw-string-14.c: New test.
* c-c++-common/raw-string-15.c: New test.
* c-c++-common/raw-string-16.c: New test.

--- libcpp/lex.c.jj 2013-07-10 18:50:45.229759934 +0200
+++ libcpp/lex.c2013-07-11 03:17:08.253656448 +0200
@@ -1373,11 +1373,16 @@ static void
 lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
const uchar *cur)
 {
-  const uchar *raw_prefix;
-  unsigned int raw_prefix_len = 0;
+  uchar raw_prefix[17];
+  const uchar *orig_base;
+  unsigned int raw_prefix_len = 0, raw_suffix_len = 0;
+  enum raw_str_phase { RAW_STR_PREFIX, RAW_STR, RAW_STR_SUFFIX };
+  raw_str_phase phase = RAW_STR_PREFIX;
   enum cpp_ttype type;
   size_t total_len = 0;
   _cpp_buff *first_buff = NULL, *last_buff = NULL;
+  _cpp_buff *last_seen_buff = NULL;
+  size_t last_seen_len = 0, raw_suffix_start = 0, raw_prefix_start;
   _cpp_line_note *note = &pfile->buffer->notes[pfile->buffer->cur_note];
 
   type = (*base == 'L' ? CPP_WSTRING :
@@ -1385,57 +1390,6 @@ lex_raw_string (cpp_reader *pfile, cpp_t
  *base == 'u' ? (base[1] == '8' ? CPP_UTF8STRING : CPP_STRING16)
  : CPP_STRING);
 
-  raw_prefix = cur + 1;
-  while (raw_prefix_len < 16)
-{
-  switch (raw_prefix[raw_prefix_len])
-   {
-   case ' ': case '(': case ')': case '\\': case '\t':
-   case '\v': case '\f': case '\n': default:
- break;
-   /* Basic source charset except the above chars.  */
-   case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-   case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-   case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-   case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-   case 'y': case 'z':
-   case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-   case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-   case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-   case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-   case 'Y': case 'Z':
-   case '0': case '1': case '2': case '3': case '4': case '5':
-   case '6': case '7': case '8': case '9':
-   case '_': case '{': case '}': case '#': case '[': case ']':
-   case '<': case '>': case '%': case ':': case ';': case '.':
-   case '?': case '*': case '+': case '-': case '/': case '^':
-   case '&': case '|': case '~': case '!': case '=': case ',':
-   case '"': case '\'':
- raw_prefix_len++;
- continue;
-   }
-  break;
-}
-
-  if (raw_prefix[raw_prefix_len] != '(')
-{
-  int col = CPP_BUF_COLUMN (pfile->buffer, raw_prefix + raw_prefix_len)
-   + 1;
-  if (raw_prefix_len == 16)
-   cpp_error_with_line (pfile, CPP_DL_ERROR, token->src_loc, col,
-"raw string delimiter longer than 16 characters");
-  else
-   cpp_error_with_line (pfile, CPP_DL_ERROR, token->src_loc, col,
-"invalid character '%c' in raw string delimiter",
-(int) raw_prefix[raw_prefix_len]);
-  pfile->buffer->cur = raw_prefix - 1;
-  create_literal (pfile, token, base, raw_prefix - 1 - base, CPP_OTHER);
-  return;
-}
-
-  cur = raw_prefix + raw_prefix_len + 1;
-  for (;;)
-{
 #define BUF_APPEND(STR,LEN)\
   do { \
bufring_append (pfile, (const uchar *)(STR), (LEN), \
@@ -1443,10 +1397,16 @@ lex_raw_string (cpp_reader *pfile, cpp_t
total_len += (LEN); \
   } while (0);
 
+  orig_base = base;
+  ++cur;
+  raw_prefix_start = cur - base;
+  for (;;)
+{
   cppchar_t c;
 
   /* If we previously performed any trigraph or line splicing
-transformations

Re: [patch, fortran] PR 52669, warn about unused PRIVATE module variables

2013-07-14 Thread Thomas Koenig

Hi Tobias,



I think you should also handle:
   module m
  private
  integer :: k
   end module m

and
   module m2
  integer :: ll
   end module m2
when compiled with -fmodule-private.


Taken care of in the attached patch, the way you suggested works.

Committed as rev. 200950.

Thanks for the review!

Thomas

2013-07-14  Thomas Koenig  
Tobias Burnus  

PR fortran/52669
* trans-decl.c (gfc_finish_var_decl):  Move setting of
PRIVATE for a module variable if the module has a private
default or -fmodule-private is given to...
(gfc_create_module_variable): here. Optionally
warn about private module variable which is not used.

2013-07-14  Thomas Koenig  

PR fortran/52669
* fortran.dg/module_variable_1.f90:  New test.
* fortran.dg/module_variable_2.f90:  New test.

! { dg-do compile }
! { dg-options "-Wall" }
module foo
  integer, private :: i  ! { dg-warning "Unused PRIVATE" }
  integer, private :: j = 0
contains
  subroutine bar
j = j + 1
  end subroutine bar
end module foo

module bar
  private
  integer :: i ! { dg-warning "Unused PRIVATE" }
end module bar
! { dg-do compile }
! { dg-options "-Wall -fmodule-private" }

module bar
  integer :: i ! { dg-warning "Unused PRIVATE" }
end module bar
Index: fortran/ChangeLog
===
--- fortran/ChangeLog	(Revision 200949)
+++ fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,13 @@
+2013-07-14  Thomas Koenig  
+	Tobias Burnus  
+
+	PR fortran/52669
+	* trans-decl.c (gfc_finish_var_decl):  Move setting of
+	PRIVATE for a module variable if the module has a private
+	default or -fmodule-private is given to...
+	(gfc_create_module_variable): here. Optionally
+	warn about private module variable which is not used.
+
 2013-07-08  Tobias Burnus  
 
 	PR fortran/57834
Index: fortran/trans-decl.c
===
--- fortran/trans-decl.c	(Revision 200949)
+++ fortran/trans-decl.c	(Arbeitskopie)
@@ -559,12 +559,6 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
 {
   /* TODO: Don't set sym->module for result or dummy variables.  */
   gcc_assert (current_function_decl == NULL_TREE || sym->result == sym);
-  /* This is the declaration of a module variable.  */
-  if (sym->attr.access == ACCESS_UNKNOWN
-	  && (sym->ns->default_access == ACCESS_PRIVATE
-	  || (sym->ns->default_access == ACCESS_UNKNOWN
-		  && gfc_option.flag_module_private)))
-	sym->attr.access = ACCESS_PRIVATE;
 
   if (sym->attr.access != ACCESS_PRIVATE || sym->attr.public_used)
 	TREE_PUBLIC (decl) = 1;
@@ -4212,6 +4206,18 @@ gfc_create_module_variable (gfc_symbol * sym)
 internal_error ("backend decl for module variable %s already exists",
 		sym->name);
 
+  if (sym->module && !sym->attr.result && !sym->attr.dummy
+  && (sym->attr.access == ACCESS_UNKNOWN
+	  && (sym->ns->default_access == ACCESS_PRIVATE
+	  || (sym->ns->default_access == ACCESS_UNKNOWN
+		  && gfc_option.flag_module_private
+sym->attr.access = ACCESS_PRIVATE;
+
+  if (warn_unused_variable && !sym->attr.referenced
+  && sym->attr.access == ACCESS_PRIVATE)
+gfc_warning ("Unused PRIVATE module variable '%s' declared at %L",
+		 sym->name, &sym->declared_at);
+
   /* We always want module variables to be created.  */
   sym->attr.referenced = 1;
   /* Create the decl.  */
Index: testsuite/ChangeLog
===
--- testsuite/ChangeLog	(Revision 200949)
+++ testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2013-07-14  Thomas Koenig  
+
+	PR fortran/52669
+	* fortran.dg/module_variable_1.f90:  New test.
+	* fortran.dg/module_variable_2.f90:  New test.
+
 2013-07-14  Marc Glisse  
 
 	* g++.dg/ext/vector19.C: Adapt.
Index: testsuite/gfortran.dg/module_variable_1.f90
===
--- testsuite/gfortran.dg/module_variable_1.f90	(Revision 0)
+++ testsuite/gfortran.dg/module_variable_1.f90	(Arbeitskopie)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+module foo
+  integer, private :: i  ! { dg-warning "Unused PRIVATE" }
+  integer, private :: j = 0
+contains
+  subroutine bar
+j = j + 1
+  end subroutine bar
+end module foo
+
+module bar
+  private
+  integer :: i ! { dg-warning "Unused PRIVATE" }
+end module bar
Index: testsuite/gfortran.dg/module_variable_2.f90
===
--- testsuite/gfortran.dg/module_variable_2.f90	(Revision 0)
+++ testsuite/gfortran.dg/module_variable_2.f90	(Arbeitskopie)
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! { dg-options "-Wall -fmodule-private" }
+
+module bar
+  integer :: i ! { dg-warning "Unused PRIVATE" }
+end module bar


Re: Fwd: [PATCH] Attribute for unused warning for variables of non-trivial types

2013-07-14 Thread Lubos Lunak

 Sorry, I haven't found time for this until now.

On Sunday 14 of July 2013, Jason Merrill wrote:
> On 07/08/2013 10:32 AM, Jason Merrill wrote:
> > Was it a deliberate decision to put this in the c-common attributes
> > rather than the C++-specific ones?  I'm not saying it's wrong, just
> > interested in your thinking.
>
> I think it makes sense to leave it in c-common so that types shared
> between C and C++ can use it without a warning.

 Given the types need to have a ctor/dtor in order for this warning to make 
sense, this should not be needed. I actually didn't put it in c-common 
attributes on purpuse, I just based it on another attribute without realizing 
there was place elsewhere for C++-specific ones. I can write a patch to move 
this if wanted.

> I've fixed up the other issues and am applying this patch:

 Thanks a lot.

 As for the copyright assignment, AFAIK there is a generic SUSE one that 
should cover this as well.

-- 
 Lubos Lunak
 l.lu...@suse.cz


Re: Minor Cygwin patches

2013-07-14 Thread Kai Tietz
2013/7/13 JonY <10wa...@gmail.com>:
> On 7/10/2013 20:43, JonY wrote:
>> Hi,
>>
>> Attached are some minor patches, comments?
>>
>
> Kai, ping?


Please sent each patch as separate mail, and please add ChangeLogs for
them too.  Additionally it would be fine to read some lines about
cause for those patches.

Kai

>


2013/7/13 JonY <10wa...@gmail.com>:
> On 7/10/2013 20:43, JonY wrote:
>> Hi,
>>
>> Attached are some minor patches, comments?
>>
>
> Kai, ping?
>
>


Re: Fwd: [PATCH] Attribute for unused warning for variables of non-trivial types

2013-07-14 Thread Jason Merrill

On 07/14/2013 01:53 PM, Lubos Lunak wrote:

  As for the copyright assignment, AFAIK there is a generic SUSE one that
should cover this as well.


Ah, yes.

Jason




Re: Minor Cygwin patches

2013-07-14 Thread JonY
On 7/15/2013 06:02, Kai Tietz wrote:
> 2013/7/13 JonY <10wa...@gmail.com>:
>> On 7/10/2013 20:43, JonY wrote:
>>> Hi,
>>>
>>> Attached are some minor patches, comments?
>>>
>>
>> Kai, ping?
> 
> 
> Please sent each patch as separate mail, and please add ChangeLogs for
> them too.  Additionally it would be fine to read some lines about
> cause for those patches.
> 

Changelog


2013-03-08  Yaakov Selkowitz 

PR 35536
* (libjava/gnu/java/nio/channels/natFileChannelPosix.cc): FIONREAD
returns EINVAL on the errno variable instead of ENOTTY on Cygwin.

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

--- origsrc/gcc-4.5.1/libjava/gnu/java/nio/channels/natFileChannelPosix.cc  
2007-04-02 20:05:50.0 -0500
+++ src/gcc-4.5.1/libjava/gnu/java/nio/channels/natFileChannelPosix.cc  
2010-10-27 13:39:34.044718100 -0500
@@ -386,7 +386,7 @@ FileChannelImpl::available (void)
 
 #if defined (FIONREAD)
   r = ::ioctl (fd, FIONREAD, &num);
-  if (r == -1 && errno == ENOTTY)
+  if (r == -1 && (errno == ENOTTY || errno == EINVAL))
 {
   // If the ioctl doesn't work, we don't care.
   r = 0;


signature.asc
Description: OpenPGP digital signature


Re: Minor Cygwin patches

2013-07-14 Thread JonY
On 7/15/2013 06:02, Kai Tietz wrote:
> 2013/7/13 JonY <10wa...@gmail.com>:
>> On 7/10/2013 20:43, JonY wrote:
>>> Hi,
>>>
>>> Attached are some minor patches, comments?
>>>
>>
>> Kai, ping?
> 
> 
> Please sent each patch as separate mail, and please add ChangeLogs for
> them too.  Additionally it would be fine to read some lines about
> cause for those patches.
> 
> Kai
> 

Changelog

2013-03-08  Yaakov Selkowitz 

* (gcc/testsuite/gcc.target/i386/pr25993.c): Skip unsupported test.

--- origsrc/gcc-4.5.0/gcc/testsuite/gcc.target/i386/pr25993.c   2008-02-26 
01:38:34.0 +
+++ src/gcc-4.5.0/gcc/testsuite/gcc.target/i386/pr25993.c   2010-04-25 
16:17:21.703125000 +0100
@@ -1,5 +1,5 @@
 /* { dg-do assemble } */
-/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" } { "*" } { "" } } */
+/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" "*-*-cygwin*" } { "*" } { "" } 
} */
 /* { dg-options "-std=c99 -x assembler-with-cpp" } */
 
 #ifndef __ASSEMBLER__


signature.asc
Description: OpenPGP digital signature


Re: Minor Cygwin patches

2013-07-14 Thread JonY
On 7/15/2013 06:02, Kai Tietz wrote:
> 2013/7/13 JonY <10wa...@gmail.com>:
>> On 7/10/2013 20:43, JonY wrote:
>>> Hi,
>>>
>>> Attached are some minor patches, comments?
>>>
>>
>> Kai, ping?
> 
> 
> Please sent each patch as separate mail, and please add ChangeLogs for
> them too.  Additionally it would be fine to read some lines about
> cause for those patches.
> 
> Kai
> 

This patch makes gcc accept -pthread and -rdynamic for compatibility
with Linux. Add --large-address-aware, and use --tsaware, only with EXEs.

Changelog

2013-03-08  Dave Korn  

* (gcc/config.gcc): Include Cygwin specific file.
* (gcc/config/i386/cygwin.h): Link shared libgcc by default.
* (gcc/config/i386/cygwin.h): Add --large-address-aware, and use
  --tsaware for exes
* (gcc/config/i386/cygwin.h): Add -pthreads, -rdynamic stubs.
* (gcc/config/i386/cygwin.opt): New file.

Accept -pthread and -rdynamic for compatibility with Linux.
Add --large-address-aware, and use --tsaware, only with EXEs.

--- origsrc/gcc-4.7.2/gcc/config.gcc2012-09-12 04:03:54.0 -0500
+++ src/gcc-4.7.2/gcc/config.gcc2013-03-11 03:41:03.674656700 -0500
@@ -1417,7 +1417,7 @@ i[34567]86-*-cygwin*)
xm_file=i386/xm-cygwin.h
tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
-   extra_options="${extra_options} i386/cygming.opt"
+   extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
extra_objs="winnt.o winnt-stubs.o"
c_target_objs="${c_target_objs} msformat-c.o"
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
--- origsrc/gcc-4.7.2/gcc/config/i386/cygwin.h  2012-02-13 15:46:38.0 
-0600
+++ src/gcc-4.7.2/gcc/config/i386/cygwin.h  2013-03-06 00:13:25.986558800 
-0600
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.
 #define EXTRA_OS_CPP_BUILTINS()  /* Nothing.  */
 
 #undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
+#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread: } \
   -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
   %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \
   %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter 
../../include/w32api%s}}\
@@ -49,11 +49,7 @@ along with GCC; see the file COPYING3.
  %{static|static-libgcc:-lgcc -lgcc_eh} \
  %{!static: \
%{!static-libgcc: \
- %{!shared: \
-   %{!shared-libgcc:-lgcc -lgcc_eh} \
-   %{shared-libgcc:-lgcc_s -lgcc} \
-  } \
- %{shared:-lgcc_s -lgcc} \
+ -lgcc_s -lgcc \
 } \
   } "
 #else
@@ -72,6 +72,7 @@ along with GCC; see the file COPYING3.
 #undef LIB_SPEC
 #define LIB_SPEC "\
   %{pg:-lgmon} \
+  %{pthread: } \
   -lcygwin \
   %{mwindows:-lgdi32 -lcomdlg32} \
   -ladvapi32 -lshell32 -luser32 -lkernel32"
@@ -115,7 +116,9 @@ along with GCC; see the file COPYING3.
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
   %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \
-  --dll-search-prefix=cyg -tsaware"
+  --dll-search-prefix=cyg \
+  %{rdynamic: --export-all-symbols} \
+  %{!shared: %{!mdll: --large-address-aware --tsaware}}"
 
 /* Binutils does not handle weak symbols from dlls correctly.  For now,
do not use them unnecessarily in gthr-posix.h.  */
--- origsrc/gcc-4.7.2/gcc/config/i386/cygwin.opt1969-12-31 
18:00:00.0 -0600
+++ src/gcc-4.7.2/gcc/config/i386/cygwin.opt2013-03-11 03:36:36.556378400 
-0500
@@ -0,0 +1,27 @@
+; Cygwin-specific options.
+
+; Copyright (C) 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; .
+
+pthread
+Driver
+
+rdynamic
+Driver
+
+; Retain blank line above


signature.asc
Description: OpenPGP digital signature


Re: Minor Cygwin patches

2013-07-14 Thread Marek Polacek
On Mon, Jul 15, 2013 at 09:15:27AM +0800, JonY wrote:
> On 7/15/2013 06:02, Kai Tietz wrote:
> > 2013/7/13 JonY <10wa...@gmail.com>:
> >> On 7/10/2013 20:43, JonY wrote:
> >>> Hi,
> >>>
> >>> Attached are some minor patches, comments?
> >>>
> >>
> >> Kai, ping?
> > 
> > 
> > Please sent each patch as separate mail, and please add ChangeLogs for
> > them too.  Additionally it would be fine to read some lines about
> > cause for those patches.
> > 
> > Kai
> > 
> 
> Changelog
> 
> 2013-03-08  Yaakov Selkowitz 
> 
> * (gcc/testsuite/gcc.target/i386/pr25993.c): Skip unsupported test.
> 

That seems wrong.  Better would be:

* gcc.target/i386/pr25993.c: Skip unsupported test.

and put this into gcc/testsuite/ChangeLog.
And two spaces between the name and the e-mail address.

Marek


RE: [Patch, microblaze]: Add TARGET_ASM_OUTPUT_MI_THUNK to support varargs thunk

2013-07-14 Thread David Holsgrove
Hi Michael,

> -Original Message-
> From: Michael Eager [mailto:ea...@eagerm.com]
> Sent: Saturday, 13 July 2013 9:33 am
> To: David Holsgrove
> Cc: gcc-patches@gcc.gnu.org; Edgar Iglesias; John Williams; Vinod Kathail;
> Vidhumouli Hunsigida; Nagaraju Mekala; Tom Shui
> Subject: Re: [Patch, microblaze]: Add TARGET_ASM_OUTPUT_MI_THUNK to
> support varargs thunk
> 
> On 03/18/13 05:49, David Holsgrove wrote:
> > Changelog
> >
> > 2013-03-18  David Holsgrove 
> >
> >   * gcc/config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk
> > and define TARGET_ASM_OUTPUT_MI_THUNK and
> TARGET_ASM_CAN_OUTPUT_MI_THUNK
> 
> Sorry it has taken so long to review this patch.
> 
> The gcc microblaze-xilinx-elf build with this patch fails here:
> 
> +microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl
> ATTRIBUTE_UNUSED,
> + HOST_WIDE_INT delta, HOST_WIDE_INT
> vcall_offset,
> + tree function)
> ...
> +  emit_insn (gen_jump (funexp));
> 
> (actually, in output_operand() downstream from this statement) while compiling
> c++98/strstream.cc, with an error that the "%l" operand was not a label.
> 
> This is the first occasion when this routine is called.
> 

I had sent a separate patch which should have been applied prior to this one 
which
extended the jump insn to accommodate branching without the "%l" print operand,
but I've since reworked our thunk support to avoid needing this second patch.

Please find attached updated patch, and new Changelog entry;

2013-07-15  David Holsgrove 

 * gcc/config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk
   and define TARGET_ASM_OUTPUT_MI_THUNK and TARGET_ASM_CAN_OUTPUT_MI_THUNK

I'll post updated patches on the other threads out for review now.

thanks,
David

> --
> Michael Eager  ea...@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306  650-325-8077





0005-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch
Description: 0005-Patch-microblaze-Add-TARGET_ASM_OUTPUT_MI_THUNK-to-s.patch


Re: [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to microblaze.h

2013-07-14 Thread David Holsgrove
Hi Michael,

On 18 March 2013 22:50, David Holsgrove  wrote:
> Changelog
>
> 2013-03-18  David Holsgrove 
>
>  * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE
>and PTRDIFF_TYPE.
>
> Signed-off-by: David Holsgrove 
>

This patch remains the same, please review when ready.

thanks,
David


Re: [Patch, microblaze]: Add atomic builtin implementation

2013-07-14 Thread David Holsgrove
Hi Michael,

On 21 March 2013 03:00, Richard Henderson  wrote:
> On 03/18/2013 05:48 AM, David Holsgrove wrote:
>>  * gcc/config/microblaze/sync.md: New file.
>>  * gcc/config/microblaze/microblaze.md: Add UNSPEC_SYNC_CAS,
>>UNSPEC_SYNC_XCHG and include sync.md.
>>  * gcc/config/microblaze/microblaze.c: Add print_operand 'y'.
>>  * gcc/config/microblaze/constraints.md: Add memory_contraint
>>'Q' which is a single register.
>
> Do not add new __sync implementations.  Use the __atomic builtins.
>
>
> r~

Please find attached reworked patch using __atomic builtin.

Changelog entry would be;

2013-07-15  David Holsgrove 

 * gcc/config/microblaze/sync.md: New file.
 * gcc/config/microblaze/microblaze.md: Include sync.md
 * gcc/config/microblaze/microblaze.c: Add print_operand 'y'.
 * gcc/config/microblaze/constraints.md: Add memory_contraint
   'Q' which is a single register.

thanks,
David


0004-Patch-microblaze-Add-4-byte-implementation-for-atomi.patch
Description: Binary data


Re: [Patch, microblaze]: Remove SECONDARY_MEMORY_NEEDED

2013-07-14 Thread David Holsgrove
Hi Michael,

On 18 March 2013 22:49, David Holsgrove  wrote:
> MicroBlaze doesn't have restrictions that would force us to
> reload regs via memory. Don't define SECONDARY_MEMORY_NEEDED.
> Fixes an ICE when compiling OpenSSL for linux.
>
> Changelog
>
> 2013-03-18  Edgar E. Iglesias 
>
>  * gcc/config/microblaze/microblaze.h: Remove SECONDARY_MEMORY_NEEDED
>definition.
>
> Signed-off-by: Edgar E. Iglesias 
> Signed-off-by: Peter A. G. Crosthwaite 
>

Patch remains the same, please apply when ready.

thanks,
David


Re: [Patch, microblaze]: Extend jump insn to accept bri to SYMBOL_REFS

2013-07-14 Thread David Holsgrove
Hi Michael,

On 18 March 2013 22:52, David Holsgrove  wrote:
> Changelog
>
> 2013-03-18  David Holsgrove 
>
>  * gcc/config/microblaze/microblaze.md (jump):
>Account for jumps to SYMBOL_REFs.
>
> Signed-off-by: David Holsgrove 
>

Disregard - patch no longer desired.

thanks,
David


Re: [Patch, microblaze]: Add -fstack-usage support

2013-07-14 Thread David Holsgrove
Hi Michael,

On 18 March 2013 22:48, David Holsgrove  wrote:
> Changelog
>
> 2013-03-18  David Holsgrove 
>
>  * gcc/config/microblaze/microblaze.c (microblaze_expand_prologue):
>Add check for flag_stack_usage to handle -fstack-usage support
>
> Signed-off-by: David Holsgrove 
>

Patch remains the same, please apply when ready.

thanks,
David


[Patch, microblaze]: Fix bswaphi2 implementation

2013-07-14 Thread David Holsgrove
MicroBlaze insn swaph swaps the contents of register rA as two
halfwords placing result in rD;

(rD)[0:15]  <- (rA)[16:31]
(rD)[16:31] <- (rA)[0:15]

gcc bswaphi2 is intended to reverse the order of the bytes in the
half integer in rA

(rD)[8:15]  <- (rA)[0:7]
(rD)[7:0]   <- (rA)[8:15]
(rD)[24:31] <- (rA)[16:23]
(rD)[16:23] <- (rA)[24:31]

Correct the microblaze bswaphi2 insn pattern to be a swapb followed
by swaph

Changelog entry would be:

2013-07-15  David Holsgrove 

 * gcc/config/microblaze/microblaze.md: Fix bswaphi2


Can this also be backported to the gcc-4_8-branch?

thanks,
David


0002-Patch-microblaze-Fix-bswaphi2-implementation.patch
Description: Binary data


[Patch, microblaze]: Fix ICE with mhard-float

2013-07-14 Thread David Holsgrove
Add SImode to cstoresf4's comparison operator, prevents ICE during combine
rtl pass with error message;

internal compiler error: in simplify_subreg, at simplify-rtx.c:5725

Use ordered_comparison_operator predicate to limit operators to
those fcmp can handle, and letting compiler reorder insns to
accommodate unordered as necessary.

Changelog entry;

2013-07-15  David Holsgrove 

 * gcc/config/microblaze/microblaze.md: Fix cstoresf4 and cbranchsf4

Can this be backported to gcc-4_8-branch also?

thanks,
David


0003-Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch
Description: Binary data


[Patch, microblaze]: Branch Compare unroll loops

2013-07-14 Thread David Holsgrove
To facilitate optimization pass understanding of the conditional
branch for microblaze, remove the UNSPEC'd signed_compare /
unsigned_compare instructions, and replace with a complete
branch_compare which will output_asm_insn the correct cmp/cmpu
depending on comparison code and signed / unsigned.

We then return the correct branch instruction.

cbranchsi now calls an expanded microblaze_expand_conditional_branch
function which will carry out compare against zero, compare EQ/NE,
and all other compares appropriately.

-funroll-loops optimization pass can now proceed

Changelog

2013-07-15  David Holsgrove 

 * gcc/config/microblaze/predicates.md: Add cmp_op predicate.
 * gcc/config/microblaze/microblaze.md: Add branch_compare
   instruction which uses cmp_op predicate and emits cmp insn
   before branch.
 * gcc/config/microblaze/microblaze.c
   (microblaze_emit_compare): Rename to
   microblaze_expand_conditional_branch and consolidate logic.
   (microblaze_expand_conditional_branch): emit branch_compare
   insn instead of handling cmp op separate from branch insn.

thanks,
David


0009-Patch-microblaze-Add-branch_compare-instruction.patch
Description: Binary data


[ubsan] Don't always use NORETURN

2013-07-14 Thread Marek Polacek
Some libubsan functions aren't really noreturn, so don't mark them as
such.  This prevents failures with -O1+, since we don't generate any
code after calling noreturn routines, thus segfault when we actually
get there.

Applying to ubsan branch.

2013-07-15  Marek Polacek  

* builtin-attrs.def (ATTR_COLD_NOTHROW_LEAF_LIST): Define.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW): Don't mark
as NORETURN.
(BUILT_IN_UBSAN_HANDLE_SHIFT_OUT_OF_BOUNDS): Likewise.
* asan.c (ATTR_COLD_NOTHROW_LEAF_LIST): Define.

--- gcc/builtin-attrs.def.mp2   2013-07-15 07:52:25.339442743 +0200
+++ gcc/builtin-attrs.def   2013-07-15 08:16:45.725146824 +0200
@@ -131,6 +131,8 @@ DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHRO
ATTR_NULL, ATTR_NOTHROW_LIST)
 DEF_ATTR_TREE_LIST (ATTR_NORETURN_NOTHROW_LEAF_LIST, ATTR_NORETURN,\
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
+DEF_ATTR_TREE_LIST (ATTR_COLD_NOTHROW_LEAF_LIST, ATTR_COLD,\
+   ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
 DEF_ATTR_TREE_LIST (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST, ATTR_COLD,\
ATTR_NULL, ATTR_NORETURN_NOTHROW_LEAF_LIST)
 DEF_ATTR_TREE_LIST (ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST, ATTR_CONST,\
--- gcc/sanitizer.def.mp2   2013-07-15 07:47:46.080293252 +0200
+++ gcc/sanitizer.def   2013-07-15 08:17:03.830219023 +0200
@@ -288,11 +288,11 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOM
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW,
  "__ubsan_handle_divrem_overflow",
  BT_FN_VOID_PTR_PTR_PTR,
- ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
+ ATTR_COLD_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_SHIFT_OUT_OF_BOUNDS,
  "__ubsan_handle_shift_out_of_bounds",
  BT_FN_VOID_PTR_PTR_PTR,
- ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST)
+ ATTR_COLD_NOTHROW_LEAF_LIST)
 DEF_SANITIZER_BUILTIN(BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE,
  "__ubsan_handle_builtin_unreachable",
  BT_FN_VOID_PTR,
--- gcc/asan.c.mp2  2013-07-15 07:46:29.786987718 +0200
+++ gcc/asan.c  2013-07-15 08:21:21.224095627 +0200
@@ -2102,6 +2102,9 @@ initialize_sanitizer_builtins (void)
 #undef ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST
 #define ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST \
   ECF_TM_PURE | ATTR_NORETURN_NOTHROW_LEAF_LIST
+#undef ATTR_COLD_NOTHROW_LEAF_LIST
+#define ATTR_COLD_NOTHROW_LEAF_LIST \
+  /* ECF_COLD missing */ ATTR_NOTHROW_LEAF_LIST
 #undef ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST
 #define ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST \
   /* ECF_COLD missing */ ATTR_NORETURN_NOTHROW_LEAF_LIST

Marek