Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2018-03-02 Thread Thomas Schwinge
Hi!

On Mon, 20 Nov 2017 09:11:19 -0500, Jason Merrill  wrote:
> On Sun, Nov 19, 2017 at 7:56 AM, Thomas Schwinge
>  wrote:
> > OK to fix the first four issues as follows?
> 
> OK.
> 
> Reviewed-by: Jason Merrill 

Better late than never, committed to trunk in r258142:

commit 0e793314b12e82e8a70971e509572d67b773
Author: tschwinge 
Date:   Fri Mar 2 16:35:36 2018 +

Fix "dg-lto-options" misuse

gcc/testsuite/
* g++.dg/lto/20080915_0.C: Don't use "dg-lto-options".
* g++.dg/lto/20080907_0.C: Use "#pragma GCC" instead of
"dg-lto-options".
* g++.dg/lto/20101010-1_0.C: Likewise.
* g++.dg/lto/20101010-2_0.C: Likewise.

Reviewed-by: Jason Merrill 

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258142 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog | 8 
 gcc/testsuite/g++.dg/lto/20080907_0.C   | 4 +++-
 gcc/testsuite/g++.dg/lto/20080915_0.C   | 1 -
 gcc/testsuite/g++.dg/lto/20101010-1_0.C | 4 +++-
 gcc/testsuite/g++.dg/lto/20101010-2_0.C | 4 +++-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 84ebf2e..3864204 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-03-02  Thomas Schwinge  
+
+   * g++.dg/lto/20080915_0.C: Don't use "dg-lto-options".
+   * g++.dg/lto/20080907_0.C: Use "#pragma GCC" instead of
+   "dg-lto-options".
+   * g++.dg/lto/20101010-1_0.C: Likewise.
+   * g++.dg/lto/20101010-2_0.C: Likewise.
+
 2018-03-02  Jakub Jelinek  
 
PR ipa/84628
diff --git gcc/testsuite/g++.dg/lto/20080907_0.C 
gcc/testsuite/g++.dg/lto/20080907_0.C
index a423196..153d0ab 100644
--- gcc/testsuite/g++.dg/lto/20080907_0.C
+++ gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
 Baz dummy() { bar().func(); }
diff --git gcc/testsuite/g++.dg/lto/20080915_0.C 
gcc/testsuite/g++.dg/lto/20080915_0.C
index 40c5042..c91e756 100644
--- gcc/testsuite/g++.dg/lto/20080915_0.C
+++ gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -1,5 +1,4 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
 
 struct Foo {
  static const int dummy;
diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C 
gcc/testsuite/g++.dg/lto/20101010-1_0.C
index 8f694c7..bb3e6d4 100644
--- gcc/testsuite/g++.dg/lto/20101010-1_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef long size_t;
 template < class, class > struct pair
diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C 
gcc/testsuite/g++.dg/lto/20101010-2_0.C
index a26956f..721ac01 100644
--- gcc/testsuite/g++.dg/lto/20101010-2_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-2_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef int size_t;
 template < size_t _Nw > struct _Base_bitset


Grüße
 Thomas


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-20 Thread Jason Merrill
On Sun, Nov 19, 2017 at 7:56 AM, Thomas Schwinge
 wrote:
> OK to fix the first four issues as follows?  If approving this, please
> respond with "Reviewed-by: NAME " so that your effort will be
> recorded.  See .

OK.

Reviewed-by: Jason Merrill 


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-20 Thread Martin Liška
On 11/19/2017 01:56 PM, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 18 Oct 2017 14:48:13 +0200, Martin Liška  wrote:
>> This is second patch that addresses test-suite fallout. All these tests fail 
>> because -Wreturn-type is
>> now on by default.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> ... but alters some LTO test cases as follows:
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080907_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
>> @@ -1,3 +1,5 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> This means that instead of the default (without explicit
> "dg-lto-options") "LTO options torture testing" testing, we're now *only*
> testing one variant, with only the "-Wno-return-type" option specified.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080915_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
>> @@ -1,4 +1,6 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> Same, but...
> 
>> @@ -16,7 +18,7 @@ int func(const Bar& b) {
>>  }
>>  
>>  struct Baz {
>> - Bar& operator*() {}
>> + Bar& operator*() { static Bar a; return a; }
>>  };
> 
> ... given that you're addressing here the (only, as it seems)
> "-Wreturn-type" issue, you don't need to specify "-Wno-return-type" at
> all.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> @@ -1,6 +1,6 @@
>>  // { dg-lto-do link }
>>  // { dg-require-effective-target fpic }
>> -// { dg-lto-options {{-fPIC -flto}} }
>> +// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
>>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }
> 
> ACK.  This only tested one variant: "-fPIC -flto", now testing "-fPIC
> -flto -Wno-return-type".  (Similarly for several more.)
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> @@ -1,6 +1,7 @@
>>  /* { dg-lto-do link } */
>> -/* { dg-lto-options "-O2  -w" } */
>>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
>> +/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */
> 
> I don't know about that one.  This previously tested two variants
> separately: "-O2" and "-w", and you've now changed it to test one
> combined variant: "-O2 -w -Wno-return-type".  Your change is correct if
> this previously meant to test the combined variant "-O2 -w" instead of
> each of them separately -- which I don't know/have not verified.

