[Bug c/69972] duplicate integer overflow diagnostic in constant expressions

2021-06-04 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972

Martin Sebor  changed:

   What|Removed |Added

   Last reconfirmed|2016-02-29 00:00:00 |2021-6-4
  Known to fail||10.2.0, 11.0, 6.3.0, 7.0.1,
   ||8.3.0, 9.3.0

--- Comment #5 from Martin Sebor  ---
Reconfirmed with GCC 11.

[Bug c/69972] duplicate integer overflow diagnostic in constant expressions

2016-03-02 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #4 from Manuel López-Ibáñez  ---
(In reply to Bernd Schmidt from comment #3)
> For C I'm thinking it should be straightforward to set/check TREE_NO_WARNING
> (I have an untested patch).

The duplicate warning shows that we are doing two times the same work. Wouldn't
it be better to avoid that?

> For the C++ testcase the problem is that the first one is a warning, while
> the second one is an error - we can't really omit that.

The C/C++ FEs share almost no code in this respect. It doesn't make sense to
keep both issues conflated. C++ bug is now PR70057.

[Bug c/69972] duplicate integer overflow diagnostic in constant expressions

2016-03-02 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972

Bernd Schmidt  changed:

   What|Removed |Added

 CC||bernds at gcc dot gnu.org

--- Comment #3 from Bernd Schmidt  ---
For C I'm thinking it should be straightforward to set/check TREE_NO_WARNING (I
have an untested patch).

For the C++ testcase the problem is that the first one is a warning, while the
second one is an error - we can't really omit that.

The C++ errors become even more entertaining when you add -fpermissive:

69972-b.cc:2:16: warning: integer overflow in expression [-Woverflow]
69972-b.cc:2:20: warning: overflow in constant expression [-fpermissive]
69972-b.cc:2:20: note: in template argument for type ‘int’ 
69972-b.cc: In instantiation of ‘struct S<-2147483648>’:
69972-b.cc:2:22:   required from here
69972-b.cc:1:27: warning: overflow in constant expression [-fpermissive]
69972-b.cc:1:27: note: in template argument for type ‘int’ 
69972-b.cc:1:27: warning: overflow in constant expression [-fpermissive]
69972-b.cc:1:27: note: in template argument for type ‘int’ 
69972-b.cc:1:27: warning: overflow in constant expression [-fpermissive]
69972-b.cc:1:27: note: in template argument for type ‘int’

[Bug c/69972] duplicate integer overflow diagnostic in constant expressions

2016-02-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972

--- Comment #2 from Marek Polacek  ---
The first warning is shown by default and comes from parser_build_binary_op:
 3612   if (TREE_OVERFLOW_P (result.value)
 3613   && !TREE_OVERFLOW_P (arg1.value)
 3614   && !TREE_OVERFLOW_P (arg2.value))
 3615 overflow_warning (location, result.value);

The second is emitted with -Wpedantic in build_enumerator:
 8199   constant_expression_warning (value);

[Bug c/69972] duplicate integer overflow diagnostic in constant expressions

2016-02-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69972

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-02-29
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.