|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
[Bug c/42006] New: Termination problem with -O2 and -O3Using r154087, the code below never terminates with -O2 and -O3.
yang@yang-working:~$ svngcc -O2 -o small2 small.c yang@yang-working:~$ ./small2 1 1 ... yang@yang-working:~$ ./small1 1 2 exit! yang@yang-working:~$ cat small.c #include <stdio.h> static int my_add(int si1, int si2) { return (si1 > (50-si2)) ? si1 : (si1 + si2); } static unsigned int my_shift(unsigned int left, int right) { return (right > 100) ? left : (left >> right); } static int func_4(unsigned int p_6) { for (p_6 = 1; p_6 < 3; p_6 = my_add(p_6, 1)) { printf ("%d\n", p_6); if (my_shift(p_6, p_6)) { return 0; } } return 0; } int main(void) { func_4(0); printf("exit!\n"); return 0; } yang@yang-working:~$ svngcc -v Using built-in specs. COLLECT_GCC=svngcc COLLECT_LTO_WRAPPER=/home/yang/compilers/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --enable-lto --prefix=/home/yang/compilers --program-prefix=svn --enable-languages=c,c++ --with-libelf=/home/yang/compilers : (reconfigured) ../configure --enable-lto --prefix=/home/yang/compilers --program-prefix=svn --with-libelf=/home/yang/compilers --enable-languages=c,lto,c++ --no-create --no-recursion : (reconfigured) ../configure --enable-lto --prefix=/home/yang/compilers --program-prefix=svn --with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) ../configure --enable-lto --prefix=/home/yang/compilers --program-prefix=svn --with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create --no-recursion : (reconfigured) ../configure --enable-lto --prefix=/home/yang/compilers --program-prefix=svn --with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create --no-recursion Thread model: posix gcc version 4.5.0 20091110 (experimental) (GCC) -- Summary: Termination problem with -O2 and -O3 Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: chenyang 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=42006 |
|
|
[Bug c/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #1 from rguenth at gcc dot gnu dot org 2009-11-11 20:35 ------- Confirmed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Known to work| |4.4.2 Last reconfirmed|0000-00-00 00:00:00 |2009-11-11 20:35:30 date| | Summary|Termination problem with -O2|[4.5 Regression] Termination |and -O3 |problem with -O2 and -O3 Target Milestone|--- |4.5.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
|
|
[Bug middle-end/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #2 from rguenth at gcc dot gnu dot org 2009-11-27 11:17 ------- Re-confirmed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |middle-end GCC build triplet|i686-pc-linux-gnu | GCC host triplet|i686-pc-linux-gnu | GCC target triplet|i686-pc-linux-gnu |x86_64-*-*, i?86-*-* Priority|P3 |P1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
|
|
[Bug middle-end/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #3 from rguenth at gcc dot gnu dot org 2009-11-27 14:18 ------- This is early IPA-SRA which transforms <bb 2>: goto <bb 9>; <bb 3>: p_6.0_3 = (int) p_6_1; if (p_6.0_3 <= 100) goto <bb 4>; else goto <bb 5>; <bb 4>: p_6_6 = p_6_1 >> p_6.0_3; <bb 5>: # p_6_7 = PHI <p_6_1(3), p_6_6(4)> if (p_6_7 != 0) goto <bb 10>; else goto <bb 6>; <bb 6>: if (p_6_1 <= 49) goto <bb 7>; else goto <bb 8>; <bb 7>: p_6_9 = p_6_1 + 1; <bb 8>: # p_6_10 = PHI <p_6_1(6), p_6_9(7)> <bb 9>: # p_6_1 = PHI <1(2), p_6_10(8)> if (p_6_1 <= 2) goto <bb 3>; else goto <bb 10>; to <bb 2>: goto <bb 9>; <bb 3>: p_6.0_3 = (int) p_6_2; if (p_6.0_3 <= 100) goto <bb 4>; else goto <bb 5>; <bb 4>: p_6_5 = p_6_2 >> p_6.0_3; <bb 5>: # p_6_12 = PHI <p_6_2(3), p_6_5(4)> if (p_6_12 != 0) goto <bb 10>; else goto <bb 6>; <bb 6>: if (p_6_12 <= 49) goto <bb 7>; else goto <bb 8>; <bb 7>: p_6_11 = p_6_12 + 1; <bb 8>: # p_6_4 = PHI <p_6_12(6), p_6_11(7)> <bb 9>: # p_6_2 = PHI <1(2), p_6_4(8)> if (p_6_2 <= 2) goto <bb 3>; else goto <bb 10>; see how p_6_9 = p_6_1 + 1 is changed to p_6_11 = p_6_12 + 1 forming an endless loop - it shuld have been p_6_11 = p_6_2 + 1 instead. Martin? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jamborm at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
|
|
[Bug middle-end/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #4 from jamborm at gcc dot gnu dot org 2009-11-27 18:46 ------- I have started a bootstrap and check of the following (with a testcase and change log and stuff...) which for some reason fixes this (renaming introduces the mess, the code as is generated by IPA-SRA is OK): Index: mine/gcc/tree-sra.c =================================================================== --- mine.orig/gcc/tree-sra.c +++ mine/gcc/tree-sra.c @@ -3478,7 +3478,10 @@ get_replaced_param_substitute (struct ip { char *pretty_name = make_fancy_name (adj->base); - repl = make_rename_temp (TREE_TYPE (adj->base), "ISR"); + repl = create_tmp_var (TREE_TYPE (adj->base), "ISR"); + if (TREE_CODE (TREE_TYPE (repl)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (repl)) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (repl) = 1; DECL_NAME (repl) = get_identifier (pretty_name); obstack_free (&name_obstack, pretty_name); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
|
|
[Bug middle-end/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #5 from jamborm at gcc dot gnu dot org 2009-11-27 22:34 ------- Subject: Bug 42006 Author: jamborm Date: Fri Nov 27 22:34:40 2009 New Revision: 154715 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154715 Log: 2009-11-27 Martin Jambor <mjambor@...> PR middle-end/42006 * tree-sra.c (get_replaced_param_substitute): Call create_tmp_var instead of create_tmp_var. Set DECL_GIMPLE_REG_P to one manually for vector and complex types. (get_adjustment_for_base): Describe return value in the comment. * testsuite/gcc.c-torture/execute/pr42006.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr42006.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-sra.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
|
|
[Bug middle-end/42006] [4.5 Regression] Termination problem with -O2 and -O3------- Comment #6 from jamborm at gcc dot gnu dot org 2009-11-27 22:35 ------- Fixed. -- jamborm at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42006 |
| Free embeddable forum powered by Nabble | Forum Help |