Hello.

I don't think so, I've just tested that and all invocations of the source file
have '-O2  -w' in corresponding command line. Can you please verify that it 
builds
all possible combinations of provided arguments of dg-lto-options?

> 
>> --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> @@ -1,5 +1,5 @@
>>  // { dg-lto-do link }
>> -// { dg-lto-options "-O2 -rdynamic" }
>> +// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
>>  // { dg-extra-ld-options "-r -nostdlib" }
> 
> Same: "-O2" and "-rdynamic" separately vs. now "-O2 -rdynamic
> -Wno-return-type" combined.
> 
> Unfortunately, we can't use "dg-options" or "dg-additional-options" here:
> 
> WARNING: lto.exp does not support dg-additional-options
> WARNING: lto.exp does not support dg-options in primary source file

I know, I've tried that :)

Martin

> 
> OK to fix the first four issues as follows?  If approving this, please
> respond with "Reviewed-by: NAME " so that your effort will be
> recorded.  See .
> 
> diff --git gcc/testsuite/g++.dg/lto/20080907_0.C 
> gcc/testsuite/g++.dg/lto/20080907_0.C
> index a423196..153d0ab 100644
> --- gcc/testsuite/g++.dg/lto/20080907_0.C
> +++ gcc/testsuite/g++.dg/lto/20080907_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
>  Baz dummy() { bar().func(); }
> diff --git gcc/testsuite/g++.dg/lto/20080915_0.C 
> gcc/testsuite/g++.dg/lto/20080915_0.C
> index 40c5042..c91e756 100644
> --- gcc/testsuite/g++.dg/lto/20080915_0.C
> +++ gcc/testsuite/g++.dg/lto/20080915_0.C
> @@ -1,5 +1,4 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
>  
>  struct Foo {
>   static const int dummy;
> diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C 
> gcc/testsuite/g++.dg/lto/20101010-1_0.C
> index 8f694c7..bb3e6d4 100644
> --- 

Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-19 Thread Thomas Schwinge
Hi!

On Wed, 18 Oct 2017 14:48:13 +0200, Martin Liška  wrote:
> This is second patch that addresses test-suite fallout. All these tests fail 
> because -Wreturn-type is
> now on by default.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

... but alters some LTO test cases as follows:

> --- a/gcc/testsuite/g++.dg/lto/20080907_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
> @@ -1,3 +1,5 @@
>  // { dg-lto-do assemble }
> +// { dg-lto-options "-Wno-return-type" }

This means that instead of the default (without explicit
"dg-lto-options") "LTO options torture testing" testing, we're now *only*
testing one variant, with only the "-Wno-return-type" option specified.

> --- a/gcc/testsuite/g++.dg/lto/20080915_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
> @@ -1,4 +1,6 @@
>  // { dg-lto-do assemble }
> +// { dg-lto-options "-Wno-return-type" }

Same, but...

> @@ -16,7 +18,7 @@ int func(const Bar& b) {
>  }
>  
>  struct Baz {
> - Bar& operator*() {}
> + Bar& operator*() { static Bar a; return a; }
>  };

... given that you're addressing here the (only, as it seems)
"-Wreturn-type" issue, you don't need to specify "-Wno-return-type" at
all.

> --- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
> @@ -1,6 +1,6 @@
>  // { dg-lto-do link }
>  // { dg-require-effective-target fpic }
> -// { dg-lto-options {{-fPIC -flto}} }
> +// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }

ACK.  This only tested one variant: "-fPIC -flto", now testing "-fPIC
-flto -Wno-return-type".  (Similarly for several more.)

> --- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
> @@ -1,4 +1,5 @@
>  // { dg-lto-do link }
> +// { dg-lto-options "-Wno-return-type" }

NACK, see above.

> --- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
> @@ -1,4 +1,5 @@
>  // { dg-lto-do link }
> +// { dg-lto-options "-Wno-return-type" }

NACK, see above.

> --- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
> +++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
> @@ -1,6 +1,7 @@
>  /* { dg-lto-do link } */
> -/* { dg-lto-options "-O2  -w" } */
>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
> +/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */

I don't know about that one.  This previously tested two variants
separately: "-O2" and "-w", and you've now changed it to test one
combined variant: "-O2 -w -Wno-return-type".  Your change is correct if
this previously meant to test the combined variant "-O2 -w" instead of
each of them separately -- which I don't know/have not verified.

> --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
> +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
> @@ -1,5 +1,5 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-O2 -rdynamic" }
> +// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
>  // { dg-extra-ld-options "-r -nostdlib" }

Same: "-O2" and "-rdynamic" separately vs. now "-O2 -rdynamic
-Wno-return-type" combined.

Unfortunately, we can't use "dg-options" or "dg-additional-options" here:

WARNING: lto.exp does not support dg-additional-options
WARNING: lto.exp does not support dg-options in primary source file

OK to fix the first four issues as follows?  If approving this, please
respond with "Reviewed-by: NAME " so that your effort will be
recorded.  See .

diff --git gcc/testsuite/g++.dg/lto/20080907_0.C 
gcc/testsuite/g++.dg/lto/20080907_0.C
index a423196..153d0ab 100644
--- gcc/testsuite/g++.dg/lto/20080907_0.C
+++ gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
 Baz dummy() { bar().func(); }
diff --git gcc/testsuite/g++.dg/lto/20080915_0.C 
gcc/testsuite/g++.dg/lto/20080915_0.C
index 40c5042..c91e756 100644
--- gcc/testsuite/g++.dg/lto/20080915_0.C
+++ gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -1,5 +1,4 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
 
 struct Foo {
  static const int dummy;
diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C 
gcc/testsuite/g++.dg/lto/20101010-1_0.C
index 8f694c7..bb3e6d4 100644
--- gcc/testsuite/g++.dg/lto/20101010-1_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef long size_t;
 template < class, class > struct pair
diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C 
gcc/testsuite/g++.dg/lto/20101010-2_0.C
index a26956f..721ac01 100644
--- gcc/testsuite/g++.dg/lto/20101010-2_0.C
+++ 

Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-15 Thread Jonathan Wakely

On 06/11/17 15:12 +0100, Martin Liška wrote:

On 11/06/2017 02:58 PM, Paolo Carlini wrote:

Hi,

On 06/11/2017 14:37, Martin Liška wrote:

Thank you for the patch.
I'm going to install the remaining part that will fix x86_64 fallout. All 
changes are
quite obvious, so hope it's fine to install it.

I think so. Thanks.

Note that the 3 additional libstdc++-v3 changes aren't really necessary, but 
those testcases are failing, seg faulting, at run time for unrelated reasons. I 
don't know if Jonathan is already on that...

Paolo.


Right, adding "return 0;" to main() is just noise, it does nothing.


You're right, it started right when it was introduced in r254008.

I see:

g++ libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc -std=gnu++17 -I. 
-lstdc++fs && ./a.out
libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc:33: void 
test01(): Assertion 'f.is_open()' failed.
Aborted (core dumped)


I think that was PR libstdc++/82917 so should be fixed.



Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-07 Thread Andreas Schwab
On Nov 07 2017, Jakub Jelinek  wrote:

> On Tue, Nov 07, 2017 at 06:27:52PM +0100, Andreas Schwab wrote:
>>  * g++.dg/pr50763-3.C (evalPoint): Return a value.
>
> http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00407.html
> (waiting for review)

Sorry, I missed that.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-07 Thread Jakub Jelinek
On Tue, Nov 07, 2017 at 06:27:52PM +0100, Andreas Schwab wrote:
>   * g++.dg/pr50763-3.C (evalPoint): Return a value.

http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00407.html
(waiting for review)

> diff --git a/gcc/testsuite/g++.dg/pr50763-3.C 
> b/gcc/testsuite/g++.dg/pr50763-3.C
> index b66be87b1b..33aba30406 100644
> --- a/gcc/testsuite/g++.dg/pr50763-3.C
> +++ b/gcc/testsuite/g++.dg/pr50763-3.C
> @@ -53,5 +53,5 @@ long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
> if (!_Dom.cop2d(crUV)) {
>sUV = _Dom.clp2d(crUV);
> }
> -   eval();
> +   return eval();
>  }   
> -- 
> 2.15.0
> 
> 
> -- 
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Jakub


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-07 Thread Andreas Schwab
* g++.dg/pr50763-3.C (evalPoint): Return a value.

diff --git a/gcc/testsuite/g++.dg/pr50763-3.C b/gcc/testsuite/g++.dg/pr50763-3.C
index b66be87b1b..33aba30406 100644
--- a/gcc/testsuite/g++.dg/pr50763-3.C
+++ b/gcc/testsuite/g++.dg/pr50763-3.C
@@ -53,5 +53,5 @@ long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
if (!_Dom.cop2d(crUV)) {
   sUV = _Dom.clp2d(crUV);
}
-   eval();
+   return eval();
 }   
