public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
@ 2015-10-13 12:25 glisse at gcc dot gnu.org
  2015-10-13 12:34 ` [Bug tree-optimization/67953] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-10-13 12:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67953
           Summary: [6 Regression] match.pd: X - (X / Y) * Y wrong on
                    change of sign
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

$ cat z.c
#include <stdio.h>
unsigned f(signed a){
  return (unsigned)a-((a/3)*3);
}
unsigned g(signed a){
  return a-((a/3)*3);
}
int main(){
  printf("%d %d\n", f(-5), g(-5));
}
$ gcc-5 z.c && ./a.out
-2 -2
$ clang z.c && ./a.out       
-2 -2
$ gcc-snapshot z.c && ./a.out 
2 -2


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

* [Bug tree-optimization/67953] [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
  2015-10-13 12:25 [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign glisse at gcc dot gnu.org
@ 2015-10-13 12:34 ` mpolacek at gcc dot gnu.org
  2015-10-13 16:51 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-13 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-13
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r225195 :(.


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

* [Bug tree-optimization/67953] [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
  2015-10-13 12:25 [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign glisse at gcc dot gnu.org
  2015-10-13 12:34 ` [Bug tree-optimization/67953] " mpolacek at gcc dot gnu.org
@ 2015-10-13 16:51 ` mpolacek at gcc dot gnu.org
  2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
  2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-13 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

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 #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
So mine.


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

* [Bug tree-optimization/67953] [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
  2015-10-13 12:25 [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
@ 2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-15  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Oct 15 09:39:35 2015
New Revision: 228839

URL: https://gcc.gnu.org/viewcvs?rev=228839&root=gcc&view=rev
Log:
        PR tree-optimization/67953
        * match.pd (X - (X / Y) * Y): Don't change signedness of @0.

        * gcc.dg/fold-minus-6.c (fn4): Change the type of A to
        unsigned.
        * gcc.dg/torture/pr67953.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr67953.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/fold-minus-6.c


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

* [Bug tree-optimization/67953] [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
  2015-10-13 12:25 [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign glisse at gcc dot gnu.org
  2015-10-13 12:34 ` [Bug tree-optimization/67953] " mpolacek at gcc dot gnu.org
  2015-10-13 16:51 ` mpolacek at gcc dot gnu.org
@ 2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
  2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-15  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

end of thread, other threads:[~2015-10-15  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 12:25 [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign glisse at gcc dot gnu.org
2015-10-13 12:34 ` [Bug tree-optimization/67953] " mpolacek at gcc dot gnu.org
2015-10-13 16:51 ` mpolacek at gcc dot gnu.org
2015-10-15  9:40 ` mpolacek at gcc dot gnu.org
2015-10-15  9:40 ` 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).