public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os
@ 2013-06-08 19:16 dhazeghi at yahoo dot com
  2013-06-08 20:06 ` [Bug rtl-optimization/57568] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-06-08 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57568
           Summary: wrong code for assignment in conditional at -Os
           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 code is miscompiled by gcc trunk and 4.8 on x86_64-linux at -Os
and above optimization levels in 32-bit mode (should print nothing).  This is a
regression from 4.7.x.

$ gcc-trunk -v
gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) 
$ gcc-trunk -O1 -m32 reduced.c 
$ ./a.out 
$ gcc-4.7 -Os -m32 reduced.c 
$ ./a.out 
$ gcc-trunk -Os -m32 reduced.c 
$ ./a.out 
1
$
---------------
int printf (const char *, ...);

int a[6][9] = {};
int b = 1;
int *c = &a[3][5];

int main ()
{
  if (b)
    if (*c = *c + *c)
      printf ("%d\n", a[3][5]);

  return 0;
}


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

* [Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os
  2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
@ 2013-06-08 20:06 ` jakub at gcc dot gnu.org
  2013-06-08 20:07 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-08 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-06-08
                 CC|                            |jakub at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.8.2
            Summary|wrong code for assignment   |[4.8/4.9 Regression] wrong
                   |in conditional at -Os       |code for assignment in
                   |                            |conditional at -Os
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r188785, but guess it has just been latent before that.


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

* [Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os
  2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
  2013-06-08 20:06 ` [Bug rtl-optimization/57568] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
@ 2013-06-08 20:07 ` jakub at gcc dot gnu.org
  2013-06-09 18:43 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-08 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 30280
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30280&action=edit
gcc49-pr57568.patch

Untested fix.


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

* [Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os
  2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
  2013-06-08 20:06 ` [Bug rtl-optimization/57568] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
  2013-06-08 20:07 ` jakub at gcc dot gnu.org
@ 2013-06-09 18:43 ` jakub at gcc dot gnu.org
  2013-06-09 20:48 ` dhazeghi at yahoo dot com
  2013-06-09 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-09 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Sun Jun  9 18:30:01 2013
New Revision: 199870

URL: http://gcc.gnu.org/viewcvs?rev=199870&root=gcc&view=rev
Log:
    PR target/57568
    * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure
    that operands[2] doesn't overlap with operands[0].

    * gcc.c-torture/execute/pr57568.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr57568.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md
    trunk/gcc/testsuite/ChangeLog

Author: jakub
Date: Sun Jun  9 18:33:32 2013
New Revision: 199871

URL: http://gcc.gnu.org/viewcvs?rev=199871&root=gcc&view=rev
Log:
    PR target/57568
    * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure
    that operands[2] doesn't overlap with operands[0].

    * gcc.c-torture/execute/pr57568.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/execute/pr57568.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/i386/i386.md
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog

Author: jakub
Date: Sun Jun  9 18:37:51 2013
New Revision: 199872

URL: http://gcc.gnu.org/viewcvs?rev=199872&root=gcc&view=rev
Log:
    PR target/57568
    * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure
    that operands[2] doesn't overlap with operands[0].

    * gcc.c-torture/execute/pr57568.c: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.c-torture/execute/pr57568.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/i386/i386.md
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os
  2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
                   ` (2 preceding siblings ...)
  2013-06-09 18:43 ` jakub at gcc dot gnu.org
@ 2013-06-09 20:48 ` dhazeghi at yahoo dot com
  2013-06-09 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-06-09 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dara Hazeghi <dhazeghi at yahoo dot com> ---
Wow, that was fast!  Confirmed fixed, thanks.


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

* [Bug rtl-optimization/57568] [4.8/4.9 Regression] wrong code for assignment in conditional at -Os
  2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
                   ` (3 preceding siblings ...)
  2013-06-09 20:48 ` dhazeghi at yahoo dot com
@ 2013-06-09 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-09 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Thanks for the report (and other reports).


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

end of thread, other threads:[~2013-06-09 21:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-08 19:16 [Bug rtl-optimization/57568] New: wrong code for assignment in conditional at -Os dhazeghi at yahoo dot com
2013-06-08 20:06 ` [Bug rtl-optimization/57568] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-06-08 20:07 ` jakub at gcc dot gnu.org
2013-06-09 18:43 ` jakub at gcc dot gnu.org
2013-06-09 20:48 ` dhazeghi at yahoo dot com
2013-06-09 21:11 ` 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).