public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36077]  New: Expressions result is wrong
@ 2008-04-29 10:22 peter at xmos dot com
  2008-04-29 10:23 ` [Bug c/36077] " peter at xmos dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: peter at xmos dot com @ 2008-04-29 10:22 UTC (permalink / raw)
  To: gcc-bugs

I am developing a test generator for in house compilers and have come across a
difference where gcc does not agree with our compilers or the Microsoft
compiler.

The result t1_2a of the expression is what differs between gcc and other
compilers.

This is on gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9), and does not matter what
the platform is.

Compiled with:

$ gcc4 test.c -o test.exe
$ ./test.exe
Error:
t1_2a ffffffff
t1_2b 22a8b02e
t1_2c 0

Working:
t2_2a 0
t2_2b 0

When compared to running on Visual Studio:

$ cl test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for
80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj

$ ./test.exe
Error:
t1_2a 0
t1_2b 22a8b02e
t1_2c 0

Working:
t2_2a 0
t2_2b 0


-- 
           Summary: Expressions result is wrong
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter at xmos dot com
 GCC build triplet: gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
  GCC host triplet: Linux 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007
                    x86_64 x
GCC target triplet: Target: x86_64-redhat-linux


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


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

* [Bug c/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
@ 2008-04-29 10:23 ` peter at xmos dot com
  2008-04-29 10:23 ` peter at xmos dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: peter at xmos dot com @ 2008-04-29 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from peter at xmos dot com  2008-04-29 10:23 -------
Created an attachment (id=15544)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15544&action=view)
test.i


-- 


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


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

* [Bug c/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
  2008-04-29 10:23 ` [Bug c/36077] " peter at xmos dot com
@ 2008-04-29 10:23 ` peter at xmos dot com
  2008-04-29 11:41 ` [Bug middle-end/36077] " rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: peter at xmos dot com @ 2008-04-29 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from peter at xmos dot com  2008-04-29 10:23 -------
Created an attachment (id=15543)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15543&action=view)
test.c


-- 


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


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