-- 
2.15.0


-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Martin Liška
On 11/06/2017 02:58 PM, Paolo Carlini wrote:
> Hi,
> 
> On 06/11/2017 14:37, Martin Liška wrote:
>> Thank you for the patch.
>> I'm going to install the remaining part that will fix x86_64 fallout. All 
>> changes are
>> quite obvious, so hope it's fine to install it.
> I think so. Thanks.
> 
> Note that the 3 additional libstdc++-v3 changes aren't really necessary, but 
> those testcases are failing, seg faulting, at run time for unrelated reasons. 
> I don't know if Jonathan is already on that...
> 
> Paolo.

You're right, it started right when it was introduced in r254008.

I see:

g++ libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc -std=gnu++17 
-I. -lstdc++fs && ./a.out
libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc:33: void 
test01(): Assertion 'f.is_open()' failed.
Aborted (core dumped)

Martin



Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Paolo Carlini

Hi,

On 06/11/2017 14:37, Martin Liška wrote:

Thank you for the patch.
I'm going to install the remaining part that will fix x86_64 fallout. All 
changes are
quite obvious, so hope it's fine to install it.

I think so. Thanks.

Note that the 3 additional libstdc++-v3 changes aren't really necessary, 
but those testcases are failing, seg faulting, at run time for unrelated 
reasons. I don't know if Jonathan is already on that...


