public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/5430: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values
@ 2002-04-23 16:31 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-04-23 16:31 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, ksteege, nobody

Synopsis: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values

State-Changed-From-To: analyzed->closed
State-Changed-By: rth
State-Changed-When: Tue Apr 23 16:31:32 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-04/msg01378.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5430


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

* Re: c/5430: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values
@ 2002-04-23  2:35 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-04-23  2:35 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, ksteege, nobody

Synopsis: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values

State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Tue Apr 23 02:35:10 2002
State-Changed-Why:
    Verified still present in 3.1 and a regression from 2.91.
    
    I suspect it's yet another problem with expand_muldiv, 
    but havn't examined it.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5430


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

* c/5430: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values
@ 2002-01-18 18:36 ksteege
  0 siblings, 0 replies; 3+ messages in thread
From: ksteege @ 2002-01-18 18:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5430
>Category:       c
>Synopsis:       possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 18 18:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Steege
>Release:        GCC 2.96
>Organization:
>Environment:
Red Had Linux 7.1
>Description:
Not sure if this is a true compiler bug or not, but the following problem occurred when we migrated to Linux RedHat 7.1 which came with gcc 2.96.  The problem did not occur with RedHat 6.2 which came with gcc 2.91.  
The code line : 
  Result = (((my_ushort + 2) * 2) - sizeof (my_8_struct) - 4) / 2;
where Result is a unsigned 32 bit value, my_ushort is an unsigned 16 bit value set to 924, and my_8_struct is an 8 byte structure
Produces the correct result with gcc 2.91 : 
(((my_ushort + 2) * 2) - sizeof (my_8_struct) - 4) / 2 =  920 = 0x398
But an incorrect value with gcc 2.96 : 
(((my_ushort + 2) * 2) - sizeof (my_8_struct) - 4) / 2 = 2147484568 = 0x80000398

Obviously there is a problem with the way the compiler casts the values between 16 bit and 32 bit integers, or at least with the way I believe the compiler should cast the values.
>How-To-Repeat:
Compile attached file mytest.c & run : 
gcc mytest.c
./a.out
>Fix:
The sample program contains several similar lines which work around the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-04-23 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 16:31 c/5430: possible gcc 2.96 error in simple arithmetic statement w/ 16 & 32 bit values rth
  -- strict thread matches above, loose matches on Subject: below --
2002-04-23  2:35 rth
2002-01-18 18:36 ksteege

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).