public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows
@ 2011-03-07 16:01 jakub at gcc dot gnu.org
  2011-03-07 16:33 ` [Bug tree-optimization/48022] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-07 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.6 Regression] -Wstrict-overflow warning on code
                    that doesn't have overflows
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org


int
foo (const char *x)
{
  unsigned long l = 1;
  const unsigned char *s = (const unsigned char *) (const char *) (x);
  int r = s[0] - ((const unsigned char *) (const char *) ("/"))[0];
  if (l > 0 && r == 0)
    r = (s[1] - ((const unsigned char *) (const char *) ("/"))[1]);
  return r;
}

gets at -O2 on x86_64-linux
warning: assuming signed overflow does not occur when changing X +- C1 cmp C2
to X cmp C1 +- C2 [-Wstrict-overflow]

This is simplified return strcmp (path, "/"); when using glibc <string.h>
strcmp macro.

The warning started with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161655


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

* [Bug tree-optimization/48022] [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows
  2011-03-07 16:01 [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows jakub at gcc dot gnu.org
@ 2011-03-07 16:33 ` rguenth at gcc dot gnu.org
  2011-03-07 16:51 ` rjones at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-07 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0


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

* [Bug tree-optimization/48022] [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows
  2011-03-07 16:01 [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows jakub at gcc dot gnu.org
  2011-03-07 16:33 ` [Bug tree-optimization/48022] " rguenth at gcc dot gnu.org
@ 2011-03-07 16:51 ` rjones at redhat dot com
  2011-03-08 10:43 ` jakub at gcc dot gnu.org
  2011-03-08 10:44 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rjones at redhat dot com @ 2011-03-07 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from rjones at redhat dot com <rjones at redhat dot com> 2011-03-07 16:51:14 UTC ---
Report on Fedora devel mailing list:
http://lists.fedoraproject.org/pipermail/devel/2011-March/thread.html#149342


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

* [Bug tree-optimization/48022] [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows
  2011-03-07 16:01 [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows jakub at gcc dot gnu.org
  2011-03-07 16:33 ` [Bug tree-optimization/48022] " rguenth at gcc dot gnu.org
  2011-03-07 16:51 ` rjones at redhat dot com
@ 2011-03-08 10:43 ` jakub at gcc dot gnu.org
  2011-03-08 10:44 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-08 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-08 10:43:14 UTC ---
Author: jakub
Date: Tue Mar  8 10:43:10 2011
New Revision: 170772

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170772
Log:
    PR tree-optimization/48022
    * fold-const.c (fold_comparison): Don't call fold_overflow_warning
    for EQ/NE_EXPR.

    * gcc.dg/pr48022-1.c: New test.
    * gcc.dg/pr48022-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr48022-1.c
    trunk/gcc/testsuite/gcc.dg/pr48022-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/48022] [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows
  2011-03-07 16:01 [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-08 10:43 ` jakub at gcc dot gnu.org
@ 2011-03-08 10:44 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-08 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-08 10:44:30 UTC ---
Fixed.


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

end of thread, other threads:[~2011-03-08 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-07 16:01 [Bug tree-optimization/48022] New: [4.6 Regression] -Wstrict-overflow warning on code that doesn't have overflows jakub at gcc dot gnu.org
2011-03-07 16:33 ` [Bug tree-optimization/48022] " rguenth at gcc dot gnu.org
2011-03-07 16:51 ` rjones at redhat dot com
2011-03-08 10:43 ` jakub at gcc dot gnu.org
2011-03-08 10:44 ` jakub 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).