public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "holger dot hopp at sap dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/35900] New: typecast (sign extension) missing Date: Thu, 10 Apr 2008 12:39:00 -0000 [thread overview] Message-ID: <bug-35900-15329@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2008-04-10 12:39 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-10 12:39 holger dot hopp at sap dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-35900-15329@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).