Paolo.


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Martin Liška
On 11/06/2017 01:19 PM, Paolo Carlini wrote:
> Hi again,
> 
> On 06/11/2017 12:40, Paolo Carlini wrote:
>> Hi,
>>
>> On 06/11/2017 11:41, Martin Liška wrote:
>>> Sorry for that. It's related to x86 target specific test-cases. I'll 
>>> prepare patch as soon as possible. 
>> Ok, thanks.
>>
>> Note, I'm seeing a few - expected, give the enabled warning - fails in the 
>> libstdc++-v3 testsuite too. Eg:
>>
>> FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
>> FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
>> FAIL: 20_util/pair/traits.cc (test for excess errors)
>> FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)
> For the library I'm finishing testing the below.
> 
> Paolo.
> 
> 

Thank you for the patch.
I'm going to install the remaining part that will fix x86_64 fallout. All 
changes are
quite obvious, so hope it's fine to install it.

Martin
>From feaf87410ad6b82b4997891892f71f20ff615c79 Mon Sep 17 00:00:00 2001
From: marxin 
Date: Mon, 6 Nov 2017 13:43:04 +0100
Subject: [PATCH] Fix -Wreturn-type fallout.

gcc/testsuite/ChangeLog:

2017-11-06  Martin Liska  

	* c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	(foo2): Likewise.
	* c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise.
	(foo1): Likewise.
	* c-c++-common/cilk-plus/CK/errors.c: Likewise.
	* c-c++-common/cilk-plus/CK/pr60197.c: Likewise.
	* c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise.
	* c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise.
	(test_exe): Likewise.
	* c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise.
	* g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise.
	* g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise.
	* g++.dg/eh/sighandle.C (dosegv): Likewise.
	* g++.dg/ext/vector14.C (foo): Likewise.
	(main): Likewise.
	* g++.dg/graphite/pr41305.C: Likewise.
	* g++.dg/graphite/pr42930.C: Likewise.
	* g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise.
	(makeDir): Likewise.
	* g++.dg/other/i386-8.C (foo): Likewise.
	* g++.dg/pr45788.C: Likewise.
	* g++.dg/pr64688.C (at_c): Likewise.
	* g++.dg/pr65032.C (G::DecodeVorbis): Likewise.
	* g++.dg/pr71633.C (c3::fn2): Likewise.
	* g++.dg/stackprotectexplicit2.C (A): Likewise.
	* g++.old-deja/g++.law/weak.C (main): Likewise.

