public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/65365] New: false positive signed negation
@ 2015-03-09 20:31 joerg.richter@pdv-fs.de
  2015-03-09 20:45 ` [Bug sanitizer/65365] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: joerg.richter@pdv-fs.de @ 2015-03-09 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65365
           Summary: false positive signed negation
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joerg.richter@pdv-fs.de
                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

cat > t.c <<EOF
int neg( unsigned v )
{
  return -(int)(v-1)-1;
}

int main( int, char** )
{
  neg( 2147483648u );
  return 0;
}
EOF

g++ -o t t.c -fsanitize=undefined
./t



Gives this output:
t.c:3:22: runtime error: negation of -2147483648 cannot be represented in type
'int'; cast to an unsigned type to negate this value to itself

AFAIKS all operations are defined.

If the subtraction with "-1" is removed the error about negation disappears.


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
@ 2015-03-09 20:45 ` mpolacek at gcc dot gnu.org
  2015-03-10  9:01 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-09 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This has already been fixed on trunk.  Not sure if the change is backportable.


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
  2015-03-09 20:45 ` [Bug sanitizer/65365] " mpolacek at gcc dot gnu.org
@ 2015-03-10  9:01 ` rguenth at gcc dot gnu.org
  2015-03-10 10:47 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-10  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-10
      Known to work|                            |5.0
     Ever confirmed|0                           |1


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
  2015-03-09 20:45 ` [Bug sanitizer/65365] " mpolacek at gcc dot gnu.org
  2015-03-10  9:01 ` rguenth at gcc dot gnu.org
@ 2015-03-10 10:47 ` mpolacek at gcc dot gnu.org
  2015-03-10 10:51 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-10 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.4

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in r218395, probably eligible to backport.  Jakub?


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
                   ` (2 preceding siblings ...)
  2015-03-10 10:47 ` mpolacek at gcc dot gnu.org
@ 2015-03-10 10:51 ` jakub at gcc dot gnu.org
  2015-03-10 10:54 ` mpolacek at gcc dot gnu.org
  2015-03-11 10:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-03-10 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ok with me.


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
                   ` (3 preceding siblings ...)
  2015-03-10 10:51 ` jakub at gcc dot gnu.org
@ 2015-03-10 10:54 ` mpolacek at gcc dot gnu.org
  2015-03-11 10:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-10 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks - mine then.


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

* [Bug sanitizer/65365] false positive signed negation
  2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
                   ` (4 preceding siblings ...)
  2015-03-10 10:54 ` mpolacek at gcc dot gnu.org
@ 2015-03-11 10:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-11 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

end of thread, other threads:[~2015-03-11 10:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 20:31 [Bug sanitizer/65365] New: false positive signed negation joerg.richter@pdv-fs.de
2015-03-09 20:45 ` [Bug sanitizer/65365] " mpolacek at gcc dot gnu.org
2015-03-10  9:01 ` rguenth at gcc dot gnu.org
2015-03-10 10:47 ` mpolacek at gcc dot gnu.org
2015-03-10 10:51 ` jakub at gcc dot gnu.org
2015-03-10 10:54 ` mpolacek at gcc dot gnu.org
2015-03-11 10:38 ` 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).