public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57300] New: statement in expression miscompiled at -O3 in 32-bit mode
@ 2013-05-15 19:41 dhazeghi at yahoo dot com
  2013-05-16  7:53 ` [Bug rtl-optimization/57300] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-05-15 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57300
           Summary: statement in expression miscompiled at -O3 in 32-bit
                    mode
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dhazeghi at yahoo dot com

The following testcase appears to be miscompiled with gcc 4.8 and trunk on
x86_64-linux-gnu at -O3 optimization level in 32-bit mode.  In 64-bit mode, at
lower optimization, or with gcc 4.7 and earlier it works correctly.

$ gcc-trunk -v
Target: x86_64-unknown-linux-gnu
...
gcc version 4.9.0 20130515 (experimental) [trunk revision 198926] (GCC) 
$ gcc-trunk -O2 -m32 small.c
$ ./a.out 
1
$ gcc-trunk -O3 -m64 small.c
$ ./a.out 
1
$ gcc-4.7 -O3 -m32 small.c
$ ./a.out 
1
$ gcc-trunk -O3 -m32 small.c
$ ./a.out 
0
$

------------------------------

int printf (const char *, ...);
int a, b, e;
long long c;
int d[10];
int
main ()
{
    int *f = &a;
    e = 0;
    for (; e < 10; e++)
        d[e] = 1;
    if (d[0])
        c = (
    {
        int g = *f = (
        {
            b == 0 || 1 % b;
        });
        g;
    }
    );
    printf ("%d\n", a);
    return 0;
}


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

end of thread, other threads:[~2013-05-20  7:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-15 19:41 [Bug rtl-optimization/57300] New: statement in expression miscompiled at -O3 in 32-bit mode dhazeghi at yahoo dot com
2013-05-16  7:53 ` [Bug rtl-optimization/57300] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-05-16  8:11 ` jakub at gcc dot gnu.org
2013-05-16  8:16 ` jakub at gcc dot gnu.org
2013-05-16  8:35 ` jakub at gcc dot gnu.org
2013-05-16  8:51 ` steven at gcc dot gnu.org
2013-05-16  9:02 ` jakub at gcc dot gnu.org
2013-05-16  9:29 ` ebotcazou at gcc dot gnu.org
2013-05-16  9:43 ` jakub at gcc dot gnu.org
2013-05-16  9:50 ` steven at gcc dot gnu.org
2013-05-16 10:08 ` jakub at gcc dot gnu.org
2013-05-16 10:13 ` jakub at gcc dot gnu.org
2013-05-16 11:26 ` rguenth at gcc dot gnu.org
2013-05-16 14:48 ` ebotcazou at gcc dot gnu.org
2013-05-20  7:13 ` 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).