libgomp/ChangeLog:

2017-11-06  Martin Liska  

	* testsuite/libgomp.c++/loop-2.C: Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	* testsuite/libgomp.c++/loop-4.C: Likewise.
	* testsuite/libgomp.c++/parallel-1.C: Likewise.
	* testsuite/libgomp.c++/shared-1.C: Likewise.
	* testsuite/libgomp.c++/single-1.C: Likewise.
	* testsuite/libgomp.c++/single-2.C: Likewise.

libstdc++-v3/ChangeLog:

2017-11-06  Martin Liska  

	* testsuite/27_io/basic_fstream/cons/char/path.cc (main):
	  Return a value for functions with non-void return type,
	  or change type to void, or add -Wno-return-type for test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc (main):
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc (main):
	Likewise.
---
 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c   | 4 ++--
 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c | 9 ++---
 gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c  | 2 +-
 gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c | 2 +-
 gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c | 2 +-
 gcc/testsuite/c-c++-common/fold-masked-cmp-1.c| 4 +++-
 gcc/testsuite/c-c++-common/fold-masked-cmp-2.c| 2 ++
 gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc | 2 ++
 gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc  | 2 +-
 gcc/testsuite/g++.dg/eh/sighandle.C   | 1 +
 gcc/testsuite/g++.dg/ext/vector14.C   | 8 +++-
 gcc/testsuite/g++.dg/graphite/pr41305.C   | 2 +-
 gcc/testsuite/g++.dg/graphite/pr42930.C   | 2 +-
 gcc/testsuite/g++.dg/opt/pr46640.C| 3 +++
 gcc/testsuite/g++.dg/other/i386-8.C   | 2 ++
 gcc/testsuite/g++.dg/pr45788.C| 2 +-
 gcc/testsuite/g++.dg/pr64688.C| 5 -
 gcc/testsuite/g++.dg/pr65032.C| 2 ++
 gcc/testsuite/g++.dg/pr71633.C| 1 +
 gcc/testsuite/g++.dg/stackprotectexplicit2.C  | 3 ++-
 gcc/testsuite/g++.old-deja/g++.law/weak.C | 2 ++
 libgomp/testsuite/libgomp.c++/loop-2.C| 1 +
 libgomp/testsuite/libgomp.c++/loop-4.C| 1 +
 libgomp/testsuite/libgomp.c++/parallel-1.C| 1 +
 

Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Paolo Carlini

Hi again,

On 06/11/2017 12:40, Paolo Carlini wrote:

Hi,

On 06/11/2017 11:41, Martin Liška wrote:
Sorry for that. It's related to x86 target specific test-cases. I'll 
prepare patch as soon as possible. 

Ok, thanks.

Note, I'm seeing a few - expected, give the enabled warning - fails in 
the libstdc++-v3 testsuite too. Eg:


FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/traits.cc (test for excess errors)
FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)

For the library I'm finishing testing the below.

Paolo.


2017-11-06  Paolo Carlini  

* testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type
warnings.
* testsuite/20_util/pair/cons/deduction.cc: Likewise.
* testsuite/20_util/pair/traits.cc: Likewise.
* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
* testsuite/20_util/variant/compile.cc: Likewise.
* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
Likewise.

Index: testsuite/20_util/optional/cons/deduction.cc
===
--- testsuite/20_util/optional/cons/deduction.cc(revision 254449)
+++ testsuite/20_util/optional/cons/deduction.cc(working copy)
@@ -24,8 +24,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 int main()
Index: testsuite/20_util/pair/cons/deduction.cc
===
--- testsuite/20_util/pair/cons/deduction.cc(revision 254449)
+++ testsuite/20_util/pair/cons/deduction.cc(working copy)
@@ -30,8 +30,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 void
Index: testsuite/20_util/pair/traits.cc
===
--- testsuite/20_util/pair/traits.cc(revision 254449)
+++ testsuite/20_util/pair/traits.cc(working copy)
@@ -31,8 +31,8 @@
 
 struct ThrowingCopy
 {
-  ThrowingCopy(const ThrowingCopy&) {}
-  ThrowingCopy& operator=(const ThrowingCopy&) {}
+  ThrowingCopy(const ThrowingCopy&);
+  ThrowingCopy& operator=(const ThrowingCopy&);
 };
 
 int main()
Index: testsuite/20_util/tuple/cons/deduction.cc
===
--- testsuite/20_util/tuple/cons/deduction.cc   (revision 254442)
+++ testsuite/20_util/tuple/cons/deduction.cc   (working copy)
@@ -30,8 +30,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 void
Index: testsuite/20_util/variant/compile.cc
===
--- testsuite/20_util/variant/compile.cc(revision 254442)
+++ testsuite/20_util/variant/compile.cc(working copy)
@@ -481,37 +481,37 @@
 static_assert(MA_VAL == is_trivially_move_assignable_v, ""); \
   }
   TEST_TEMPLATE(=default, =default, =default, =default, =default,  true,  
true,  true,  true)
-  TEST_TEMPLATE(=default, =default, =default, =default,   {},  true,  
true,  true, false)
-  TEST_TEMPLATE(=default, =default, =default,   {}, =default,  true,  
true, false,  true)
-  TEST_TEMPLATE(=default, =default, =default,   {},   {},  true,  
true, false, false)
-  TEST_TEMPLATE(=default, =default,   {}, =default, =default,  true, 
false,  true,  true)
-  TEST_TEMPLATE(=default, =default,   {}, =default,   {},  true, 
false,  true, false)
-  TEST_TEMPLATE(=default, =default,   {},   {}, =default,  true, 
false, false,  true)
-  TEST_TEMPLATE(=default, =default,   {},   {},   {},  true, 
false, false, false)
-  TEST_TEMPLATE(=default,   {}, =default, =default, =default, false,  
true,  true,  true)
-  TEST_TEMPLATE(=default,   {}, =default, =default,   {}, false,  
true,  true, false)
-  TEST_TEMPLATE(=default,   {}, =default,   {}, =default, false,  
true, false,  true)
-  TEST_TEMPLATE(=default,   {}, =default,   {},   {}, false,  
true, false, false)
-  TEST_TEMPLATE(=default,   {},   {}, =default, =default, false, 
false,  true,  true)
-  TEST_TEMPLATE(=default,   {},   {}, =default,   {}, false, 
false,  true, false)
-  TEST_TEMPLATE(=default,   {},   {},   {}, =default, false, 
false, false,  true)
-  TEST_TEMPLATE(=default,   {},   {},   {},   {}, false, 
false, false, false)
-  TEST_TEMPLATE(  {}, =default, =default, =default, =default, false, 

Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Paolo Carlini

Hi,

On 06/11/2017 11:41, Martin Liška wrote:
Sorry for that. It's related to x86 target specific test-cases. I'll 
prepare patch as soon as possible. 

Ok, thanks.

Note, I'm seeing a few - expected, give the enabled warning - fails in 
the libstdc++-v3 testsuite too. Eg:


FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/traits.cc (test for excess errors)
FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)

