public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65830] New: -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints
@ 2015-04-21 13:02 mpolacek at gcc dot gnu.org
  2015-04-21 13:03 ` [Bug c/65830] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-21 13:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65830
           Summary: -Wno-shift-count-negative -Wno-shift-count-overflow
                    don't work with const ints
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org

When dealing with const ints, the warning can't be suppressed with
-Wno-shift-count-negative -Wno-shift-count-overflow.

A c-c++-common/ test case:

/* PR c/... */
/* { dg-do compile } */
/* { dg-options "-O -Wno-shift-count-negative -Wno-shift-count-overflow" } */

int
foo (int x)
{
  const int a = sizeof (int) * __CHAR_BIT__;
  const int b = -7;
  int c = 0;
  c += x << a;    /* { dg-bogus "left shift count >= width of type" } */
  c += x << b;    /* { dg-bogus "left shift count is negative" } */
  c += x >> a;    /* { dg-bogus "right shift count >= width of type" } */
  c += x >> b;  /* { dg-bogus "right shift count is negative" } */
  return c;
}


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

* [Bug c/65830] -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints
  2015-04-21 13:02 [Bug c/65830] New: -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints mpolacek at gcc dot gnu.org
@ 2015-04-21 13:03 ` mpolacek at gcc dot gnu.org
  2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
  2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-21 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-04-21
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Taking.


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

* [Bug c/65830] -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints
  2015-04-21 13:02 [Bug c/65830] New: -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints mpolacek at gcc dot gnu.org
  2015-04-21 13:03 ` [Bug c/65830] " mpolacek at gcc dot gnu.org
@ 2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
  2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-24 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

* [Bug c/65830] -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints
  2015-04-21 13:02 [Bug c/65830] New: -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints mpolacek at gcc dot gnu.org
  2015-04-21 13:03 ` [Bug c/65830] " mpolacek at gcc dot gnu.org
  2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
@ 2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-24 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Apr 24 11:53:27 2015
New Revision: 222407

URL: https://gcc.gnu.org/viewcvs?rev=222407&root=gcc&view=rev
Log:
    PR c/65830
    * c-common.c (c_fully_fold_internal): Use OPT_Wshift_count_negative
    and OPT_Wshift_count_overflow.

    * c-c++-common/pr65830.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/pr65830.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2015-04-24 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 13:02 [Bug c/65830] New: -Wno-shift-count-negative -Wno-shift-count-overflow don't work with const ints mpolacek at gcc dot gnu.org
2015-04-21 13:03 ` [Bug c/65830] " mpolacek at gcc dot gnu.org
2015-04-24 11:54 ` mpolacek at gcc dot gnu.org
2015-04-24 11:54 ` mpolacek 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).