public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48717] New: likely integer wrong code bug
@ 2011-04-21 21:42 regehr at cs dot utah.edu
  2011-04-22  9:50 ` [Bug tree-optimization/48717] [4.7 Regression] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: regehr at cs dot utah.edu @ 2011-04-21 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: likely integer wrong code bug
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: regehr@cs.utah.edu


[regehr@gamow tmp012]$ current-gcc -O1 small.c -o small
[regehr@gamow tmp012]$ ./small
65535
[regehr@gamow tmp012]$ current-gcc -O2 small.c -o small
[regehr@gamow tmp012]$ ./small
-1
[regehr@gamow tmp012]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r172845-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r172845-install
--program-prefix=r172845- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110421 (experimental) (GCC) 

[regehr@gamow tmp012]$ cat small.c


unsigned short safe_52 (unsigned short ui1, unsigned short ui2)
{
  return ui1 + ui2;
}

extern int printf (const char *, ...);

int g_7 = 1;

int g_8;

void func_1 (void)
{
  g_7 = safe_52 (~g_8, g_8);
}

int main (void)
{
  func_1 ();
  printf ("%d\n", g_7);
  return 0;
}


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

* [Bug tree-optimization/48717] [4.7 Regression] integer wrong code bug
  2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
@ 2011-04-22  9:50 ` jakub at gcc dot gnu.org
  2011-04-22 10: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 @ 2011-04-22  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.6.0
   Last reconfirmed|                            |2011.04.22 09:49:44
          Component|c                           |tree-optimization
                 CC|                            |jakub at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|likely integer wrong code   |[4.7 Regression] integer
                   |bug                         |wrong code bug
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.7.0

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 09:49:44 UTC ---
Confirmed.  Started with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171450
I think the bug is in associate_plusminus, looking at it right now.


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

* [Bug tree-optimization/48717] [4.7 Regression] integer wrong code bug
  2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
  2011-04-22  9:50 ` [Bug tree-optimization/48717] [4.7 Regression] " jakub at gcc dot gnu.org
@ 2011-04-22 10:07 ` jakub at gcc dot gnu.org
  2011-04-22 18:53 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 10:06:43 UTC ---
Created attachment 24073
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24073
gcc47-pr48717.patch

Untested fix.  This is latent on the 4.6 branch since
http://gcc.gnu.org/viewcvs?view=revision&revision=163190
so IMNSHO should be fixed there too.


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

* [Bug tree-optimization/48717] [4.7 Regression] integer wrong code bug
  2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
  2011-04-22  9:50 ` [Bug tree-optimization/48717] [4.7 Regression] " jakub at gcc dot gnu.org
  2011-04-22 10:07 ` jakub at gcc dot gnu.org
@ 2011-04-22 18:53 ` jakub at gcc dot gnu.org
  2011-04-22 18:56 ` jakub at gcc dot gnu.org
  2011-04-22 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 18:52:51 UTC ---
Author: jakub
Date: Fri Apr 22 18:52:48 2011
New Revision: 172868

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172868
Log:
    PR tree-optimization/48717
    * tree-ssa-forwprop.c (associate_plusminus): For A + ~A and
    ~A + A optimizations use build_int_cst_type instead of build_int_cst.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr48717.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-forwprop.c


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

* [Bug tree-optimization/48717] [4.7 Regression] integer wrong code bug
  2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
                   ` (2 preceding siblings ...)
  2011-04-22 18:53 ` jakub at gcc dot gnu.org
@ 2011-04-22 18:56 ` jakub at gcc dot gnu.org
  2011-04-22 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 18:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 18:53:32 UTC ---
Author: jakub
Date: Fri Apr 22 18:53:30 2011
New Revision: 172869

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172869
Log:
    PR tree-optimization/48717
    * tree-ssa-forwprop.c (associate_plusminus): For A + ~A and
    ~A + A optimizations use build_int_cst_type instead of build_int_cst.

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

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/pr48717.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-ssa-forwprop.c


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

* [Bug tree-optimization/48717] [4.7 Regression] integer wrong code bug
  2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
                   ` (3 preceding siblings ...)
  2011-04-22 18:56 ` jakub at gcc dot gnu.org
@ 2011-04-22 19:16 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 19:16:00 UTC ---
Fixed.


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

end of thread, other threads:[~2011-04-22 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 21:42 [Bug c/48717] New: likely integer wrong code bug regehr at cs dot utah.edu
2011-04-22  9:50 ` [Bug tree-optimization/48717] [4.7 Regression] " jakub at gcc dot gnu.org
2011-04-22 10:07 ` jakub at gcc dot gnu.org
2011-04-22 18:53 ` jakub at gcc dot gnu.org
2011-04-22 18:56 ` jakub at gcc dot gnu.org
2011-04-22 19:16 ` 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).