* [Bug middle-end/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
  2008-04-29 10:23 ` [Bug c/36077] " peter at xmos dot com
  2008-04-29 10:23 ` peter at xmos dot com
@ 2008-04-29 11:41 ` rguenth at gcc dot gnu dot org
  2008-04-29 11:41 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 11:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-04-29 11:41 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
      Known to fail|                            |3.3.3 4.3.0
      Known to work|                            |2.95.3
   Last reconfirmed|2008-04-29 11:40:23         |2008-04-29 11:41:15
               date|                            |


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


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

* [Bug middle-end/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (2 preceding siblings ...)
  2008-04-29 11:41 ` [Bug middle-end/36077] " rguenth at gcc dot gnu dot org
@ 2008-04-29 11:41 ` rguenth at gcc dot gnu dot org
  2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 11:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-04-29 11:40 -------
Confirmed.  Testcase:

extern void abort (void);

unsigned test (unsigned x)
{
  return x / 0x80000001U / 0x00000002U;
}

int main()
{
  if (test(2) != 0)
    abort ();
  return 0;
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |middle-end
     Ever Confirmed|0                           |1
  GCC build triplet|gcc version 4.1.2 20070626  |
                   |(Red Hat 4.1.2-14)          |
   GCC host triplet|Linux 2.6.9-67.ELsmp #1 SMP |
                   |Wed Nov 7 13:56:44 EST 2007 |
                   |x86_64 x                    |
 GCC target triplet|Target: x86_64-redhat-linux |
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-04-29 11:40:23
               date|                            |


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


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

* [Bug middle-end/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (3 preceding siblings ...)
  2008-04-29 11:41 ` rguenth at gcc dot gnu dot org
@ 2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
  2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-04-29 13:53 -------
Fixed on the trunk.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|2.95.3                      |2.95.3 4.4.0


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


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

* [Bug middle-end/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (4 preceding siblings ...)
  2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
@ 2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
  2008-04-29 15:14 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-04-29 13:53 -------
Subject: Bug 36077

Author: rguenth
Date: Tue Apr 29 13:52:53 2008
New Revision: 134792

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134792
Log:
2008-04-29  Richard Guenther  <rguenther@suse.de>

        PR middle-end/36077
        * fold-const.c (extract_muldiv_1): In combining division constants
        make sure to never overflow.

        * gcc.c-torture/execute/pr36077.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr36077.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/36077] [4.1/4.2 Regression] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (6 preceding siblings ...)
  2008-04-29 15:14 ` rguenth at gcc dot gnu dot org
@ 2008-04-29 15:14 ` rguenth at gcc dot gnu dot org
  2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2008-04-29 15:13 -------
Also fixed on the 4.3 branch.  Unassigning.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rguenth at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW
      Known to fail|3.3.3 4.3.0                 |3.3.3 4.1.2 4.2.3 4.3.0
      Known to work|2.95.3 4.4.0                |2.95.3 4.3.1 4.4.0
            Summary|Expressions result is wrong |[4.1/4.2 Regression]
                   |                            |Expressions result is wrong
   Target Milestone|---                         |4.2.4


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


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

* [Bug middle-end/36077] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (5 preceding siblings ...)
  2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
@ 2008-04-29 15:14 ` rguenth at gcc dot gnu dot org
  2008-04-29 15:14 ` [Bug middle-end/36077] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2008-04-29 15:13 -------
Subject: Bug 36077

Author: rguenth
Date: Tue Apr 29 15:12:21 2008
New Revision: 134794

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134794
Log:
2008-04-29  Richard Guenther  <rguenther@suse.de>

        PR middle-end/36077
        * fold-const.c (extract_muldiv_1): In combining division constants
        make sure to never overflow.

        * gcc.c-torture/execute/pr36077.c: New testcase.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr36077.c
      - copied unchanged from r134792,
trunk/gcc/testsuite/gcc.c-torture/execute/pr36077.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    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=36077


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

* [Bug middle-end/36077] [4.1/4.2 Regression] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (7 preceding siblings ...)
  2008-04-29 15:14 ` [Bug middle-end/36077] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
@ 2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
  2008-07-04 23:03 ` [Bug middle-end/36077] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-31 15:37 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-05-19 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2008-05-19 20:25 -------
4.2.4 is being released, changing milestones to 4.2.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.4                       |4.2.5


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


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

* [Bug middle-end/36077] [4.2 Regression] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (8 preceding siblings ...)
  2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
@ 2008-07-04 23:03 ` jsm28 at gcc dot gnu dot org
  2009-03-31 15:37 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 23:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jsm28 at gcc dot gnu dot org  2008-07-04 23:02 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression]        |[4.2 Regression] Expressions
                   |Expressions result is wrong |result is wrong


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


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

* [Bug middle-end/36077] [4.2 Regression] Expressions result is wrong
  2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
                   ` (9 preceding siblings ...)
  2008-07-04 23:03 ` [Bug middle-end/36077] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-31 15:37 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 15:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jsm28 at gcc dot gnu dot org  2009-03-31 15:37 -------
Closing 4.2 branch, fixed in 4.3.1 and 4.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|3.3.3 4.1.2 4.2.3 4.3.0     |3.3.3 4.1.2 4.2.3 4.3.0
                   |                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.1


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


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

end of thread, other threads:[~2009-03-31 15:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-29 10:22 [Bug c/36077] New: Expressions result is wrong peter at xmos dot com
2008-04-29 10:23 ` [Bug c/36077] " peter at xmos dot com
2008-04-29 10:23 ` peter at xmos dot com
2008-04-29 11:41 ` [Bug middle-end/36077] " rguenth at gcc dot gnu dot org
2008-04-29 11:41 ` rguenth at gcc dot gnu dot org
2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
2008-04-29 13:54 ` rguenth at gcc dot gnu dot org
2008-04-29 15:14 ` rguenth at gcc dot gnu dot org
2008-04-29 15:14 ` [Bug middle-end/36077] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2008-05-19 20:35 ` jsm28 at gcc dot gnu dot org
2008-07-04 23:03 ` [Bug middle-end/36077] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-31 15:37 ` jsm28 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).