Paolo.




Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Martin Liška
On 11/06/2017 11:08 AM, Paolo Carlini wrote:
> Hi,
> 
> On 06/11/2017 11:03, Martin Liška wrote:
>> On 11/06/2017 10:57 AM, Paolo Carlini wrote:
>>> are you still in the process of committing the testsuite changes? I had a 
>>> quick look (eg, pr45788.C) and some of the fails seem certainly expected.
>>>
>>> Thanks,
>>> Paolo.
>> Hi.
>>
>> Revisions 254440 and r254438 contain fixes for test-suite. Can you please 
>> verify
>> it's still present?
> It's definitely there. I was testing r254440. And, hey, have a look to, eg, 
> the pr45788.C which we have in svn, it does definitely trigger a 
> -Wreturn-type. Likewise for many other testcases :-(
> 
> Paolo.

Sorry for that. It's related to x86 target specific test-cases. I'll prepare 
patch as soon as possible.

Thanks,
Martin


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Paolo Carlini

Hi,

On 06/11/2017 11:03, Martin Liška wrote:

On 11/06/2017 10:57 AM, Paolo Carlini wrote:

are you still in the process of committing the testsuite changes? I had a quick 
look (eg, pr45788.C) and some of the fails seem certainly expected.

Thanks,
Paolo.

Hi.

Revisions 254440 and r254438 contain fixes for test-suite. Can you please verify
it's still present?
It's definitely there. I was testing r254440. And, hey, have a look to, 
eg, the pr45788.C which we have in svn, it does definitely trigger a 
-Wreturn-type. Likewise for many other testcases :-(


Paolo.


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Martin Liška
On 11/06/2017 10:57 AM, Paolo Carlini wrote:
> are you still in the process of committing the testsuite changes? I had a 
> quick look (eg, pr45788.C) and some of the fails seem certainly expected.
> 
> Thanks,
> Paolo.

Hi.

Revisions 254440 and r254438 contain fixes for test-suite. Can you please verify
it's still present?

Martin


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Paolo Carlini

Hi,

On 06/11/2017 09:48, Martin Liška wrote:

On 11/03/2017 04:29 PM, Jason Merrill wrote:

Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.

Jason

Done that and I'm going to install the patches as it was last blocker.
Sorry, I didn't follow in detail the whole thread, but I'm now seeing 
many fails. Eg, many cilk-plus, or:


FAIL: g++.dg/pr45788.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/pr45788.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/pr45788.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/pr64688.C   (test for excess errors)
FAIL: g++.dg/pr65032.C   (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++14 (test for excess errors)

are you still in the process of committing the testsuite changes? I had 
a quick look (eg, pr45788.C) and some of the fails seem certainly expected.


Thanks,
Paolo.


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-06 Thread Martin Liška
On 11/03/2017 04:29 PM, Jason Merrill wrote:
> Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.
> 
> Jason

Done that and I'm going to install the patches as it was last blocker.

Thanks,
Martin


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-11-03 Thread Jason Merrill
On Thu, Oct 26, 2017 at 8:14 AM, Martin Liška  wrote:
> On 10/24/2017 04:39 PM, Jason Merrill wrote:
>> On 10/18/2017 08:48 AM, Martin Liška wrote:
>>> This is second patch that addresses test-suite fallout. All these tests 
>>> fail because -Wreturn-type is
>>> now on by default.
>>
>>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
>>> -constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
>>> +constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target 
>>> c++14_only } }
>>
>>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
>>> -  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
>>> +  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target 
>>> c++14_only } }
>>
>> Why are these changes needed?  They aren't "Return a value for functions 
>> with non-void return type, or change type to void, or add -Wno-return-type 
>> for test."
>>
>> The rest of the patch is OK.
>>
>> Jason
>
> Hi.
>
> Sorry, I forgot to describe this change. With -std=c++11 we do:
>
> #0  massage_constexpr_body (fun=0x76955500, body=0x76813eb8) at 
> ../../gcc/cp/constexpr.c:708
> #1  0x0087700b in explain_invalid_constexpr_fn (fun=0x76955500) 
> at ../../gcc/cp/constexpr.c:896
> #2  0x008799dc in cxx_eval_call_expression (ctx=0x7fffd150, 
> t=0x76820118, lval=false, non_constant_p=0x7fffd1cf, 
> overflow_p=0x7fffd1ce) at ../../gcc/cp/constexpr.c:1558
> #3  0x008843fe in cxx_eval_constant_expression (ctx=0x7fffd150, 
> t=0x76820118, lval=false, non_constant_p=0x7fffd1cf, 
> overflow_p=0x7fffd1ce, jump_target=0x0) at ../../gcc/cp/constexpr.c:4069
>
> static tree
> massage_constexpr_body (tree fun, tree body)
> {
>   if (DECL_CONSTRUCTOR_P (fun))
> body = build_constexpr_constructor_member_initializers
>   (DECL_CONTEXT (fun), body);
>   else if (cxx_dialect < cxx14)
> {
>   if (TREE_CODE (body) == EH_SPEC_BLOCK)
> body = EH_SPEC_STMTS (body);
>   if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
> body = TREE_OPERAND (body, 0);
>   body = constexpr_fn_retval (body);
> }
>   return body;
> }
>
> and we end up with error_mark_node and thus potential_constant_expression_1 
> does bail out.
> That's why we don't print the later error with -std=c++11.
>
> What should we do with that?

Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.

