public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/58413] New: ubsan constant folding
@ 2013-09-13  9:46 jan.smets@alcatel-lucent.com
  2013-09-13  9:55 ` [Bug sanitizer/58413] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-09-13  9:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

            Bug ID: 58413
           Summary: ubsan constant folding
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.smets@alcatel-lucent.com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

variable-sized object may not be initialized
  unsigned short x[128 >> 5] = {};

initializer element is not constant
  static int x = ((int)( 0x00000000 | ((31 & ((1 << (4)) - 1)) << (((15) + 6) +
4)) | ((0) << ((15) + 6)) | ((0) << (15)) ) );
(yes, auch)

unexpected size of type 'long long unsigned int:40'
  uint64_t start_of_buffer = ((res.ptr.s.addr >> 7) - res.ptr.s.back) << 7; 
   .addr and .back are bitfield members of struct s. ptr is a pointer to an
union.


case label does not reduce to an integer constant

switch(int)
...
   case (1<<1):
    ..


They all seem related.

Thanks!


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
@ 2013-09-13  9:55 ` mpolacek at gcc dot gnu.org
  2013-09-13 18:16 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-13  9:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-13
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

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


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
  2013-09-13  9:55 ` [Bug sanitizer/58413] " mpolacek at gcc dot gnu.org
@ 2013-09-13 18:16 ` mpolacek at gcc dot gnu.org
  2013-09-14  8:30 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-13 18:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A patch that hopefully fixes the integer constant expression issues posted:
http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01057.html


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
  2013-09-13  9:55 ` [Bug sanitizer/58413] " mpolacek at gcc dot gnu.org
  2013-09-13 18:16 ` mpolacek at gcc dot gnu.org
@ 2013-09-14  8:30 ` mpolacek at gcc dot gnu.org
  2013-09-16 16:00 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-14  8:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
                   ` (2 preceding siblings ...)
  2013-09-14  8:30 ` mpolacek at gcc dot gnu.org
@ 2013-09-16 16:00 ` mpolacek at gcc dot gnu.org
  2013-09-25  8:59 ` mpolacek at gcc dot gnu.org
  2013-09-25  9:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-16 16:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A patch with the testcase for the bit-field issue has been posted:
http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01212.html


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
                   ` (3 preceding siblings ...)
  2013-09-16 16:00 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  8:59 ` mpolacek at gcc dot gnu.org
  2013-09-25  9:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  8:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Sep 25 08:58:57 2013
New Revision: 202886

URL: http://gcc.gnu.org/viewcvs?rev=202886&root=gcc&view=rev
Log:
    PR sanitizer/58413
c-family/
    * c-ubsan.c (ubsan_instrument_shift): Don't instrument
    an expression if we can prove it is correct.
    (ubsan_instrument_division): Likewise.  Remove unnecessary
    check.
testsuite/
    * c-c++-common/ubsan/shift-5.c: New test.
    * c-c++-common/ubsan/shift-6.c: New test.
    * c-c++-common/ubsan/div-by-zero-5.c: New test.
    * gcc.dg/ubsan/c-shift-1.c: New test.


Added:
    trunk/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-5.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-6.c
    trunk/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-ubsan.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug sanitizer/58413] ubsan constant folding
  2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
                   ` (4 preceding siblings ...)
  2013-09-25  8:59 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  9:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  9:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58413

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

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Should be fixed.


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

end of thread, other threads:[~2013-09-25  9:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-13  9:46 [Bug sanitizer/58413] New: ubsan constant folding jan.smets@alcatel-lucent.com
2013-09-13  9:55 ` [Bug sanitizer/58413] " mpolacek at gcc dot gnu.org
2013-09-13 18:16 ` mpolacek at gcc dot gnu.org
2013-09-14  8:30 ` mpolacek at gcc dot gnu.org
2013-09-16 16:00 ` mpolacek at gcc dot gnu.org
2013-09-25  8:59 ` mpolacek at gcc dot gnu.org
2013-09-25  9:00 ` 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).