This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Oct 2015 12:25:36 +0000
- Subject: [Bug tree-optimization/67953] New: [6 Regression] match.pd: X - (X / Y) * Y wrong on change of sign
- Auto-submitted: auto-generated
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