public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98418] New: Valid integer constant expressions based on expressions that trigger -Wshift-overflow are treated as non-constants
@ 2020-12-22 10:47 pskocik at gmail dot com
  2020-12-22 10:50 ` [Bug c/98418] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pskocik at gmail dot com @ 2020-12-22 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98418
           Summary: Valid integer constant expressions based on
                    expressions that trigger -Wshift-overflow are treated
                    as non-constants
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pskocik at gmail dot com
  Target Milestone: ---

This causes things like:

struct foo { unsigned bit: (0xffffffffll<<40)!=0; };

to elicit a -pedantic warning about the bitfield width not being a proper
integer constant expression, even though it is.

In other contexts, a complete compilation error might ensue:

extern int bar[ (0xffffffffll<<40)!=0 ]; //seen as an invalid VLA


https://gcc.godbolt.org/z/7zfz96

Neither clang nor gcc <= 5 appear to have this bug.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93241 seems related.

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

end of thread, other threads:[~2020-12-24 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 10:47 [Bug c/98418] New: Valid integer constant expressions based on expressions that trigger -Wshift-overflow are treated as non-constants pskocik at gmail dot com
2020-12-22 10:50 ` [Bug c/98418] " pinskia at gcc dot gnu.org
2020-12-24 18:53 ` pskocik at gmail dot com
2020-12-24 18:55 ` pskocik at gmail dot com

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