public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35900] New: typecast (sign extension) missing
@ 2008-04-10 12:39 holger dot hopp at sap dot com
2008-04-10 13:46 ` [Bug c/35900] " rguenth at gcc dot gnu dot org
2008-04-10 16:15 ` holger dot hopp at sap dot com
0 siblings, 2 replies; 3+ messages in thread
From: holger dot hopp at sap dot com @ 2008-04-10 12:39 UTC (permalink / raw)
To: gcc-bugs
In the following example the typecast (sign extension) from int
(32bit) to long (64bit) is missing. Before the compare the signed i1
is < 0 and unsigned u2 is > 0 and this should be kept when casting to
64bit long. Same issue for long long (also 64bit).
So we get correct ov=1 with gcc version <= 4.2, but wrong ov=0 with
gcc version >= 4.3.
This issue occurs with and without optimization.
gcc version: gcc-4_3_branch and trunk svn revision 133752
(gcc-4_2 and below runs fine)
int main()
{
int ov;
unsigned u2;
int i1;
i1 = 0;
u2 = (unsigned)2147483647 + 1 ;
(i1) += (u2);
if ( (long)(i1)<(long)(u2) ) ov = 1; else ov = 0;
return !ov;
}
--
Summary: typecast (sign extension) missing
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: holger dot hopp at sap dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35900
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/35900] typecast (sign extension) missing
2008-04-10 12:39 [Bug c/35900] New: typecast (sign extension) missing holger dot hopp at sap dot com
@ 2008-04-10 13:46 ` rguenth at gcc dot gnu dot org
2008-04-10 16:15 ` holger dot hopp at sap dot com
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-10 13:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-04-10 13:45 -------
I belive this was fixed by
Author: rguenth
Date: Tue Apr 8 22:03:33 2008
New Revision: 134110
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134110
Log:
2008-04-08 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_widened_comparison): Do not allow
sign-changes that change the result.
* gcc.c-torture/execute/20080408-1.c: New testcase.
Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/20080408-1.c
- copied unchanged from r134108,
trunk/gcc/testsuite/gcc.c-torture/execute/20080408-1.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
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35900
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/35900] typecast (sign extension) missing
2008-04-10 12:39 [Bug c/35900] New: typecast (sign extension) missing holger dot hopp at sap dot com
2008-04-10 13:46 ` [Bug c/35900] " rguenth at gcc dot gnu dot org
@ 2008-04-10 16:15 ` holger dot hopp at sap dot com
1 sibling, 0 replies; 3+ messages in thread
From: holger dot hopp at sap dot com @ 2008-04-10 16:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from holger dot hopp at sap dot com 2008-04-10 16:15 -------
You're right!
Great - the fix is faster available than expected!
Thank you.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35900
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-10 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-10 12:39 [Bug c/35900] New: typecast (sign extension) missing holger dot hopp at sap dot com
2008-04-10 13:46 ` [Bug c/35900] " rguenth at gcc dot gnu dot org
2008-04-10 16:15 ` holger dot hopp at sap dot com
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).