Jason


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-10-26 Thread Martin Liška
On 10/24/2017 04:39 PM, Jason Merrill wrote:
> On 10/18/2017 08:48 AM, Martin Liška wrote:
>> This is second patch that addresses test-suite fallout. All these tests fail 
>> because -Wreturn-type is
>> now on by default.
> 
>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
>> -constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
>> +constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target 
>> c++14_only } }
> 
>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
>> -  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
>> +  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target 
>> c++14_only } }
> 
> Why are these changes needed?  They aren't "Return a value for functions with 
> non-void return type, or change type to void, or add -Wno-return-type for 
> test."
> 
> The rest of the patch is OK.
> 
> Jason

Hi.

Sorry, I forgot to describe this change. With -std=c++11 we do:

#0  massage_constexpr_body (fun=0x76955500, body=0x76813eb8) at 
../../gcc/cp/constexpr.c:708
#1  0x0087700b in explain_invalid_constexpr_fn (fun=0x76955500) at 
../../gcc/cp/constexpr.c:896
#2  0x008799dc in cxx_eval_call_expression (ctx=0x7fffd150, 
t=0x76820118, lval=false, non_constant_p=0x7fffd1cf, 
overflow_p=0x7fffd1ce) at ../../gcc/cp/constexpr.c:1558
#3  0x008843fe in cxx_eval_constant_expression (ctx=0x7fffd150, 
t=0x76820118, lval=false, non_constant_p=0x7fffd1cf, 
overflow_p=0x7fffd1ce, jump_target=0x0) at ../../gcc/cp/constexpr.c:4069

static tree
massage_constexpr_body (tree fun, tree body)
{
  if (DECL_CONSTRUCTOR_P (fun))
body = build_constexpr_constructor_member_initializers
  (DECL_CONTEXT (fun), body);
  else if (cxx_dialect < cxx14)
{
  if (TREE_CODE (body) == EH_SPEC_BLOCK)
body = EH_SPEC_STMTS (body);
  if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
body = TREE_OPERAND (body, 0);
  body = constexpr_fn_retval (body);
}
  return body;
}

and we end up with error_mark_node and thus potential_constant_expression_1 
does bail out.
That's why we don't print the later error with -std=c++11.

What should we do with that?
Thanks,
Martin


Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.

2017-10-24 Thread Jason Merrill

On 10/18/2017 08:48 AM, Martin Liška wrote:

This is second patch that addresses test-suite fallout. All these tests fail 
because -Wreturn-type is
now on by default.



+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
-constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
+constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target 
c++14_only } }



+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
-  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
+  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target 
c++14_only } }


Why are these changes needed?  They aren't "Return a value for functions 
with non-void return type, or change type to void, or add 
-Wno-return-type for test."


The rest of the patch is OK.

Jason