This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[testcase] optimization/5076: gcc3 regression: yet another strengthreduction bug
- From: Gwenole Beauchesne <gbeauchesne at mandrakesoft dot com>
- To: <gcc-gnats at gcc dot gnu dot org>
- Cc: <nobody at gcc dot gnu dot org>, <gcc-prs at gcc dot gnu dot org>, <gcc-bugs at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 2 Jan 2002 20:31:27 +0100 (CET)
- Subject: [testcase] optimization/5076: gcc3 regression: yet another strengthreduction bug
On 11 Dec 2001 gbeauchesne@mandrakesoft.com wrote:
> The attached test case is extracted/reduced from PR 2847 that was
> closed earlier. gcc3 series compilers are affected, unlike gcc-2.95.X.
> (gcc-"2.96" is affected too).
Here is another testcase exhibing a strength reduction bug occurring with
FSF gcc 3.0.3 and binutils 2.11.92.0.12-2mdk (based on RH 2.11.92.0.12-8)
on i586-mandrake-linux-gnu. Also occurs with gcc 3.0.3 on IA-64 and with
mainline gcc (3.1 20020102) on IA-32. This is a regression from gcc
2.95.X.
Testcase is derived from PR optimization/5076 and PR optimization/2847.
2002-01-02 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
PR optimization/5076, PR optimization/2847
* gcc.c-torture/execute/loop-10.c: New test.
--- gcc/testsuite/gcc.c-torture/execute/loop-10.c.strength-reduce
Wed Jan 2 18:55:53 2002
+++ gcc/testsuite/gcc.c-torture/execute/loop-10.c Wed Jan 2
18:54:03 2002
@@ -0,0 +1,31 @@
+/* Reduced from PR optimization/5076, PR optimization/2847 */
+
+static int count = 0;
+
+static void
+inc (void)
+{
+ count++;
+}
+
+int
+main (void)
+{
+ int iNbr = 1;
+ int test = 0;
+ while (test == 0)
+ {
+ inc ();
+ if (iNbr == 0)
+ break;
+ else
+ {
+ inc ();
+ iNbr--;
+ }
+ test = 1;
+ }
+ if (count != 2)
+ abort ();
+ return 0;
+}