[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bug de gcc?



Essayer ça:
#include<stdio.h>

void retenue_f(unsigned long a, unsigned long b, unsigned long
               c) 
{
    unsigned long f;
    unsigned long long tmp;

    printf("%lu, %lu, %lu\n", a, b, c);
    
    tmp = c+b;
    f = tmp%10;
    tmp = (unsigned long long)f + a;
    while(tmp >= 10)
            ;
}

int main(void)
{

    unsigned long r=1, s=2, t=3;
    
    retenue_f(r, s, t);
    return 0;
}

Compiler avec gcc -Wall -O2 bug.c -o bug
Puis faites bug
Il doit vous afficher 1, 0, 3 au lieu de 1, 2, 3.
Si quelqu'un peut m'expliquer.

PS: je n'arrive pas à le réduire encore pour produire l'erreur.
PS: gcc -v me donne:
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)

-- 
  __________________________________
(O) Debout les damnés de la terre   )
 ( Debout les forçats de la faim...(
(O)_________________________________)



Reply to: