This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 4.3.2 bug (was: Illegal subtraction in tmp-dive_1.s)
- From: Vincent Lefevre <vincent+gcc at vinc17 dot org>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 20 Apr 2009 15:17:44 +0200
- Subject: Re: GCC 4.3.2 bug (was: Illegal subtraction in tmp-dive_1.s)
- References: <53182.10.0.66.17.1239935538.squirrel@interact.purplecow.org> <863ac7bs3z.fsf@shell.gmplib.org> <20090417110846.GA14457@prunille.vinc17.org> <86hc0na454.fsf@shell.gmplib.org> <20090417150532.GA15548@prunille.vinc17.org> <20090417161727.GD15548@prunille.vinc17.org> <86iql38cyn.fsf@shell.gmplib.org> <206fcf960904171009m4e412d6fs4f4abc11743a048f@mail.gmail.com>
On 2009-04-17 12:09:42 -0500, Gabriel Dos Reis wrote:
> At least, let's get it archived on GCC mailing lists.
Is it a bug that has been identified? If not, perhaps this should
be added to the regression tests.
The program without the quotes:
/* With GCC 4.3.2 and -O2 option: output value is 1 instead of 0.
* If -fno-strict-aliasing is added, this bug disappears.
*/
#include <stdio.h>
#include <stdlib.h>
int test (int n)
{
unsigned long *p, *q;
int i;
q = p = malloc (n * sizeof (unsigned long));
if (p == NULL)
return 2;
for (i = 0; i < n - 1; i++)
p[i] = 0;
p[n - 1] = 1;
while ((*(q++))-- == 0) ;
return p[n - 1] == 1;
}
int main (void)
{
int r;
r = test (17);
printf ("%d\n", r);
return r;
}
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)