public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107388] New: GCC should diagnose unsigned to signed conversion  with -Wconversion
@ 2022-10-24 23:17 nikolasklauser at berlin dot de
  2022-10-24 23:20 ` [Bug c++/107388] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nikolasklauser at berlin dot de @ 2022-10-24 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107388

            Bug ID: 107388
           Summary: GCC should diagnose unsigned to signed conversion
                    with -Wconversion
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nikolasklauser at berlin dot de
  Target Milestone: ---

It looks like GCC currently doesn't diagnose a conversion from unsigned int to
int, but as I understand it -Wconversion should diagnose any conversion that
might change the value.

Here is an example: (Godbolt: https://godbolt.org/z/Mr8KvTW66)

#include <cstddef>
#include <cstdlib>

void func(unsigned int size) {
  [[maybe_unused]] int v = size; // doesn't get diagnosed
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-25 19:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 23:17 [Bug c++/107388] New: GCC should diagnose unsigned to signed conversion with -Wconversion nikolasklauser at berlin dot de
2022-10-24 23:20 ` [Bug c++/107388] " mpolacek at gcc dot gnu.org
2022-10-24 23:20 ` mpolacek at gcc dot gnu.org
2022-10-25 19:57 ` nikolasklauser at berlin dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).