[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2024-04-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.3

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Marek Polacek  ---
Fixed in 9.3+.

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #13 from Marek Polacek  ---
Author: mpolacek
Date: Thu Aug 15 18:32:33 2019
New Revision: 274545

URL: https://gcc.gnu.org/viewcvs?rev=274545=gcc=rev
Log:
PR c++/87519 - bogus warning with -Wsign-conversion.
* typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
the types directly.

* g++.dg/warn/Wsign-conversion-5.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/warn/Wsign-conversion-5.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/typeck.c

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #12 from Marek Polacek  ---
Fixed on trunk, will backport to 9.3 later.

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

--- Comment #11 from Marek Polacek  ---
Author: mpolacek
Date: Thu Aug  8 15:37:46 2019
New Revision: 274211

URL: https://gcc.gnu.org/viewcvs?rev=274211=gcc=rev
Log:
PR c++/87519 - bogus warning with -Wsign-conversion.
* typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
the types directly.

* g++.dg/warn/Wsign-conversion-5.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wsign-conversion-5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #10 from Marek Polacek  ---
Tested fine:
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00553.html

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #9 from Marek Polacek  ---
I think I have a fix.  Will test tomorrow morning.

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2019-08-07 Thread Keith.S.Thompson at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Keith Thompson  changed:

   What|Removed |Added

 CC||Keith.S.Thompson at gmail dot 
com

--- Comment #8 from Keith Thompson  ---
Another test case:

#include 
int main() {
int i = 42;
size_t s0 = sizeof (int) + (size_t)i;
size_t s1 = sizeof (int) + static_cast(i);
}

https://stackoverflow.com/q/57403497/827263
https://stackoverflow.com/a/57404123/827263

[Bug c++/87519] -Wsign-conversion -Wconversion explicit cast fails to silence warning

2018-10-04 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87519

Manuel López-Ibáñez  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-10-04
 CC||manu at gcc dot gnu.org
Summary|-Wsign-conversion   |-Wsign-conversion
   |erroneosly triggered when   |-Wconversion explicit cast
   |converting to auto-deduced  |fails to silence warning
   |interger type   |
 Ever confirmed|0   |1

--- Comment #7 from Manuel López-Ibáñez  ---
Nothing to do with deduced types:

typedef unsigned long int uint64_t ;

void f(unsigned long int a, int q) {
  a = a + static_cast(q);
}