* [Bug ipa/66424] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
@ 2015-06-05 6:16 ` jakub at gcc dot gnu.org
2015-06-05 17:44 ` su at cs dot ucdavis.edu
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-05 6:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That looks like undefined behavior in the testcase. fn1 is K&R function with
int argument, like if it was:
void
fn1 (p)
int p;
{
f = 1 ^ e[f ^ (p & 1)];
}
but you are calling it with long long argument instead in fn2. If I change
it to void fn1 (p) long long p; { ... } or void fn1 (int p) { ... } or
change fn2 callers to cast the expressions to (int), it works fine.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2015-06-05 6:16 ` [Bug ipa/66424] " jakub at gcc dot gnu.org
@ 2015-06-05 17:44 ` su at cs dot ucdavis.edu
2015-06-05 18:03 ` joseph at codesourcery dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: su at cs dot ucdavis.edu @ 2015-06-05 17:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
--- Comment #2 from Zhendong Su <su at cs dot ucdavis.edu> ---
Jakub, I'm not sure that the code is invalid. First, the type of p in fn1 is
defaulted to int. Second, all the invocations of fn1 from fn2 are with the same
argument 0LL, which int can represent.
Also, none of ubsan, Frama-C, and CompCert's reference interpreter complains
about the code.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2015-06-05 6:16 ` [Bug ipa/66424] " jakub at gcc dot gnu.org
2015-06-05 17:44 ` su at cs dot ucdavis.edu
@ 2015-06-05 18:03 ` joseph at codesourcery dot com
2015-06-05 19:23 ` [Bug ipa/66424] [5/6 Regression] " jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: joseph at codesourcery dot com @ 2015-06-05 18:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
See C11 6.5.2.2#6 regarding when calls to unprototyped functions involve
undefined behavior. Being able to represent the value is only relevant
where the case is a mismatch of corresponding signed/unsigned types.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (2 preceding siblings ...)
2015-06-05 18:03 ` joseph at codesourcery dot com
@ 2015-06-05 19:23 ` jakub at gcc dot gnu.org
2015-06-22 12:03 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-05 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Last reconfirmed| |2015-06-05
CC| |vmakarov at gcc dot gnu.org
Resolution|INVALID |---
Target Milestone|--- |5.2
Summary|wrong code at -O2 and -O3 |[5/6 Regression] wrong code
|on x86_64-linux-gnu in |at -O2 and -O3 on
|32-bit mode |x86_64-linux-gnu in 32-bit
| |mode
Ever confirmed|0 |1
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Apparently it reproduces also with following, which doesn't have at least this
kind of undefined behavior in it. Started with r217588, thus most likely a
register allocation issue.
int a, b, c, d, e[2], f, l, m, n, o;
long long g = 1, j;
static unsigned int h;
static int i, k;
void
fn1 (long long p)
{
int q = p;
f = 1 ^ e[f ^ (q & 1)];
}
static void
fn2 (long long p)
{
f = 1 ^ e[(f ^ 1) & 1];
fn1 (p >> 1 & 1);
fn1 (p >> 32 & 1);
}
void
fn3 (int p)
{
g |= j = p;
}
int
main ()
{
e[0] = 1;
char p = l;
h = --g;
i = o = c;
m = d ? 1 / d : 0;
fn3 (l || 0);
b = a;
n = j++;
k--;
fn2 (g);
fn2 (h);
fn2 (i);
if (k + f)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (3 preceding siblings ...)
2015-06-05 19:23 ` [Bug ipa/66424] [5/6 Regression] " jakub at gcc dot gnu.org
@ 2015-06-22 12:03 ` rguenth at gcc dot gnu.org
2015-07-16 9:17 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-22 12:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Known to work| |4.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (4 preceding siblings ...)
2015-06-22 12:03 ` rguenth at gcc dot gnu.org
@ 2015-07-16 9:17 ` rguenth at gcc dot gnu.org
2015-07-21 19:55 ` vmakarov at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16 9:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|5.2 |5.3
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (5 preceding siblings ...)
2015-07-16 9:17 ` rguenth at gcc dot gnu.org
@ 2015-07-21 19:55 ` vmakarov at gcc dot gnu.org
2015-09-29 16:38 ` vmakarov at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2015-07-21 19:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
--- Comment #8 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Author: vmakarov
Date: Tue Jul 21 19:54:23 2015
New Revision: 226053
URL: https://gcc.gnu.org/viewcvs?rev=226053&root=gcc&view=rev
Log:
2015-07-21 Vladimir Makarov <vmakarov@redhat.com>
PR ipa/66424.
* lra-remat.c (operand_to_remat): Prevent using insns with input
subregs processed separately by IRA.
2015-07-21 Vladimir Makarov <vmakarov@redhat.com>
PR ipa/66424.
* gcc.target/i386/pr66424.c: New.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr66424.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-remat.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (6 preceding siblings ...)
2015-07-21 19:55 ` vmakarov at gcc dot gnu.org
@ 2015-09-29 16:38 ` vmakarov at gcc dot gnu.org
2015-09-29 18:26 ` doko at gcc dot gnu.org
2015-09-30 14:44 ` aurelien at aurel32 dot net
9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2015-09-29 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
--- Comment #9 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Author: vmakarov
Date: Tue Sep 29 16:37:26 2015
New Revision: 228256
URL: https://gcc.gnu.org/viewcvs?rev=228256&root=gcc&view=rev
Log:
2015-09-29 Vladimir Makarov <vmakarov@redhat.com>
Backport from mainline
2015-07-21 Vladimir Makarov <vmakarov@redhat.com>
PR ipa/66424.
* lra-remat.c (operand_to_remat): Prevent using insns with input
subregs processed separately by IRA.
2015-09-29 Vladimir Makarov <vmakarov@redhat.com>
Backport from mainline
2015-07-21 Vladimir Makarov <vmakarov@redhat.com>
PR ipa/66424.
* gcc.target/i386/pr66424.c: New.
Added:
branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr66424.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/lra-remat.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (7 preceding siblings ...)
2015-09-29 16:38 ` vmakarov at gcc dot gnu.org
@ 2015-09-29 18:26 ` doko at gcc dot gnu.org
2015-09-30 14:44 ` aurelien at aurel32 dot net
9 siblings, 0 replies; 11+ messages in thread
From: doko at gcc dot gnu.org @ 2015-09-29 18:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Matthias Klose <doko at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Matthias Klose <doko at gcc dot gnu.org> ---
fixed on trunk and the gcc-5 branch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/66424] [5/6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
` (8 preceding siblings ...)
2015-09-29 18:26 ` doko at gcc dot gnu.org
@ 2015-09-30 14:44 ` aurelien at aurel32 dot net
9 siblings, 0 replies; 11+ messages in thread
From: aurelien at aurel32 dot net @ 2015-09-30 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66424
Aurelien Jarno <aurelien at aurel32 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aurelien at aurel32 dot net
--- Comment #11 from Aurelien Jarno <aurelien at aurel32 dot net> ---
For the record this bug badly affects the MIPS target when using
-mtune=mips32r2, option which is implied by the -march=mips32r2 option. This
causes for example ffmpeg to be miscompiled, which causes its testsuite to fail
completely.
It's not a problem anymore now that the bug has been fixed on the gcc-5-branch,
however I prefer to mention it here, so that people debugging this issue find
this bug.
^ permalink raw reply [flat|nested] 11+ messages in thread