public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102538] New: Wrong narrowing conversion checking for initializer with union
@ 2021-09-30  7:04 kito at gcc dot gnu.org
  2021-09-30  7:16 ` [Bug c++/102538] " jakub at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: kito at gcc dot gnu.org @ 2021-09-30  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102538
           Summary: Wrong narrowing conversion checking for initializer
                    with union
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kito at gcc dot gnu.org
  Target Milestone: ---

How to reproduce:
g++ x.cpp

Testcase:
```
#include <stdint.h>

struct X {
  union {
    uint8_t r8[8];
    uint32_t r32[2];
  };
};

struct ctx {
  X v[1];
};


ctx x = {
  {
     {.r32 = {5,0x33333}},
  }
};
```

Message:
x.cpp:19:1: error: narrowing conversion of '209715' from 'int' to 'uint8_t'
{aka 'unsigned char'} [-Wnarrowing]
   19 | };
      | ^


Work with GCC 11.1 but not work with GCC 11.2 and trunk

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

end of thread, other threads:[~2022-03-26 23:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30  7:04 [Bug c++/102538] New: Wrong narrowing conversion checking for initializer with union kito at gcc dot gnu.org
2021-09-30  7:16 ` [Bug c++/102538] " jakub at gcc dot gnu.org
2021-09-30  7:17 ` [Bug c++/102538] [11/12 Regression] " jakub at gcc dot gnu.org
2021-09-30  7:20 ` jakub at gcc dot gnu.org
2021-10-01 13:04 ` jakub at gcc dot gnu.org
2021-10-01 15:23 ` ppalka at gcc dot gnu.org
2021-10-01 15:25 ` jakub at gcc dot gnu.org
2021-11-19 17:18 ` ppalka at gcc dot gnu.org
2022-01-20 17:33 ` ppalka at gcc dot gnu.org
2022-03-04 14:09 ` mpolacek at gcc dot gnu.org
2022-03-21 20:47 ` cvs-commit at gcc dot gnu.org
2022-03-21 21:02 ` [Bug c++/102538] [11 " jason at gcc dot gnu.org
2022-03-22  5:18 ` cvs-commit at gcc dot gnu.org
2022-03-26 23:29 ` jason at gcc dot gnu.org

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).