public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/40762] New: possible integer miscompilation @ 2009-07-15 6:33 regehr at cs dot utah dot edu 2009-07-15 7:46 ` [Bug c/40762] " steven at gcc dot gnu dot org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: regehr at cs dot utah dot edu @ 2009-07-15 6:33 UTC (permalink / raw) To: gcc-bugs Seen on Ubuntu Hardy. The -O2 result seems to be wrong. Also valgrind says this about the -O2 compilation: ==6729== Conditional jump or move depends on uninitialised value(s) ==6729== at 0x84F22CB: solve_graph (tree-ssa-structalias.c:1570) regehr@john-home:~/volatile/tmp174$ current-gcc -O1 small.c -o small regehr@john-home:~/volatile/tmp174$ ./small checksum = 0 regehr@john-home:~/volatile/tmp174$ current-gcc -O2 small.c -o small regehr@john-home:~/volatile/tmp174$ ./small checksum = 1 regehr@john-home:~/volatile/tmp174$ current-gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/home/regehr/z/tmp/gcc-r149650-install --program-prefix=r149650- --enable-languages=c,c++ Thread model: posix gcc version 4.5.0 20090714 (experimental) (GCC) regehr@john-home:~/volatile/tmp174$ cat small.c #include <stdint.h> #include <limits.h> #include <stdio.h> uint8_t g_4; int64_t g_10; uint8_t g_56; uint8_t g_64; static uint8_t safe_rshift_func_uint8_t_u_u(uint8_t left, unsigned int right) { return ((((unsigned int)(right)) >= sizeof(uint8_t)*CHAR_BIT) ? ((uint8_t)(left)) : (((uint8_t)(left)) >> ((unsigned int)(right)))); } int32_t func_53 (void); int32_t func_53 (void) { if (safe_rshift_func_uint8_t_u_u (g_56, g_10)) { } else for (g_10 = 0; g_10; g_10 = 1) { } return 1; } int32_t func_36 (void); int32_t func_36 (void) { uint8_t p_40; g_10 = 1; g_10 && func_53 (); p_40 = g_10 || g_4; g_64 = g_10; return 1; } int main (void) { func_36 (); printf ("checksum = %d\n", g_64); return 0; } -- Summary: possible integer miscompilation Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: regehr at cs dot utah dot edu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40762] possible integer miscompilation 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu @ 2009-07-15 7:46 ` steven at gcc dot gnu dot org 2009-07-15 10:09 ` rguenth at gcc dot gnu dot org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: steven at gcc dot gnu dot org @ 2009-07-15 7:46 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from steven at gcc dot gnu dot org 2009-07-15 07:46 ------- Richi, this looks like it should go into your bucket of things to look at: ==6729== Conditional jump or move depends on uninitialised value(s) ==6729== at 0x84F22CB: solve_graph (tree-ssa-structalias.c:1570) -- steven at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40762] possible integer miscompilation 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu 2009-07-15 7:46 ` [Bug c/40762] " steven at gcc dot gnu dot org @ 2009-07-15 10:09 ` rguenth at gcc dot gnu dot org 2009-07-15 10:10 ` rguenth at gcc dot gnu dot org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-07-15 10:09 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from rguenth at gcc dot gnu dot org 2009-07-15 10:09 ------- Confirmed. With -O2 -fno-inline we get in .optimized func_36 () { <bb 2>: g_10 = 1; func_53 (); g_64 = 1; return 1; FRE does this. I'll check. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-07-15 10:09:19 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40762] possible integer miscompilation 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu 2009-07-15 7:46 ` [Bug c/40762] " steven at gcc dot gnu dot org 2009-07-15 10:09 ` rguenth at gcc dot gnu dot org @ 2009-07-15 10:10 ` rguenth at gcc dot gnu dot org 2009-07-15 10:17 ` [Bug middle-end/40762] [4.5 Regression] CD-DCE messes up virtual SSA form rguenth at gcc dot gnu dot org 2009-09-07 10:24 ` rguenth at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-07-15 10:10 UTC (permalink / raw) To: gcc-bugs -- 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 Last reconfirmed|2009-07-15 10:09:19 |2009-07-15 10:09:26 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/40762] [4.5 Regression] CD-DCE messes up virtual SSA form 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu ` (2 preceding siblings ...) 2009-07-15 10:10 ` rguenth at gcc dot gnu dot org @ 2009-07-15 10:17 ` rguenth at gcc dot gnu dot org 2009-09-07 10:24 ` rguenth at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-07-15 10:17 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from rguenth at gcc dot gnu dot org 2009-07-15 10:17 ------- We have wrong SSA form before FRE: ;; Function func_36 (func_36) func_36 () { uint8_t g_64.8; int64_t g_10.5; <bb 2>: # .MEM_17 = VDEF <.MEM_16(D)> g_10 = 1; # VUSE <.MEM_17> g_10.5_2 = g_10; if (g_10.5_2 != 0) goto <bb 3>; else goto <bb 4>; <bb 3>: # .MEM_18 = VDEF <.MEM_17> func_53 (); <bb 4>: # VUSE <.MEM_17> g_10.5_11 = g_10; g_64.8_12 = (uint8_t) g_10.5_11; # .MEM_19 = VDEF <.MEM_17> g_64 = g_64.8_12; return 1; There is a PHI node missing to merge .MEM_18 and .MEM_17. Which is caused by CD-DCE changes again. Honza? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|rguenth at gcc dot gnu dot |hubicka at gcc dot gnu dot |org |org Component|c |middle-end Keywords| |wrong-code Priority|P3 |P1 Summary|possible integer |[4.5 Regression] CD-DCE |miscompilation |messes up virtual SSA form Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/40762] [4.5 Regression] CD-DCE messes up virtual SSA form 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu ` (3 preceding siblings ...) 2009-07-15 10:17 ` [Bug middle-end/40762] [4.5 Regression] CD-DCE messes up virtual SSA form rguenth at gcc dot gnu dot org @ 2009-09-07 10:24 ` rguenth at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2009-09-07 10:24 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from rguenth at gcc dot gnu dot org 2009-09-07 10:24 ------- Fixed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40762 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-07 10:24 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-07-15 6:33 [Bug c/40762] New: possible integer miscompilation regehr at cs dot utah dot edu 2009-07-15 7:46 ` [Bug c/40762] " steven at gcc dot gnu dot org 2009-07-15 10:09 ` rguenth at gcc dot gnu dot org 2009-07-15 10:10 ` rguenth at gcc dot gnu dot org 2009-07-15 10:17 ` [Bug middle-end/40762] [4.5 Regression] CD-DCE messes up virtual SSA form rguenth at gcc dot gnu dot org 2009-09-07 10:24 ` rguenth 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).