public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39855]  New: Shift optimization discards operands' side effects
@ 2009-04-22 18:38 foo at mailinator dot com
  2009-04-22 19:10 ` [Bug c/39855] [4.3/4.4/4.5 Regression] " jakub at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: foo at mailinator dot com @ 2009-04-22 18:38 UTC (permalink / raw)
  To: gcc-bugs

#include <stdio.h>
int foo() {
    puts("Hello world");
    return 0;
}
int main() {
    foo() << 30 << 2;
    return (unsigned)foo() >> 16 >> 16;
}

% gcc test.c
% ./a.out
%


-- 
           Summary: Shift optimization discards operands' side effects
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: foo at mailinator dot com


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


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

* [Bug c/39855] [4.3/4.4/4.5 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
@ 2009-04-22 19:10 ` jakub at gcc dot gnu dot org
  2009-04-22 20:18 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 19:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.2 4.3.3 4.4.0 4.5.0
      Known to work|                            |3.4.6 4.0.1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-22 19:09:52
               date|                            |
            Summary|Shift optimization discards |[4.3/4.4/4.5 Regression]
                   |operands' side effects      |Shift optimization discards
                   |                            |operands' side effects


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


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

* [Bug c/39855] [4.3/4.4/4.5 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
  2009-04-22 19:10 ` [Bug c/39855] [4.3/4.4/4.5 Regression] " jakub at gcc dot gnu dot org
@ 2009-04-22 20:18 ` jakub at gcc dot gnu dot org
  2009-04-22 20:21 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-04-22 20:17 -------
Created an attachment (id=17677)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17677&action=view)
gcc45-pr39855.patch

Fix I'm going to bootstrap/regtest.


-- 


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


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

* [Bug c/39855] [4.3/4.4/4.5 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
  2009-04-22 19:10 ` [Bug c/39855] [4.3/4.4/4.5 Regression] " jakub at gcc dot gnu dot org
  2009-04-22 20:18 ` jakub at gcc dot gnu dot org
@ 2009-04-22 20:21 ` jakub at gcc dot gnu dot org
  2009-04-22 21:58 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 20:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-04-22 20:20 -------
Argh, attached wrong version of the patch, the arguments to omit_one_operand of
course need to be swapped.  Sorry.


-- 


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


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

* [Bug c/39855] [4.3/4.4/4.5 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (2 preceding siblings ...)
  2009-04-22 20:21 ` jakub at gcc dot gnu dot org
@ 2009-04-22 21:58 ` jakub at gcc dot gnu dot org
  2009-04-22 22:03 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-04-22 21:58 -------
Subject: Bug 39855

Author: jakub
Date: Wed Apr 22 21:57:52 2009
New Revision: 146617

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146617
Log:
        PR c/39855
        * fold-const.c (fold_binary) <case LSHIFT_EXPR>: When optimizing
        into 0, use omit_one_operand.

        * gcc.dg/torture/pr39855.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr39855.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39855] [4.3/4.4/4.5 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (3 preceding siblings ...)
  2009-04-22 21:58 ` jakub at gcc dot gnu dot org
@ 2009-04-22 22:03 ` jakub at gcc dot gnu dot org
  2009-04-22 22:07 ` [Bug c/39855] [4.3 " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-04-22 22:03 -------
Subject: Bug 39855

Author: jakub
Date: Wed Apr 22 22:02:54 2009
New Revision: 146622

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146622
Log:
        PR c/39855
        * fold-const.c (fold_binary) <case LSHIFT_EXPR>: When optimizing
        into 0, use omit_one_operand.

        * gcc.dg/torture/pr39855.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr39855.c
      - copied unchanged from r146617,
trunk/gcc/testsuite/gcc.dg/torture/pr39855.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/fold-const.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39855] [4.3 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (4 preceding siblings ...)
  2009-04-22 22:03 ` jakub at gcc dot gnu dot org
@ 2009-04-22 22:07 ` jakub at gcc dot gnu dot org
  2009-06-17 20:59 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-22 22:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-04-22 22:06 -------
Fixed so far for 4.4.1 and 4.5.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.1.2 4.3.3 4.4.0 4.5.0     |4.1.2 4.3.3 4.4.0
      Known to work|3.4.6 4.0.1                 |3.4.6 4.0.1 4.4.1 4.5.0
            Summary|[4.3/4.4/4.5 Regression]    |[4.3 Regression] Shift
                   |Shift optimization discards |optimization discards
                   |operands' side effects      |operands' side effects
   Target Milestone|---                         |4.3.4


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


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

* [Bug c/39855] [4.3 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (5 preceding siblings ...)
  2009-04-22 22:07 ` [Bug c/39855] [4.3 " jakub at gcc dot gnu dot org
@ 2009-06-17 20:59 ` rguenth at gcc dot gnu dot org
  2009-06-18 14:44 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-17 20:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2


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


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

* [Bug c/39855] [4.3 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (6 preceding siblings ...)
  2009-06-17 20:59 ` rguenth at gcc dot gnu dot org
@ 2009-06-18 14:44 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-18 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-06-18 14:44 -------
Testing backport.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jakub at gcc dot gnu dot org|rguenth at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c/39855] [4.3 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (7 preceding siblings ...)
  2009-06-18 14:44 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-06-19 12:23 -------
Subject: Bug 39855

Author: rguenth
Date: Fri Jun 19 12:23:16 2009
New Revision: 148700

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148700
Log:
2009-06-19  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
        2009-04-22  Jakub Jelinek  <jakub@redhat.com>

        PR c/39855
        * fold-const.c (fold_binary) <case LSHIFT_EXPR>: When optimizing
        into 0, use omit_one_operand.

        * gcc.dg/torture/pr39855.c: New test.

        2009-01-30  Jakub Jelinek  <jakub@redhat.com>

        PR target/39013
        * c-decl.c (pop_scope): Set DECL_EXTERNAL for functions declared
        inline but never defined.

        * gcc.target/i386/pr39013-1.c: New test.
        * gcc.target/i386/pr39013-2.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/torture/pr39855.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr39013-1.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr39013-2.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-decl.c
    branches/gcc-4_3-branch/gcc/fold-const.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/39855] [4.3 Regression] Shift optimization discards operands' side effects
  2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
                   ` (8 preceding siblings ...)
  2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2009-06-19 12:24 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|3.4.6 4.0.1 4.4.1 4.5.0     |3.4.6 4.0.1 4.3.4 4.4.1
                   |                            |4.5.0
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-06-19 12:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22 18:38 [Bug c/39855] New: Shift optimization discards operands' side effects foo at mailinator dot com
2009-04-22 19:10 ` [Bug c/39855] [4.3/4.4/4.5 Regression] " jakub at gcc dot gnu dot org
2009-04-22 20:18 ` jakub at gcc dot gnu dot org
2009-04-22 20:21 ` jakub at gcc dot gnu dot org
2009-04-22 21:58 ` jakub at gcc dot gnu dot org
2009-04-22 22:03 ` jakub at gcc dot gnu dot org
2009-04-22 22:07 ` [Bug c/39855] [4.3 " jakub at gcc dot gnu dot org
2009-06-17 20:59 ` rguenth at gcc dot gnu dot org
2009-06-18 14:44 ` rguenth at gcc dot gnu dot org
2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
2009-06-19 12:24 ` rguenth at gcc dot gnu dot 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).