public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/33887] [4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing Date: Tue, 11 Dec 2007 12:38:00 -0000 [thread overview] Message-ID: <20071211123815.18354.qmail@sourceware.org> (raw) In-Reply-To: <bug-33887-1313@http.gcc.gnu.org/bugzilla/> ------- Comment #6 from rguenth at gcc dot gnu dot org 2007-12-11 12:38 ------- In reply to comment #3: no, int f2 = sv.f2; does _not_ sign extend. 4.7/3 says "If the destination type is signed, the value is unchanged if it can be represented in the destination type...". Note your bitfield is unsigned. Instead the error is with ++sv.f2; f2 = sv.f2; fn(f2, 0); which should result in zero (as tested). But we expand the above to ;; D.2041 = sv.f2 + 1 (insn 20 17 21 t.ii:27 (set (reg/f:DI 71) (const:DI (plus:DI (symbol_ref:DI ("sv") [flags 0x2] <var_decl 0x2b1ba3468140 sv>) (const_int 4 [0x4])))) -1 (nil)) (insn 21 20 22 t.ii:27 (set (reg:SI 73) (mem/s/c:SI (reg/f:DI 71) [0+4 S4 A32])) -1 (nil)) (insn 22 21 23 t.ii:27 (parallel [ (set (reg:SI 72) (lshiftrt:SI (reg:SI 73) (const_int 8 [0x8]))) (clobber (reg:CC 17 flags)) ]) -1 (expr_list:REG_EQUAL (lshiftrt:SI (mem/s/c:SI (reg/f:DI 71) [0+4 S4 A32]) (const_int 8 [0x8])) (nil))) (insn 23 22 0 t.ii:27 (parallel [ (set (reg:SI 58 [ D.2041 ]) (plus:SI (reg:SI 72) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) ;; sv.f2 = D.2041 (insn 25 23 26 t.ii:27 (set (reg/f:DI 75) (const:DI (plus:DI (symbol_ref:DI ("sv") [flags 0x2] <var_decl 0x2b1ba3468140 sv>) (const_int 4 [0x4])))) -1 (nil)) (insn 26 25 27 t.ii:27 (parallel [ (set (reg:SI 76) (ashift:SI (reg:SI 58 [ D.2041 ]) (const_int 8 [0x8]))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) (insn 27 26 28 t.ii:27 (set (reg:SI 77) (mem/s/j/c:SI (reg/f:DI 75) [0+4 S4 A32])) -1 (nil)) (insn 28 27 29 t.ii:27 (parallel [ (set (reg:SI 78) (and:SI (reg:SI 77) (const_int 255 [0xff]))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) (insn 29 28 30 t.ii:27 (parallel [ (set (reg:SI 79) (ior:SI (reg:SI 78) (reg:SI 76))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) (insn 30 29 0 t.ii:27 (set (mem/s/j/c:SI (reg/f:DI 75) [0+4 S4 A32]) (reg:SI 79)) -1 (nil)) ;; fn ((int) D.2041, 0) (insn 31 30 32 t.ii:29 (set (reg:SI 4 si) (const_int 0 [0x0])) -1 (nil)) (insn 32 31 33 t.ii:29 (set (reg:SI 5 di) (reg:SI 58 [ D.2041 ])) -1 (nil)) (call_insn 33 32 0 t.ii:29 (call (mem:QI (symbol_ref/i:DI ("_Z2fnIiiEvT_T0_") [flags 0x1] <function_decl 0x2b1ba3461820 fn>) [0 S1 A8]) ... because reg:SI 58 is not a properly truncated intermediate result. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33887
next prev parent reply other threads:[~2007-12-11 12:38 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-10-24 23:44 [Bug c++/33887] New: " ian at airs dot com 2007-10-24 23:51 ` [Bug c++/33887] " pinskia at gcc dot gnu dot org 2007-10-25 5:07 ` ian at airs dot com 2007-10-25 5:22 ` pinskia at gcc dot gnu dot org 2007-10-25 13:25 ` ian at airs dot com 2007-12-08 20:07 ` [Bug middle-end/33887] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org 2007-12-11 12:38 ` rguenth at gcc dot gnu dot org [this message] 2007-12-11 12:50 ` rguenth at gcc dot gnu dot org 2007-12-11 13:08 ` [Bug c++/33887] " rguenth at gcc dot gnu dot org 2007-12-11 13:32 ` [Bug c++/33887] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org 2007-12-11 13:35 ` rguenth at gcc dot gnu dot org 2007-12-11 15:55 ` rguenth at gcc dot gnu dot org 2007-12-11 23:57 ` janis at gcc dot gnu dot org 2007-12-12 20:53 ` mmitchel at gcc dot gnu dot org 2007-12-12 22:04 ` janis at gcc dot gnu dot org 2007-12-12 22:47 ` rguenth at gcc dot gnu dot org 2007-12-14 14:32 ` bonzini at gnu dot org 2007-12-14 14:36 ` rguenther at suse dot de 2008-01-02 15:34 ` rguenth at gcc dot gnu dot org 2008-01-11 7:29 ` aoliva at gcc dot gnu dot org 2008-01-14 16:55 ` rguenth at gcc dot gnu dot org 2008-01-14 19:10 ` rguenth at gcc dot gnu dot org 2008-01-14 19:19 ` rguenth at gcc dot gnu dot org 2008-01-14 21:35 ` aoliva at gcc dot gnu dot org 2008-01-15 10:11 ` rguenth at gcc dot gnu dot org 2008-01-15 14:12 ` rguenth at gcc dot gnu dot org 2008-01-15 14:55 ` rguenth at gcc dot gnu dot org 2008-01-18 18:45 ` aoliva at gcc dot gnu dot org 2008-01-18 19:22 ` aoliva at gcc dot gnu dot org 2008-01-18 19:46 ` aoliva at gcc dot gnu dot org 2008-01-18 22:21 ` rguenth at gcc dot gnu dot org 2008-01-19 1:05 ` aoliva at gcc dot gnu dot org 2008-01-21 9:35 ` rguenth at gcc dot gnu dot org 2008-01-21 9:44 ` rguenth at gcc dot gnu dot org 2008-01-23 15:04 ` rguenth at gcc dot gnu dot org 2008-01-25 7:51 ` mmitchel at gcc dot gnu dot org 2008-01-25 12:15 ` rguenth at gcc dot gnu dot org 2008-01-25 12:56 ` [Bug c++/33887] [4.1/4.2 " rguenth at gcc dot gnu dot org 2008-01-25 20:57 ` tromey at gcc dot gnu dot org 2008-01-25 21:41 ` rguenth at gcc dot gnu dot org 2008-02-01 17:02 ` jsm28 at gcc dot gnu dot org 2008-02-07 18:04 ` rguenth at gcc dot gnu dot org 2008-03-12 14:27 ` rguenth at gcc dot gnu dot org 2008-03-12 14:31 ` rguenth at gcc dot gnu dot org 2008-04-18 14:04 ` aldot at gcc dot gnu dot org 2008-04-18 15:07 ` rguenth at gcc dot gnu dot org 2008-05-07 19:44 ` rguenth at gcc dot gnu dot org 2008-05-19 20:31 ` jsm28 at gcc dot gnu dot org 2008-07-04 22:53 ` [Bug c++/33887] [4.2 " jsm28 at gcc dot gnu dot org 2009-03-31 0:36 ` jsm28 at gcc dot gnu dot org
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=20071211123815.18354.qmail@sourceware.org \ --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).